Replies: 13 comments
-
I also just saw that this is mentioned as one of the requests in #1128 |
Beta Was this translation helpful? Give feedback.
-
I was thinking about this a bit, do you think that instead of like a 'postinstall' we can create a trigger that uses the hash of a file to automatically trigger a task after a or a number of tasks. Think of having both a Python project that uses npm as well. You could make a "trigger" that triggers when the package.json changes after an install or maybe any other task. Might be more powerful than a postinstall. |
Beta Was this translation helpful? Give feedback.
-
I think that it could a good addition to the idea. It definitely would make this a more complex feature to implement though. If it went that way I would think it could be some kind of configurable trigger, e.g. [tasks]
list-files = "ls -lah"
reset = "chartpress --reset"
[triggers]
post-install = ["list-files"]
[file-triggers]
"pixi.toml" = ["reset", "list-files"] |
Beta Was this translation helpful? Give feedback.
-
What about adding it to the task definition: [tasks]
install-npm = { cmd = "npm install", trigger = "post-install", inputs = ["package.json", "src/javascript/*.js" } Where those triggers are predefined names that pixi looks for when it runs the install. These could be extended with more triggers, but I would like to add them based on use-case/on-request. This would allow you to do something similar to the life cycle scripts from npm but without predefined names for the tasks. |
Beta Was this translation helpful? Give feedback.
-
Actually, the |
Beta Was this translation helpful? Give feedback.
-
Having now tried a few different I've ended up with a pattern like this for a monorepo where i can't use [feature.pip.tasks.install-editable]
inputs = ["pyproject.toml", "contrib/*/pyproject.toml", "editable.txt"]
outputs = ["build/pip-freeze/$PIXI_ENVIRONMENT_NAME.txt"]
cmd = """
rm -f build/pip-freeze/$PIXI_ENVIRONMENT_NAME.txt
&& python -m pip install -vv --no-deps --no-build-isolation --ignore-installed -r editable.txt
&& mkdir -p build/pip-freeze
&& pip freeze > build/pip-freeze/$PIXI_ENVIRONMENT_NAME.txt""" ... and then have any downstream tasks This still gets a little annoying further down the line when the [feature.docs.tasks.report]
depends_on = [
"install-editable", # where the current -e will be right
{task="test", environment="some-env"},
{task="test", environment="some-other-env"},
]
inputs = [
"build/pip-freeze/$PIXI_ENVIRONMENT_NAME.txt",
"build/reports/some-env.txt",
"build/reports/some-other-env.txt"
] Running Alternately, as the task name regex is luckily already quite tight, a separator could be introduced: depends_on = ["install-editable", "some-env::test", "some-other-env::test"] Of course, if |
Beta Was this translation helpful? Give feedback.
-
I have the need for this as well. I want to install a binary (that is not available in conda-forge/pypi) manually using curl into my environment/bin after pixi is finished building it. Reading this thread makes me think that triggering this automaticaly is not possible today? |
Beta Was this translation helpful? Give feedback.
-
@nicornk if building is task, you can achieve this with a |
Beta Was this translation helpful? Give feedback.
-
I was referring to calling „pixi install“. |
Beta Was this translation helpful? Give feedback.
-
Ah I understand, that would be the requested feature indeed. |
Beta Was this translation helpful? Give feedback.
-
This is basically one of my use-cases as well --- I want to install a Helm plugin after install, and to do the pre-commit startups and stuff like that. @tdejager maybe it could just be as simple as exposing the "install" as a task that can be depended on (possibly namespacing it to avoid collisions with user-named task |
Beta Was this translation helpful? Give feedback.
-
This is a good idea but requires more thought, Im not sure when we'll get to it so I moved it to the ideas discussion to not clutter the issues. |
Beta Was this translation helpful? Give feedback.
-
While lifecycle hooks are definitely useful and I'm also one of those who want the feature (the one simple use case is for git hooks, to run You may want to think about them when considering how to support similar features in pixi. Footnotes |
Beta Was this translation helpful? Give feedback.
-
Problem description
There was a brief proposal regarding lifecycle hooks in #524 but that issue was framed around Python dependencies. With the addition of the new
pypi-dependencies
the issue was more or less discarded. However there are other common use-cases for lifecycle hooks, especially when using pixi to setup development environments. Here's an example that will probably look familiar:Love this project, and always looking forward to the new features. The
pypi-dependencies
addition has seriously made life easier!Beta Was this translation helpful? Give feedback.
All reactions