scikit-learn-contrib/project-template

Intended workflow with pixi for dev environment

Closed this issue · 5 comments

Hello,

First of all thank you for this template! It's really neat and got me to discover pixi. I will use this setup for all multi-platform Python packages I work on.

I was wondering how it is meant to be used for development. I understand pixi will create 4 different conda environmentes. "lint", "test", "doc", and the "default" one. I find it unpractical to have to have to switch from one env to the other when you are developing the package and you want to alternatively lint, test, or generate the doc (with pixi shell -e ENV_NAME). Is it the intended workflow?

I was thinking that, alternatively, there could be a "dev" env defined in pyproject.toml in tool.pixi.environments:

dev = ["doc", "lint", "test"]

What do you think? Happy to open a PR myself if you think that could help.

PS: Also, I think the pre-commit dependency is missing in pyproject.toml (probably under the lint dependencies).

I find it unpractical to have to have to switch from one env to the other when you are developing the package and you want to alternatively lint, test, or generate the doc (with pixi shell -e ENV_NAME)

Normally, this is the reason for the defined task: pixi run test will activate the install and activate the environment for you.

You can run pixi task list to know the available task (and with the -e option for the dedicated environment).

PS: Also, I think the pre-commit dependency is missing in pyproject.toml (probably under the lint dependencies).

I'm not sure about this one because somehow, you need to have pre-commit install in the environment where you call the git command. So this is a bit up to you. I think this is the reason that I avoided to add the dependency.

I was thinking that, alternatively, there could be a "dev" env defined in pyproject.toml in tool.pixi.environments

Actually this could be a great idea if one need to just want to activate the shell and just play interactively. In this case, we could add pre-commit in the lint environment.

@gtauzin Do you want to open a PR for that. I think that we can as well add a small section in the documentation just mentioning that you can do pixi shell -e dev and then any command like pytest ...

Actually, I quickly push your proposal. Thanks for the suggestion, I think this is a great improvement in the workflow indeed.