fix(packaging): split the testing extras and stop publishing testcontainers - #1317
Open
ogenstad wants to merge 1 commit into
Open
fix(packaging): split the testing extras and stop publishing testcontainers#1317ogenstad wants to merge 1 commit into
ogenstad wants to merge 1 commit into
Conversation
…ainers The `tests` extra published two weeks ago bundled `infrahub-testcontainers`, which no release of this SDK has ever shipped to users: it has been a dev dependency since it arrived in December 2024, for the SDK's own integration tests. Declaring it in a user-facing extra took `[tests]` from the four packages it historically installed to sixty-one, including a telemetry library, for anyone who only wanted to test a Transform. It came from resolving a real signal the wrong way. The new import check flagged `testing/docker.py` importing something nothing declared, and the answer taken was to publish a dependency rather than ask whether that module was user-facing at all. Two extras now, matching what the code actually needs: testing pytest, for the bundled plugin and the testing schemas testcontainers the above plus infrahub-testcontainers, for testing/docker.py Only `docker.py` needs the container tooling, so the import check is now per-file rather than per-package. `testing/repository.py` needs nothing beyond the core dependencies and is held to the base install, which is the truth: a unit test imports it today. `tests` is dropped rather than kept as an alias. It installed nothing at all from 1.16.0 onwards while the docs kept advertising it, so there is no working install to preserve, and keeping it alongside `testing` would only invite picking the wrong one. The check also now follows self-referential extras, without which `testcontainers` appeared to install nothing.
Deploying infrahub-sdk-python with
|
| Latest commit: |
546dc82
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://decaff54.infrahub-sdk-python.pages.dev |
| Branch Preview URL: | https://pog-testing-extras.infrahub-sdk-python.pages.dev |
ogenstad
marked this pull request as draft
September 2, 2026 14:28
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## infrahub-develop #1317 +/- ##
====================================================
- Coverage 85.55% 85.33% -0.22%
====================================================
Files 148 148
Lines 14282 14085 -197
Branches 1953 1936 -17
====================================================
- Hits 12219 12020 -199
- Misses 1496 1499 +3
+ Partials 567 566 -1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
ogenstad
marked this pull request as ready for review
September 2, 2026 17:49
ajtmccarty
approved these changes
Sep 2, 2026
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.
Short version
Some time ago we had an option to install with
pip install infrahub-sdk[tests]that has been broken for some time. Here we replace it withpip install infrahub-sdk[testing]this is to avoid confusion with the dependency groups as we also have a "tests" group for development dependency. We also move out the infrahub-testcontainers into its own group withpip install infrahub-sdk[testcontsiners]. So:Why
The
testsextra added in #1277 bundledinfrahub-testcontainers, and it should not have. That package has never been shipped to users by any release of this SDK: it has been a dev dependency since Damien added it ine4d190f1(2024-12-24), for the SDK's own integration tests. Publishing it took the extra from the four packages it historically installed to sixty-one, includingamplitude-analytics, for anyone who only wanted to test a Transform.Worth being clear about how that happened, since it says something about the check added in the same PR. The new per-surface import test flagged
infrahub_sdk/testing/docker.pyimporting a package nothing declared, and the resolution taken was to declare it in a user-facing extra. The correct reading was that the module is dev scaffolding which merely happens to live inside the package directory. A published API was changed to satisfy a test written minutes earlier.Nothing has released yet, so this is free to correct.
[tests]exists only oninfrahub-develop.Goal: two extras that each mean one thing to a user, with the heavy container tooling opt-in.
Non-goals: whether
infrahub_sdk.testingshould ship in the wheel at all. It is undocumented, and a base class in it (TestInfrahubDockerClient) looks like something a downstream consumer would inherit. That deserves a decision from whoever owns the module, not a packaging change here.What changed
Behavioral changes:
pip install 'infrahub-sdk[testing]'installs pytest and enables the bundledpytest-infrahubplugin. Four packages on top of a plain install.pip install 'infrahub-sdk[testcontainers]'additionally providesinfrahub_sdk.testing.docker, which starts a real Infrahub in containers. Around sixty packages, and now only reached by asking for it by name.testsextra is gone. It installed nothing at all from 1.16.0 (2025-12-01) onwards while the docs kept advertising it, so there is no working install to preserve.[testing]is the direct replacement for what[tests]gave users up to 1.15.2.infrahub-sdk[all]now aggregatesctl,testingandtestcontainers.Implementation notes:
docker.pyneeds the container tooling, soEXTRA_ONLY_MODULESin the import check is now per-file rather than per-package.testing/repository.pyis deliberately absent from it and held to the base install, because that is the truth: it needs nothing beyond the core dependencies, andtests/unit/sdk/test_repository.pyimports it today.testcontainerslooked as though it installed nothing, since its pytest requirement arrives viainfrahub-sdk[testing]. The check caught this itself on the first run.testsis dropped rather than kept as an alias fortesting. Two near-identical names would only invite installing the wrong one, and there is no functioning install behind the old name to keep working.Verified behaviour, installing the built wheel into a clean environment for each:
testing.dockertesting.repository[testing][testcontainers][all]What stayed the same: no runtime code changed. Packaging metadata, the import check's surface map, docs, and changelog.
How to review
Start with
pyproject.toml, then theEXTRA_ONLY_MODULESand_declared_inchanges intests/unit/test_packaging_metadata.py. Docs and changelog follow from those.The judgement call worth scrutiny is dropping
testsoutright. The case for it: broken for nine months across nineteen releases, so no meaningful population depends on it resolving. The case against: it did work up to 1.15.2, and 1.15 is a maintained line, so someone upgrading from there sees a removal. That is why the changelog entry names the replacement explicitly.How to test
Verified locally: ruff, ty and mypy 2.3.1 clean; unit suite 1859 passed with 2 failures that reproduce identically on the base branch (macOS-only Rich wrapping of long temp paths, in files this PR does not touch); 33 passed on both 3.10 and 3.12 for the metadata module; lock consistent;
docs-validateexit 0;lint-docsunchanged at its 20 pre-existing errors.Changelog
The fragments from #1277 are unreleased, so they were corrected rather than supplemented, to stop the 1.24 notes announcing
[tests]and then retracting it:+tests-extra.added.mdremoved, replaced by+testing-extras.changed.mddescribing the final state and the migration from[tests]+dependency-lower-bounds.changed.mdnow attributespackagingto thetestcontainersextra rather thantests+core-template-dependencies.fixed.md,+rich-upper-bound.changed.mdand+packaging-metadata-tests.housekeeping.mdre-read and left alone; all three are still accurateDocumentation Updates
docs/docs/python-sdk/guides/installation.mdx:testssection replaced bytestingandtestcontainers, each explaining what it gives you. The size note added in fix(packaging): correct declared dependencies and publish the tests extra #1277 moves totestcontainers, where it is now true.docs/docs/python-sdk/introduction.mdx: both the uv and pip tabs updated.README.md: same treatment as the installation guide.Impact & rollout
[tests]should move to[testing].testswould need a deprecation.Checklist
Summary by cubic
Splits the testing extras so
infrahub-sdk[tests]no longer publishesinfrahub-testcontainers(a dev dependency never meant for users). Thetestsextra is replaced bytestingfor pytest support andtestcontainersfor running Infrahub in containers.pip install 'infrahub-sdk[testing]'installs pytest and enables the bundled plugin;[testcontainers]adds the container-basedinfrahub_sdk.testing.docker.testsextra has installed nothing since 1.16.0, so no working install is affected.testing/docker.pyto thetestcontainersextra per-file and follows self-referential extras.[testing].Written for commit 546dc82. Summary will update on new commits.