Setuptools "unsafe" as install dependency

See original GitHub issue

I’m working near the limits of my knowledge of Python packaging so please be patient.

If I build a project based on “fs”, and have “fs” in my “prod.in” file, pip-tools will complain when I try to generate requirements.txt.

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

I can also reproduce this by running pip-compile in the setuptools root directory itself.

The exact reason that this is considered unsafe is slightly unclear, but there is also a CVE that mentions setuptools. That causes my company’s scanning tools to also complain about setuptools due to the complaint called sonatype-2014-0148. Which is more or less this issue:

https://github.com/pypa/setuptools/issues/227

Which was never resolved to Sonatype’s satisfaction.

Typically, Setuptools is not an install-time requirement of Python packages. Is there a reason it must be an insall-time requirement for ‘fs’?

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lurchcommented, Apr 20, 2022

This is just a guess, but perhaps it’s related to this ? 🤷

0reactions
althonoscommented, Apr 24, 2022

Basically, the reason it appears twice is because we need it on both stages:

  • when building the wheel, you need setuptools >=38 because it’s the minimum version that supports reading metadata from setup.cfg files.
  • when using the library, because the extensions (fs.sshfs, etc.) are loaded as entry points. This part could be replaced by a more up-to-date solution like importlib.metadata I guess.

I’m feeling like this shouldn’t be a security issue because we specify a minimum version, not a mandatory one. Sure, the minimum one has a CVE, but you should use the latest setuptools available for the Python version you’re using I suppose.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the proper way to decide whether to allow unsafe ...
Consider using the --allow-unsafe flag. # setuptools==41.6.0 # via kiwisolver The generated requirements file may be rejected by pip install ...
Read more >
jazzband/pip-tools - generate-hashes imply --allow-unsafe?
Running pip-compile --generate-hashes without --allow-unsafe for those packages creates a requirements.txt file that doesn't work with pip ...
Read more >
It's Unsafe to Download Some Python Packages - Dustico
This happens when pip , Python's package manager, tries to understand the metadata of the downloaded package, like its version or a list...
Read more >
Python Dependency Management With Pip-Tools - Mike Slinn
Django-oscar defines PIP dependencies with a setting called ... Pin packages considered unsafe: distribute, pip, setuptools.
Read more >
Why you shouldn't invoke setup.py directly - Paul Ganssle
Your build and runtime environments will be isolated by default: you really don't want a runtime dependency on setuptools or wheel or Cython, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found