-
Notifications
You must be signed in to change notification settings - Fork 25
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 #802
Switch to pixi #802
Conversation
@pavelzw, let me know if you have any input regarding this PR or the general approach |
We already have this feature in our organization since last week. You can specify its behavior by setting the following in pixi.toml [tool.update]
autoupdate-branch = "pixi-update"
autoupdate-commit-message = "Update pixi lockfile"
autoupdate-pull-request-labels = ["dependencies"]
autoupdate-schedule = "monthly" # weekly, monthly, quarterly, never
ignore-environments = []
ignore-platforms = [] |
Would be interesting to see if/how this is supported the best way with pixi. Maybe running |
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.
Efforts look good so far 👍
Thanks so much for the help @pavelzw! I think it is shaping up nicely. It has already reveled that our minimum pinned versions are not recent enough. When we figure out how to handle nightlies (should be doable) and read the docs (less sure about this one) we should be good. |
There is a more-or-less hacky way to do readthedocs with pixi, see https://github.com/prefix-dev/pixi/pull/1423/files#diff-65d574b20be487abb02f3d039096768be5613f955410494c7862d3f6b3781432 the readthedocs-override example |
Atm I just use pip install to replace some packages with the nightly versions, without caring about their dependencies. This mirrors the current state of the daily ci runs. But yeah, would be interesting to see if we can do better in the future using pixi. |
Yeah it's indeed a bit hacky, but should be fine. I'm wondering if exporting the docs environment into a conda environment.yml, and using that for rtd would be a viable alternative. (I know that there is no pixi export command as of yet, but there seems to be one on the horizon, and the current pr is not urgent at all.) |
Performance wise installing pixi with conda and then running pixi install is probably still faster 🤔 |
There is one final question on my part about the mypy pre-commit hook. In the proposed version, we are running it in an environment where glum and all of its deps are installed. As a result, it finds lots of errors (most of which are not problematic ofc) even if only a tiny part of the source code changes. While this would be fine for a new project, it would require us to sprinkle An alternative would be to move mypy into the lint environment, which would be analogous to the way things worked before (pre-commit's mypy in a separate virtual env, no access to imports). It would come up with fewer false positives at the cost of being able to catch fewer errors. What should we do about this? |
@MatthiasSchmidtblaicherQC I like your idea about running just a subset of checks while a PR is draft (or the branch does not have an associated pr), but I feel that that is somewhat orthogonal to the current PR. I'd rather limit this PR to changing the package manager while keeping other things constant, and create a separate issue to improve the ci pipeline. Would that be okay with you? |
okay, I think I understand. You were talking about internal errors that were not discovered by mypy when we ran it in an isolated environment. So I think I'm getting the same errors. I'm looking into them. I think some are valid and helpful. Not sure why they were not caught before. |
before, mypy just skipped all Line 15 in 6507314
now, mypy has these packages available (since it's installed in the |
@stanmart, I added two commits. One to fix the "exclude" option of mypy which needs to be specified in the pre-commit-hook file and not in the config (a quirk of pre-commit). The other to fix the mypy errors. I get all green on my end when running locally. |
Final point: I think with this new setup we may need to run Fixing this should run the pre-commit checks in the CI instead of skipping them. See here for example. |
It's true that you need to add it to |
.pre-commit-config.yaml
Outdated
# mypy | ||
- id: mypy | ||
name: mypy | ||
entry: pixi run -e default mypy --check-untyped-defs --ignore-missing-imports --namespace-packages |
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.
entry: pixi run -e default mypy --check-untyped-defs --ignore-missing-imports --namespace-packages | |
entry: pixi run -e default mypy |
I would suggest moving --check-untyped-defs
and --namespace-packages
to the pyproject.toml
confiiguration and removing --ignore-missing-imports
altogether as it can lead to issues.
Instead, I would suggest installing additional types if needed (like pandas-stubs
, types-psutil
, ...) to your test
feature next to mypy
and for dependencies that don't have stubs yet adding an exception to pyproject.toml
as follows:
[[tool.mypy.overrides]]
# https://github.com/scikit-learn/scikit-learn/issues/16705
module = ["sklearn.*"]
ignore_missing_imports = true
Thanks, @MarcAntoineSchmidtQC and @pavelzw! I think most of your comments are now addressed. Later this week I'll add the type stub packages for dependencies that have them, and then try removing |
This seems to be rather tedious (I tried removing the flag and there are a lot of missing packages) because most of them will need there specific ignore config. I would prefer if we merged this first, and left this as a future task. |
Sounds good! Maybe we can still add some stub libraries so we get some extra checks, but keep Other than that case this PR looks ready to merge to me. Maybe a final question: do we need a changelog entry for this? |
Before merging this, we need to update the docs (e.g., https://glum.readthedocs.io/en/latest/contributing.html#install-for-development) and explain how to use this new machinery. |
I added some instructions a while ago, but it can be expanded a bit (e.g. with how to install both glum and tabmat in editable mode). Are there any other files that we need to update? |
Co-authored-by: Jan Tilly <jan.tilly@quantco.com>
@stanmart, was there something else you wanted to do in this PR? Happy to merge whenever you are okay with it. |
I think we can merge this as it is. |
This is a proposal to move from the current conda/mamba based dev installation to pixi. See #801 Check out the updated contributing page of the docs for info on how it changes the setup process.
Checklist
CHANGELOG.rst
entryTODO:
Advantages:
environment*.yml
files and having to doconda env update
s to create certain environments.Limitations: