Skip to content

ci: consolidate pyproject2conda invocation through the prek hook#882

Open
drbenvincent wants to merge 1 commit into
mainfrom
ci/consolidate-pyproject2conda-via-prek
Open

ci: consolidate pyproject2conda invocation through the prek hook#882
drbenvincent wants to merge 1 commit into
mainfrom
ci/consolidate-pyproject2conda-via-prek

Conversation

@drbenvincent
Copy link
Copy Markdown
Collaborator

Summary

Replaces the bespoke pip install pyproject2conda + pyproject2conda yaml ... + tail -n +10 ... | diff -u sequence in the check-environment-yml job with a single call to the existing pyproject2conda-yaml prek hook, then a git diff --exit-code against the committed environment.yml.

After this PR:

  • The pin for pyproject2conda lives only in .pre-commit-config.yaml (the prek hook rev). Bumping the tool requires editing exactly one file.
  • The argument list lives only in .pre-commit-config.yaml. Local prek run --all-files and the check-environment-yml CI job exercise the same hook with the same args by construction.
  • The 9-line tail -n +10 magic-number header skip is gone; the prek hook writes the workspace environment.yml in place, so a plain git diff is sufficient.

Why

#878 unblocked CI by pinning pyproject2conda<0.23 in the workflow, but it had to add an inline comment reminding maintainers to bump the workflow pin and the prek hook rev in lockstep. That's exactly the dual-pin smell that motivates this consolidation. See #879 for the design discussion.

Notes for reviewers

  • Uses the same j178/prek-action@cbc2f23... SHA pin already used by the prek job in this workflow, so no new third-party action is introduced.
  • permissions: contents: read is unchanged; the job still does not need write access.
  • The new error message tells contributors exactly what to run locally to fix a sync failure (prek run pyproject2conda-yaml --all-files), which the previous diff -u did not.

Test plan

  • check-environment-yml job passes on this PR (no drift between environment.yml and pyproject.toml).
  • Verify the job actually fails when environment.yml is out of date (e.g. push a deliberate desync to a scratch branch and confirm the new error message appears).
  • Confirm the prek hook's pinned rev: v0.22.1 is the version actually executed in CI (visible in the action logs).

Related

Made with Cursor

Replaces the bespoke `pip install pyproject2conda` + `pyproject2conda
yaml ...` + `tail -n +10 ... | diff -u` sequence in the
`check-environment-yml` job with a single call to the existing
`pyproject2conda-yaml` prek hook, then a `git diff --exit-code` against
the committed `environment.yml`.

Removes:
- A second pin for pyproject2conda (the prek hook `rev` is now the only
  one).
- A second copy of the long argument list, which previously had to be
  kept in sync by hand with `.pre-commit-config.yaml`.
- The `tail -n +10` magic-number header skip (still tracked separately
  for any other places that might depend on a similar pattern).

Local `prek run --all-files` and CI now exercise the same hook with the
same args by construction.

Closes #879.

Made-with: Cursor
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.59%. Comparing base (deb8774) to head (00c8f16).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #882      +/-   ##
==========================================
- Coverage   94.60%   94.59%   -0.02%     
==========================================
  Files          80       80              
  Lines       12764    12764              
  Branches      770      770              
==========================================
- Hits        12076    12074       -2     
- Misses        485      486       +1     
- Partials      203      204       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@read-the-docs-community
Copy link
Copy Markdown

Documentation build overview

📚 causalpy | 🛠️ Build #32484998 | 📁 Comparing 00c8f16 against latest (deb8774)

  🔍 Preview build  

1 file changed
± 404.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops DevOps related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consolidate CI pyproject2conda invocation through the prek hook

1 participant