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

Switch to pixi #74

Merged
merged 31 commits into from
Jun 1, 2024
Merged

Switch to pixi #74

merged 31 commits into from
Jun 1, 2024

Conversation

timmens
Copy link
Member

@timmens timmens commented May 18, 2024

In this PR, we switch from micromamba to pixi.

  • Delete docs folder (is unused at the moment)
  • Add pixi config section to pyproject.toml
  • Add pixi.lock file
  • Use pixi in GitHub Actions
  • Add dependabot.yml to .github folder, which helps with keeping GitHub Actions up-to-date
  • Update README with installation instructions for jax and jaxlib
  • Delete .envs folder
  • Delete environment.yml
  • Add custom pre-commit hook to match black/ruff versions with that of nbqa

Closes #75

@timmens timmens removed the postponed label May 29, 2024
Copy link
Member

@hmgaudecker hmgaudecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful!

.github/workflows/main.yml Outdated Show resolved Hide resolved
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 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.
  2. 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

Copy link
Member Author

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.

Copy link
Member

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?

Copy link
Member Author

@timmens timmens May 31, 2024

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.

README.md Show resolved Hide resolved
MANIFEST.in Outdated Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
@timmens timmens requested a review from hmgaudecker May 31, 2024 16:29
Copy link
Member

@hmgaudecker hmgaudecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

@timmens timmens merged commit 009ba08 into main Jun 1, 2024
6 checks passed
@timmens timmens deleted the pixi branch June 1, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: Switch to pixi
2 participants