ci: install test job env via micromamba (refs #279)#910
Open
anevolbap wants to merge 5 commits into
Open
Conversation
Replace pip-based setup in the test matrix with mamba-org/setup-micromamba
consuming the autogenerated environment.yml, so PyMC comes from
conda-forge in CI.
- Pin setup-micromamba to v3.0.0 by SHA, matching the security style
of the rest of the workflow.
- Add `defaults.run.shell: bash -el {0}` so the activated env persists
across steps.
- Pass python plus the missing test extras (pytest, pytest-cov,
papermill) via `create-args`, since environment.yml is generated
from the dev extras and does not include them.
- Install the local package with `pip install --no-deps -e .` so pip
cannot pull pip-built pymc/pytensor on top of the conda ones.
- Drop 3.11 from the matrix because environment.yml pins
`python>=3.12`. New matrix is ["3.12", "3.14"].
Probe for pymc-labs#279, kept on a feature branch for validation.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #910 +/- ##
=======================================
Coverage 95.07% 95.07%
=======================================
Files 87 87
Lines 13701 13701
Branches 812 812
=======================================
Hits 13026 13026
Misses 479 479
Partials 196 196 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add `-e test` to the pyproject2conda invocation in .pre-commit-config.yaml and the check-environment-yml job in ci.yml. Regenerate environment.yml so it now includes pytest, pytest-cov, and papermill. Drop those three deps from the test job's create-args, since they now flow through environment.yml. Keeps that file as the single dependency source per pymc-labs#713 and removes the cache-key divergence introduced by passing test deps through create-args.
Header-only change so the file matches what the pyproject2conda-yaml prek hook produces. The body is identical to the previous commit. Restores pre-commit.ci to green.
juanitorduz
approved these changes
May 11, 2026
Collaborator
juanitorduz
left a comment
There was a problem hiding this comment.
thanks @anevolbap !
@drbenvincent can you take a look as this one is key ;) ?
Collaborator
|
Thanks for all these. I'm a bit behind on causal reviews - bear with me and I'll attempt to catch up |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #279.
The CI
testmatrix still installs PyMC via pip. #304 moved local dev to a conda install but explicitly scoped out CI. Earlier attempts at the CI half stalled (#281 conda-lock, #412 pixi). #713 has since madeenvironment.ymlan autogenerated artifact synced withpyproject.toml, which makes a clean swap straightforward.What this PR does
Switches the
testmatrix in.github/workflows/ci.ymlfrompip install -e .[test]tomamba-org/setup-micromambaconsuming the autogeneratedenvironment.yml, so PyMC comes fromconda-forgein CI.setup-micromambato v3.0.0 by SHA, matching the security style of the rest of the workflow.defaults.run.shell: bash -el {0}so the activated env persists across steps.pytest,pytest-cov,papermill) fromenvironment.ymlby adding-e testto thepyproject2condainvocation in.pre-commit-config.yamland thecheck-environment-ymljob. Keepsenvironment.ymlas the single source of truth.pip install --no-deps -e .so pip cannot pull pip-builtpymc/pytensoron top of the conda ones.Open question: Python 3.11 in CI
The matrix changed from
["3.11", "3.14"]to["3.12", "3.14"], becauseenvironment.ymlis generated with--python-include "python>=3.12"and the 3.11 leg would not solve. The package itself still claims 3.11 support (requires-python = ">=3.11",Programming Language :: Python :: 3.11classifier). Two paths forward, neither taken in this PR:requires-pythonto>=3.12and drop the 3.11 classifier.--python-includein thepyproject2condainvocation topython>=3.11so the 3.11 leg can solve, then re-add it to the matrix.Happy to take direction on which one you prefer.
CI runtime impact
The
testmatrix went from ~3-5 min (pip) to roughly 5-8 min (conda) on the first run.cache-environmentshould bring subsequent runs closer to the pip baseline as long asenvironment.ymldoes not change.Verification
pymc,pytensor,numpy,scipyall fromconda-forgewith MKL BLAS,blas_ldflagsreferences the conda env'slib, nopytensor.tensor.blasnumpy-fallback warning. Doctests 35 passed / 11 skipped, extra tests 2 passed, full suite 936 passed / 17 skipped, coverage 94.97% in 3m27s.test (3.12)andtest (3.14)pass. TheShow environmentstep in each test job's log confirmspymcis installed fromconda-forgeandblas_ldflagsreferences the conda env'slib.Out of scope
release.yml,test_notebook.yml, anduml.ymlworkflows also pip-install PyMC (transitively viacausalpy[docs]etc.). They are in the spirit of install pymc in the recommended manner for remote workflows #279 but a separate change.prekjob or thecheck-environment-ymljob beyond the-e testaddition above.Reviewed with Claude Opus 4.7 (adversarial review pass).