Skip to content

ci: consolidate pyproject2conda invocation through the prek hook#882

Merged
drbenvincent merged 3 commits into
mainfrom
ci/consolidate-pyproject2conda-via-prek
Jun 10, 2026
Merged

ci: consolidate pyproject2conda invocation through the prek hook#882
drbenvincent merged 3 commits 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

codecov Bot commented Apr 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.14%. Comparing base (7b306e6) to head (a594ca3).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #882   +/-   ##
=======================================
  Coverage   95.14%   95.14%           
=======================================
  Files          92       92           
  Lines       14860    14860           
  Branches      890      890           
=======================================
  Hits        14138    14138           
  Misses        505      505           
  Partials      217      217           

☔ View full report in Codecov by Harness.
📢 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

…ect2conda-via-prek

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	.github/workflows/ci.yml
…ect2conda-via-prek

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	.github/workflows/ci.yml
@drbenvincent drbenvincent merged commit 0197f17 into main Jun 10, 2026
15 checks passed
@drbenvincent drbenvincent deleted the ci/consolidate-pyproject2conda-via-prek branch June 10, 2026 13:07
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