Are `setup.cfg` tired?
It's not entirely clear to me what the status is setup.cfg
. I'm looking for solutions for my other question about PEP 508 environment markers and I'm completely confused.
It seems to me to be setup.cfg
an improvement over setup.py
because it is declarative, does not involve running arbitrary code to install packages, makes it difficult to distribute malicious Python packages, makes it easier to run Python package registries, etc.
So, here in the documentation itsetuptools
mentioned that setuptools got support for setup.cfg in 30.3.0 (8 Dec 2016)
, which is pretty recent. So this must be something new, right?
Not really. supported for a long time , at least since 2.6. Already 9 years have passed. distutils
setup.cfg
setup.cfg
At the same time ,wheel
it was said in the docs here that it was setup.cfg
deprecated and preferred to provide environment tokens via a parameter extras_require
. And it mentions setuptools, so it doesn't talk about the possible deprecated setup.cfg
distutils in setup.cfg
.
So what's really going on? Is this setup.cfg
outdated, or the most recent way to do something?
source to share
No, setup.cfg
it is not out of date and the document you mention is misleading.
There were serious reasons such as safety related to what setup.py
needs to be done and that the main reason for moving away from it.
Here's a dirty trick for extra features:
[options.extras_require] pdf = ReportLab>=1.2; RXP rest = docutils>=0.3; pack ==1.1, ==1.3
source to share
I would like to add a few notes on recent developments:
PEP 518 is still in a preliminary state, but I am interpreting it as an invitation to use pyproject.toml
instead setup.cfg
. Quoting from the PEP:
There are two problems with the
setup.cfg
setuptools used as a general format. First, there are files.ini
that have problems, as mentioned in the configparser discussion above. Another is that the schema for this file has never been strictly defined, and therefore it is not known which format will be safe to use in the future without confusing the setuptools installation.
From black documentation :
PEP 518 defines
pyproject.toml
as a configuration file to store the build system requirements for Python projects. With tools like Poetry or Flit, it can completely replace the need for filessetup.py
andsetup.cfg
.
Pip 19.0 implements PEP 517 allowing projects to specify a build backend via pyproject.toml
.
setuptools
there is an open issue called " Combine setup.cfg spec with pyproject.toml and reverse setup.py and setup.cfg ". However, the guys from setuptools
have not yet decided on this. There is open discussion about how to proceed.
Disclaimer: I feel completely lost in the Python packaging jungle on my own.
source to share