Skip to content

CI: Reduce pip behaviour dependencies in test suite#2105

Closed
ncoghlan wants to merge 10 commits intojazzband:mainfrom
ncoghlan:issue-2104-avoid-pip-freeze-protection-assumptions
Closed

CI: Reduce pip behaviour dependencies in test suite#2105
ncoghlan wants to merge 10 commits intojazzband:mainfrom
ncoghlan:issue-2104-avoid-pip-freeze-protection-assumptions

Conversation

@ncoghlan
Copy link
Copy Markdown

@ncoghlan ncoghlan commented Jun 23, 2024

Closes #2104

Contributor checklist
  • Included tests for the changes (change is to fix a test).
  • PR title is short, clear, and ready to be included in the user-facing changelog.
Maintainer checklist
  • Verified one of these labels is present: backwards incompatible, feature, enhancement, deprecation, bug, dependency, docs or skip-changelog as they determine changelog listing.
  • Assign the PR to an existing or new milestone for the target version (following Semantic Versioning).

@chrysle chrysle added tests Testing and related things pip Related to pip skip-changelog Avoid listing in changelog sync labels Jun 28, 2024
@ncoghlan ncoghlan changed the title CI: Avoid a pip behaviour dependency in test_sync CI: Reduce pip behaviour dependencies in test suite Jul 8, 2024
@webknjaz
Copy link
Copy Markdown
Member

@ncoghlan could you check if this is still necessary? pip is now pinned to 24.2 in regular CI runs, and the CI has been made green with that (see #2140).

@webknjaz webknjaz mentioned this pull request Dec 16, 2024
4 tasks
@ncoghlan
Copy link
Copy Markdown
Author

Given CI is green, I agree it isn't necessary to proceed with this.

@ncoghlan ncoghlan closed this Dec 17, 2024
@ncoghlan ncoghlan deleted the issue-2104-avoid-pip-freeze-protection-assumptions branch December 17, 2024 11:15
@webknjaz
Copy link
Copy Markdown
Member

@ncoghlan note that the pip version in CI is now restricted so that the updates are transparent. So it is possible that this breaks with newer pips (I know there are some problems; I just don't know if they are the same you were looking to address here).

@ncoghlan ncoghlan restored the issue-2104-avoid-pip-freeze-protection-assumptions branch December 18, 2024 11:52
@ncoghlan
Copy link
Copy Markdown
Author

Ah, in that case you will still need something along these lines when upgrading to a newer pip. The specific changes this made are to:

  • explicitly set a build system and constraint file in test_compile_recursive_extras_build_targets
  • remove setuptools, wheel and distribute from the expected set of protected modules in test_diff_should_not_uninstall

@ncoghlan ncoghlan reopened this Dec 18, 2024
@ncoghlan
Copy link
Copy Markdown
Author

This will be an interesting test to see if my changes actually broke compatibility with the older pip version.

My prediction: the explicit build system change will be OK, but the protected file list test case will fail (since the older pip still protects those packages)

Comment thread tests/test_cli_compile.py
constraints_file.write_text("\n".join(version_constraints))
env = os.environ.copy() # Copy entire env to avoid Windows compatibility issues
# Work around https://github.com/jazzband/pip-tools/pull/1681/files#r1667748889
env["PIP_CONSTRAINT"] = str(constraints_file)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What if this was to be made conditional? Perhaps, the test could be parametrized with variants before and after certain pip version that would run in different jobs (through the skipif mark). It'd be able to cover the concern of breaking on older versions…

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

With pip 25.3+, we'd need PIP_BUILD_CONSTRAINT.

@webknjaz webknjaz requested a review from sirosen July 9, 2025 21:25
@webknjaz
Copy link
Copy Markdown
Member

webknjaz commented Nov 5, 2025

@ncoghlan do you think this is still relevant?

cc @sirosen

@sirosen sirosen mentioned this pull request Feb 12, 2026
4 tasks
@sirosen
Copy link
Copy Markdown
Member

sirosen commented Feb 12, 2026

I have spent quite a while staring at this and trying to decide whether or not there's anything we should keep in the PIP_CONSTRAINT change.

Because we now parse pyproject.toml statically where possible, the original issue doesn't apply anymore, at least if I'm reading things correctly.
I find the test in question (test_compile_recursive_extras_build_targets) to be unclear in purpose -- it seems to be one of a small number of happy-path tests for --build-deps-for, but it also involves self-referential extras. So I'm not sure that I'm correctly reading what it's trying to test?

In any case, I've filed #2336 with what I think is the usable part of this, and I'm closing as having been addressed across #2188 and various other changes.

@sirosen sirosen closed this Feb 12, 2026
@github-project-automation github-project-automation Bot moved this from 🧐 @webknjaz's review queue 📋 to 🌈 Done 🦄 in 📅 Procrastinating in public 😵‍💫 Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:skip pip Related to pip skip-changelog Avoid listing in changelog sync tests Testing and related things

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test failure: pip freeze no longer protects setuptools, distribute or wheel on Python 3.12+

4 participants