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

unsafe-package is not overriding the default list of packages #1756

Closed
mmerickel opened this issue Dec 7, 2022 · 3 comments · Fixed by #1766
Closed

unsafe-package is not overriding the default list of packages #1756

mmerickel opened this issue Dec 7, 2022 · 3 comments · Fixed by #1766
Labels
bug Something is not working writer Related to results output writer component

Comments

@mmerickel
Copy link

mmerickel commented Dec 7, 2022

$ pip-compile --help
  --unsafe-package TEXT           Specify a package to consider unsafe; may be
                                  used more than once. Replaces default unsafe
                                  packages: distribute, pip, setuptools

Environment Versions

  1. OS Type macos 13.0.1
  2. Python version: 3.9.7
  3. pip version: 22.3.1
  4. pip-tools version: 6.11.0

Steps to replicate

  1. define foo.in
pyramid
  1. pip-compile --unsafe-package pip foo.in

Expected result

Pinned setuptools.

Actual result

Unpinned setuptools.

Below are the commands with and without --unsafe-package and note the output is the same.

❯ pip-compile foo.in
WARNING: using legacy resolver is deprecated and will be removed in future versions. The default resolver will be change to 'backtracking' in 7.0.0 version. Specify --resolver=backtracking to silence this warning.
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
#    pip-compile foo.in
#
hupper==1.10.3
    # via pyramid
pastedeploy==3.0.1
    # via plaster-pastedeploy
plaster==1.1.2
    # via
    #   plaster-pastedeploy
    #   pyramid
plaster-pastedeploy==1.0.1
    # via pyramid
pyramid==2.0
    # via -r foo.in
translationstring==1.4
    # via pyramid
venusian==3.0.0
    # via pyramid
webob==1.8.7
    # via pyramid
zope-deprecation==4.4.0
    # via pyramid
zope-interface==5.5.2
    # via pyramid

# The following packages are considered to be unsafe in a requirements file:
# setuptools
❯ pip-compile --unsafe-package pip foo.in
WARNING: using legacy resolver is deprecated and will be removed in future versions. The default resolver will be change to 'backtracking' in 7.0.0 version. Specify --resolver=backtracking to silence this warning.
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
#    pip-compile --unsafe-package=pip foo.in
#
hupper==1.10.3
    # via pyramid
pastedeploy==3.0.1
    # via plaster-pastedeploy
plaster==1.1.2
    # via
    #   plaster-pastedeploy
    #   pyramid
plaster-pastedeploy==1.0.1
    # via pyramid
pyramid==2.0
    # via -r foo.in
translationstring==1.4
    # via pyramid
venusian==3.0.0
    # via pyramid
webob==1.8.7
    # via pyramid
zope-deprecation==4.4.0
    # via pyramid
zope-interface==5.5.2
    # via pyramid

# The following packages are considered to be unsafe in a requirements file:
# setuptools

Note that if I use --allow-unsafe then everything ends up pinned, including pip in my env where pip gets included as well. Specifically pip-tools itself depends on pip so and we have pip-tools in one of our requirements files.

Also note that it says Python 3.10 was used which is incorrect. Opening a separate issue for this.

@atugushev atugushev added bug Something is not working backwards incompatible Backwards incompatible change writer Related to results output writer component and removed backwards incompatible Backwards incompatible change labels Dec 11, 2022
@atugushev
Copy link
Member

atugushev commented Dec 11, 2022

That's a bug. Apparently we forgot to filter out customised unsafe packages in writer:

unsafe_requirements = (
{r for r in results if r.name in UNSAFE_PACKAGES}
if not unsafe_requirements
else unsafe_requirements
)

@mmerickel
Copy link
Author

Thank you @atugushev!

@atugushev
Copy link
Member

Released as part of pip-tools 6.12.0. Thanks to @q0w!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working writer Related to results output writer component
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants