According to the setuptools
documentation, setuptools
version 30.3.0 (December 8, 2016) "allows using configuration files (usually setup.cfg) to define package’s metadata and other options which are normally supplied to setup()
function". Similar to running pip install -r requirements.txt
to install Python packages from a requirements file, is there a way to ask pip
to install the packages listed in the install_requires
option of a setup.cfg
configuration file?
you must have a valid setup.py file apart from setup. cfg and pyproject. toml . You can use the same dummy setup file I shared in the previous section that makes just a single call to the setup() method.
It prefers binary wheels if there are any, and if they are multiple it chooses the one most specific to the install environment. These are just pip 's default preferences though—they can be configured with options like --no-binary or --prefer-binary .
All users who install pip will get setuptools by default. Users cannot explicitly uninstall setuptools after installing pip nor exclude setuptools when installing pip. Users might op-out from installing Recommended packages by default to save space, and such users will still get setuptools with pip.
If you have all your dependencies and other metadata defined in setup.cfg
, just create a minimal setup.py
file in the same directory that looks like this:
from setuptools import setup
setup()
From now on you can run pip install
and it will install all the dependencies defined in setup.cfg
as if they were declared in setup.py
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With