-
Notifications
You must be signed in to change notification settings - Fork 1
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
Switch to pixi #74
Switch to pixi #74
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful!
.pre-commit-config.yaml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just occurred to me when I wanted to update nbqa-ruff to v0.4.6 (need to keep this in sync with ruff manually, please change): How does pixi play with pre-commit? Would I still have a conda base env / the system Python to base pre-commit on? Sounds like trouble for some things...
I just confirmed that: pixi run pre-commit
leads to An unexpected error has occurred: CalledProcessError: command: ('/mnt/econ/lcm/lcm/.pixi/envs/default/bin/python3.12', '-mvirtualpenv', '/home/hmg/.cache/pre-commit/repor0qq6lyq/py_env-python3.11', '-p', 'python3.11')
because the tool.ruff
section still specifies target-version = "py311"
😆
Can we somehow use the pixi-installed Python automatically when pre-commit is run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Since this has happened before, and I know my forgetful brain, I've added a custom pre-commit hook that checks whether these versions are out-of-date.
- Yes, this can definitely lead to problems. In principle, you can enter a
pixi shell
, which is similar to activating a conda environment. I don't know whether the pre-commit hooks use the correct Python version in this case though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think we do not want that. I think this would also be difficult with the pre-commit CI, since there we would require the pixi environment as well.
I think the version now should work as before under conda.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it worked under conda only if you activated the correct environment or your activated Python happened to be the correct version, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, so there may be more clever solutions that I'm not aware of, but I think the easiest for now is to use pixi like conda.
I.e., you activate the pixi environment before you work in a project.
Alternatively, you could start with pixi run pre-commit install
, and then afterwards run pixi run git commit -m "commit msg"
, which would use the correct Python version.
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
In this PR, we switch from micromamba to pixi.
docs
folder (is unused at the moment)pyproject.toml
pixi.lock
filedependabot.yml
to.github
folder, which helps with keeping GitHub Actions up-to-dateCloses #75