Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for pip>=22.0, drop support for Python 3.6 #1567

Merged
merged 11 commits into from
Feb 4, 2022

Conversation

di
Copy link
Contributor

@di di commented Feb 2, 2022

This PR consolidates all the changes necessary to update pip-tools for pip>=22.0, namely:

Fixes #1558, closes #1559.
Fixes #1566.
Fixes #1562, closes #1560, closes #1561, closes #1564.

Contributor checklist
  • Provided the tests for the changes.
  • Assure PR title is short, clear, and good to be included in the user-oriented changelog
Maintainer checklist
  • Assure 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).

hugovk and others added 6 commits February 2, 2022 06:44
Since pip no longer guarantees that it will no longer normalize
underscore (_) in distribution names to dash (-) in `pip freeze`, `pip
list`, and `pip show` (https://pip.pypa.io/en/stable/news/#id73) , in
the interest of minimizing churn, pip-compile should normalize
requirements names instead. This will ensure there are no changes to
requirements files compiled with earlier versions of pip-tools/pip.
This test doesn't actually modify the requirements file, so update it to
start with a normalized requirement name so it can continue to expect a
normalized requirement name.
This is where we diverge from pip's output: pip no longer guarantees
that it will canonicalize requirement names in `pip freeze` but we will
continue to output canonicalized names.
@nicoa
Copy link
Contributor

nicoa commented Feb 2, 2022

RichPopStreamHandler didn't exist in pip<22 - feel free to take the commits from #1565 into this PR, taking this into account.

@di di force-pushed the get-ci-green branch 2 times, most recently from f440c47 to fd76111 Compare February 2, 2022 13:57
@di
Copy link
Contributor Author

di commented Feb 2, 2022

@nicoa Thanks, I missed that the tests were being run across multiple pip versions!

Copy link

@fsecada01 fsecada01 left a comment

Choose a reason for hiding this comment

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

Thorough. Nicely done.

@pauloxnet
Copy link
Member

LGTM

@AndydeCleyre
Copy link
Contributor

Anyone else think we should take the opportunity to replace the assert with if+raise or similar, as asserts aren't guaranteed to run depending on interpreter optimizations?

IMO assert should only be in explicit tests.

piptools/utils.py Outdated Show resolved Hide resolved
@fsecada01
Copy link

Anyone else think we should take the opportunity to replace the assert with if+raise or similar, as asserts aren't guaranteed to run depending on interpreter optimizations?

IMO assert should only be in explicit tests.

I agree with you, which is what I did in my pull request.

Copy link
Contributor

@wbolster wbolster left a comment

Choose a reason for hiding this comment

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

seems using the github suggestion ui is not ideal. this line should be removed now:

        line = str(ireq.req).lower()

piptools/repositories/pypi.py Outdated Show resolved Hide resolved
Co-authored-by: wouter bolsterlee <wouter@bolsterl.ee>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
@pradyunsg pradyunsg added this to the 6.5.0 milestone Feb 3, 2022
@pradyunsg pradyunsg added the enhancement Improvements to functionality label Feb 3, 2022
@pradyunsg
Copy link
Contributor

This likely needs retitling, since the PR title goes into the changelog!

@di di changed the title Consolidated changes for pip>=22.0 Add support for pip>=22.0, drop support for Python 3.6 Feb 3, 2022
@di
Copy link
Contributor Author

di commented Feb 3, 2022

Good point @pradyunsg, updated the title.

@pradyunsg pradyunsg merged commit 9fb2d42 into jazzband:master Feb 4, 2022
@pradyunsg
Copy link
Contributor

Thanks @di!

@d0ugal
Copy link

d0ugal commented Feb 4, 2022

Thanks!

@atugushev
Copy link
Member

This is now released as part of pip-tools 6.5.0! Thanks, @di, @hugovk, and all involved!

@ssbarnea
Copy link
Member

ssbarnea commented Feb 4, 2022

I have the impression that this change may have have an interesting outcome in produced locked files:

@di
Copy link
Contributor Author

di commented Feb 4, 2022

Yes, this is expected, we're now fully canonicalizing every project name, so this is a one way change.

Without this, many dashes would have changed back to underscores (but not all) and this would have changed in the compiled file depending on which underlying pip version was used.

@ssbarnea
Copy link
Member

ssbarnea commented Feb 4, 2022

I am happy to see canonicalizing! My only concern was that this aspect was not directly visible under commit title so most will not see it. Sadly that change would likely to keep me busy for at least one day, considering number of affected projects.

Until today I considered keeping pre-commit out of dependency lock as a good idea. Time to pay for own mistakes.

replaceafill added a commit to artefactual-labs/a3m that referenced this pull request Mar 28, 2022
MichaelRoytman added a commit to openedx/edx-submissions that referenced this pull request Mar 29, 2022
The following comment is borrowed from this pull request, with changes: openedx/opaque-keys#218

This failure started happening in the automated requirements upgrade GitHub action:
https://github.com/openedx/edx-submissions/runs/5704384647?check_suite_focus=true

The bug was being caused by an interaction between pip and pip-tools, described here:
jazzband/pip-tools#1558

The bug is fixed in pip-tools==6.5.0 - from this PR:
jazzband/pip-tools#1567

This pull requests bumps the version of pip-tools manually to get the automated upgrades working again.
MichaelRoytman added a commit to openedx/edx-submissions that referenced this pull request Mar 29, 2022
The following comment is borrowed from this pull request, with changes: openedx/opaque-keys#218

This failure started happening in the automated requirements upgrade GitHub action:
https://github.com/openedx/edx-submissions/runs/5704384647?check_suite_focus=true

The bug was being caused by an interaction between pip and pip-tools, described here: jazzband/pip-tools#1558

The bug is fixed in pip-tools==6.5.0 - from this pull request: jazzband/pip-tools#1567

This pull requests bumps the version of pip-tools manually to get the automated upgrades working again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements to functionality
Projects
None yet