Skip to content

Fix test-dependency parity between PR CI and PyPI publish#91

Merged
pacharanero merged 1 commit into
livefrom
fix-test-dependency-parity
Jun 16, 2026
Merged

Fix test-dependency parity between PR CI and PyPI publish#91
pacharanero merged 1 commit into
livefrom
fix-test-dependency-parity

Conversation

@pacharanero

Copy link
Copy Markdown
Member

Problem

The v4.5.0 PyPI publish failed: pandas was not installed when the publish workflow ran the tests, so rcpchgrowth/tests/test_who.py errored on import 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. pandas is a genuine test-only dependency — only test_who.py imports it; nothing in the library does.

Fix

  • Single source of truth: new [dev] optional-dependencies group in pyproject.toml (pytest, pandas, bump2version). requirements.txt now resolves to -e .[dev], so local, PR CI and publish all install the same set.
  • Same tests everywhere: the pytest workflow gains workflow_call; the publish workflow now reuses that exact job (jobs.test.uses:) with deploy gated on needs: test, instead of duplicating install + pytest steps.
  • Remove the unused import pandas from rcpchgrowth/who.py.

Validation

  • Clean-room .[dev] install (mirrors the publish path) provides pandas 3.0.3; test_who.py passes 995/995.
  • Full local suite passes 145018 passed, 1700 skipped.

Follow-up notes

  • The test job is renamed deploytest. When branch-protection required status checks are enabled, reference test (3.10)test (3.13).
  • After this merges, the v4.5.0 release will be re-cut from the fixed live commit so the publish succeeds (4.5.0 was never distributed).

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)'.
@pacharanero pacharanero merged commit f663bd4 into live Jun 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant