ci: pin pyproject2conda==0.22.1 to work around 0.23.0 regression#878
Conversation
The check-environment-yml job does `pip install pyproject2conda` with no
version constraint, so each CI run grabs the latest release from PyPI.
pyproject2conda 0.23.0 was published on 2026-04-29 and regressed with:
AttributeError: 'CondaRequirement' object has no attribute 'channel'
raised from `_normalized_requirements._iter_parts` during the call to
`pyproject2conda yaml ...`. This breaks the job for every PR opened
since 2026-04-29, regardless of whether the PR touches pyproject.toml
or environment.yml.
Pin the CI install to v0.22.1 to match the rev already pinned for the
local prek hook in .pre-commit-config.yaml. The two should be bumped
together once a fixed pyproject2conda release is available.
Made-with: Cursor
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #878 +/- ##
=======================================
Coverage 94.60% 94.60%
=======================================
Files 80 80
Lines 12764 12764
Branches 770 770
=======================================
Hits 12076 12076
Misses 485 485
Partials 203 203 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Replaces the strict ==0.22.1 pin with a range pin so a hypothetical 0.22.x patch backport can ship without a workflow edit, while still excluding the 0.23.x line that broke us. Also drops the release date from the inline comment (the version identifier 0.23.0 is the durable reference; git blame recovers the date) and expands the explanation of the failure mode for future readers. Made-with: Cursor
|
Updated this PR off the back of an adversarial review. Two changes in
Also added a "Why pin instead of work around?" section to the PR body. Short version: the regression is in Follow-ups that came out of the review have been filed as separate issues / will be opened as a follow-up PR; links will be added to the PR body's "Follow-up" section as they land. |
Summary
The
check-environment-ymlCI job has been failing on every PR opened since 2026-04-29 with:Root cause
The job does
pip install pyproject2condawith no version constraint (ci.yml:51-52), so each CI run grabs whatever is latest on PyPI.pyproject2conda 0.23.0was published to PyPI on 2026-04-29 and contains a regression whereCondaRequirementinstances no longer expose thechannelattribute that_iter_parts()still tries to read. This is hit during__hash__of any conda requirement, so the tool blows up immediately when called with the args our workflow uses.The local prek hook in
.pre-commit-config.yamlis already pinned tov0.22.1(the last good release), so localprek run --all-filesis unaffected — only CI breaks.Filed upstream as usnistgov/pyproject2conda#94.
Fix
Pin the CI
pip installto>=0.22.1,<0.23so it tracks the same 0.22.x line as the local prek hook (rev: v0.22.1) while still allowing a hypothetical 0.22.x patch backport to ship without a workflow edit. Added an inline comment explaining the failure mode so future bumps remember to lift CI and the prek hook in lockstep.Why pin instead of work around?
The traceback lands in
CondaRequirement.__hash__→_iter_parts(), which is invoked unconditionally as soon aspyproject2condamaterialises any conda requirement. There is no plausible CLI flag, env extra, orpyproject.tomlshape change that avoids that code path while still producing a usable conda yaml — the broken attribute access fires before any of our arguments matter. Pinning is therefore the right lever; alternative workarounds were not pursued because they cannot exist for this failure mode.Evidence this is environmental, not PR-specific
docs/789-sc-sensitivity-walkthrough) hascheck-environment-ymlfailing despite touching only a single.ipynbfile (nopyproject.tomlorenvironment.ymlchanges).check-environment-ymlrun was on 2026-04-28 — it picked uppyproject2conda 0.22.1before 0.23.0 was published.Test plan
check-environment-ymljob passes on this PR.check-environment-ymlgoes green there too.Follow-up
When pyproject2conda ships a fixed release, bump both
.pre-commit-config.yaml(rev: v0.22.1→ newer) and.github/workflows/ci.yml(the version range → newer) together — or, preferably, merge #882 first so there is only one place to bump.Tracked separately:
tail -n +10header comparison in this same job: Fragile header-skip in check-environment-yml diff comparison #880