Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for activation targets to tasks #1350

Open
matthewfeickert opened this issue May 8, 2024 Discussed in #1323 · 3 comments
Open

Add support for activation targets to tasks #1350

matthewfeickert opened this issue May 8, 2024 Discussed in #1323 · 3 comments
Labels
enhancement New feature or request needs-design Needs a design so it can be implemented

Comments

@matthewfeickert
Copy link
Contributor

While ideally you shouldn't need to rely super heavily on activation scripts, sometimes it does become necessary or becomes sociologically a practicality to get work done with other people in your field. While it is quite nice that pixi already supports activation scripts, it would be useful if these could also be tied to tasks so that when using pixi run <task name> syntax you could ensure that particular setup steps are taken in the tasker runner subshell before task execution.

Aside: The activation script examples in the ROS 2 tutorial are pretty helpful for understanding how activation scripts work with environments.

Discussed in #1323

Originally posted by matthewfeickert May 3, 2024

...

pixi does support activation scripts with [activation], but how would one write the TOML to specify an activation script for a specific task in an environment?

...

Are there any plans to implement something like this in the future? Or is this not a goal for the pixi task runners in general?

Originally posted by ruben-arts May 7, 2024

I could see support for that coming to the tasks yes, and it shouldn't be to hard as we already do the activation anyway.

@ruben-arts
Copy link
Contributor

He @matthewfeickert, as shortly mentioned in the discussion, I believe this could complement the tasks as well.

[activation]
# currently available:
scripts = ["env.sh"]
# In PR 1156 and not yet good enough 
env = { VARIABLE = "value" }

[tasks]
# currently available:
start = { cmd = "echo $VAR", env = {VAR = "value"}}
# Logical next addition based on this conversation (note I'm not fond of the naming yet, please help):
task_with_special_activation = { cmd = "python specialized_tool.py", env = { scripts = ["env.sh"]}}

Unfortunately our big inspiration Task doesn't have an activation script running field that we can learn from. So lets discuss some use-cases before we decide on the design.

@ruben-arts ruben-arts added enhancement New feature or request needs-design Needs a design so it can be implemented labels May 8, 2024
@matthewfeickert
Copy link
Contributor Author

Sorry to ignore this for a few weeks (I've had too much work travel). I also have not given this sufficient thought yet, but is task_activation too generic or confusing?

[tasks]
# currently available:
start = { cmd = "echo $VAR", env = {VAR = "value"}}
task_activation = { cmd = "python specialized_tool.py", env = { scripts = ["env.sh"]}}

@ruben-arts
Copy link
Contributor

That could be a way of doing it! it just conflicts with the current implementation of env as we need to specialize the parser to find scripts and see it as a different thing then a normal variable. If you have more ideas keep them coming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs-design Needs a design so it can be implemented
Projects
None yet
Development

No branches or pull requests

2 participants