Fix test-dependency parity between PR CI and PyPI publish#91
Merged
Conversation
The v4.5.0 PyPI publish failed because pandas was not installed when the publish workflow ran the test suite, while the PR/push workflow happened to pull pandas in transitively via the 'notebook' extra. The two workflows therefore tested different environments and the gap was only caught at release time. Root cause: test dependencies were declared in two places that drifted. pandas is a genuine test-only dependency (only rcpchgrowth/tests/test_who.py imports it; nothing in the library does). Changes: - Add a [dev] optional-dependencies group in pyproject.toml as the single source of truth for test/release tooling (pytest, pandas, bump2version). - requirements.txt now resolves to '-e .[dev]' so local, PR CI and publish all install the same set. - Make the pytest workflow reusable via workflow_call. - The publish workflow now reuses that exact test job (jobs.test.uses:) with deploy gated on 'needs: test', instead of duplicating install + pytest steps. A release can no longer be published against an environment the PR matrix did not test. - Remove the unused 'import pandas' from rcpchgrowth/who.py. Validated: clean-room '.[dev]' install provides pandas and test_who.py passes 995/995; full local suite passes 145018 / 1700 skipped. Note: the test job is renamed from 'deploy' to 'test'. Branch-protection required status checks (if/when enabled) should reference 'test (3.x)'.
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.
Problem
The
v4.5.0PyPI publish failed: pandas was not installed when the publish workflow ran the tests, sorcpchgrowth/tests/test_who.pyerrored onimport pandas. PyPI never received 4.5.0 (latest published is still 4.4.1).It was not caught earlier because the PR/push workflow installed
.[notebook](which transitively includes pandas) while the publish workflow installed.+requirements.txt(only pytest). The two workflows tested different environments.Root cause
Test dependencies were declared in two places that drifted.
pandasis a genuine test-only dependency — only test_who.py imports it; nothing in the library does.Fix
[dev]optional-dependencies group inpyproject.toml(pytest,pandas,bump2version).requirements.txtnow resolves to-e .[dev], so local, PR CI and publish all install the same set.workflow_call; the publish workflow now reuses that exact job (jobs.test.uses:) withdeploygated onneeds: test, instead of duplicating install + pytest steps.import pandasfromrcpchgrowth/who.py.Validation
.[dev]install (mirrors the publish path) provides pandas 3.0.3;test_who.pypasses 995/995.Follow-up notes
deploy→test. When branch-protection required status checks are enabled, referencetest (3.10)…test (3.13).v4.5.0release will be re-cut from the fixedlivecommit so the publish succeeds (4.5.0 was never distributed).