Skip to content

ci: Pin transitive dependencies for tests suites on Python>=3.8#6437

Draft
alexander-alderman-webb wants to merge 3 commits into
masterfrom
webb/populate-tox/transitive-dependencies
Draft

ci: Pin transitive dependencies for tests suites on Python>=3.8#6437
alexander-alderman-webb wants to merge 3 commits into
masterfrom
webb/populate-tox/transitive-dependencies

Conversation

@alexander-alderman-webb
Copy link
Copy Markdown
Contributor

@alexander-alderman-webb alexander-alderman-webb commented May 28, 2026

Description

Add transitive dependencies to all test groups that are generated by populate_tox.py.
Dependency versions are resolved via a dry run of pip through uv on the relevant Python version.
Pins one set of dependencies per Python version and per library version.

Issues

Reminders

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

Codecov Results 📊

28 passed | Total: 28 | Pass Rate: 100% | Execution Time: 8.34s

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 17056 uncovered lines.
❌ Project coverage is 24.44%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    26.24%    24.44%     -1.8%
==========================================
  Files          190       189        -1
  Lines        22890     22573      -317
  Branches      7834      8559      +725
==========================================
+ Hits          6007      5517      -490
- Misses       16883     17056      +173
- Partials       506       483       -23

Generated by Codecov Action

@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review May 28, 2026 13:30
@alexander-alderman-webb alexander-alderman-webb requested a review from a team as a code owner May 28, 2026 13:30
@alexander-alderman-webb alexander-alderman-webb changed the title ci: Pin transitive dependencies for tests suites ci: Pin transitive dependencies for tests suites ran on Python>=3.8 May 28, 2026
@alexander-alderman-webb alexander-alderman-webb changed the title ci: Pin transitive dependencies for tests suites ran on Python>=3.8 ci: Pin transitive dependencies for tests suites on Python>=3.8 May 28, 2026
@alexander-alderman-webb alexander-alderman-webb marked this pull request as draft May 28, 2026 13:37
Comment thread scripts/populate_tox/populate_tox.py
Comment thread scripts/populate_tox/populate_tox.py Outdated
Comment thread scripts/populate_tox/populate_tox.py Outdated
Comment on lines +1189 to +1202
for python_version in release.python_versions:
if python_version < ThreadedVersion("3.8"):
continue
try:
deps = _get_transitive_dependencies(
integration, package, release, python_version
)
except DryRunFailed as error:
print(
f"\npip dry run failed for version {release} of {package} on Python {python_version}:\n{error}"
)
continue
if deps:
release.transitive_dependencies.append(deps)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transitive-dependency cache ignores Python version, so all but the first iteration return stale results

The inner loop calls _get_transitive_dependencies once per python_version, but fetch_package_dependencies caches results keyed only on package+version (no Python version). After the first iteration resolves deps on, say, Python 3.8, every subsequent iteration (3.9, 3.10, 3.11…) returns those same cached Python 3.8 pins while labelling them with the later Python version in the tox env name.

Evidence
  • _fetch_package_dependencies_from_cache(package, version) at line 204 ignores python_version; cache hit returns immediately.
  • _save_to_package_dependencies_cache(package, version, ...) at line 247 also omits python_version, so the first call's result is stored under just package+version.
  • The new loop (lines 1189–1202) iterates over all release.python_versions; for a release supporting 3.8–3.11 the second through fourth calls will all hit the cache entry written by the first call.
  • The dep strings embed the current python_version in the tox env name (e.g. 3.11-django-v4.2: …) but the pinned package versions came from the Python 3.8 resolution, which can differ (e.g. tzdata, asgiref, or other conditional deps).
  • _get_dependency_probe_constraints at lines 167–193 also varies by python_version, so even the constraints used differ per iteration, yet the cached result from the first call ignores this.

Identified by Warden code-review · VCG-BDE

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh that's not good

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