Package: setuputils3
setuputils3A utility module to automate building setup configuration files.
The latest official release is available on PyPI athttps://pypi.org/project/setuputils3/and the latest source code is available on Gitlab athttps://gitlab.com/pdonis/setuputils3.Runningsetuputilsin the root of your source tree will build
asetup.cfgfile for you from inputs that you supply and from
its ability to auto-discover the things that typically go into a
distribution of your Python application or library. The main tool
that usessetup.cfg,setuptools, also has much the same
auto-discovery capability, but the advantage withsetuputilsis
that you get to see all the output of the auto-discovery logic in
the finalsetup.cfgfilebeforeusing it to build your
distribution. Withsetuptools, you have no way of getting an
advance look at what the tool thinks should go into your
distribution; you only see what is in the distribution after it
is built.Using setuputils in this mode is simple: for each section ofsetup.cfg, you put options that you want to specify in advance
in the root of your source tree in files with an.inextension,
one for each section that will end up insetup.cfg. For example,
you would put metadata in the filemetadata.in, options in the
fileoptions.in, etc. For subsections, just use the subsection
name as it would appear insetup.cfgas the base file name, so,
for example, entry points would appear inoptions.entry_points.in.
Do not include anything in the.infiles that you wantsetuputilsto auto-discover, so, for example, if you wantsetuputilsto auto-discover your packages, you would not include
"packages" in youroptions.infile at all (whereas withsetuptoolsyou would include "packages = find:" in yoursetup.cfg).Once you have created your.infiles, then you simply execute$ python3 -m setuputilsin the root of your source tree. This will build thesetup.cfgfile for you. You can then look at it to make sure it is correct
before using a build backend to build your distribution.With this mode, if you are using a PEP 517 compliant build backend, you
do not need asetup.pyscript at all. You can usesetuptoolsas
such a backend as long as you include apyproject.toml fileand specifysetuptoolsin it, as described in the Python packaging documentation.
If you do have asetup.pyscript, all it would need to contain is
an import ofsetuptoolsand call tosetuptools.setup()with no
arguments (since all of the information needed is insetup.cfg).You can also usesetuputilsitself as a PEP 517 compliant build
backend. In this mode, you can still runsetuputilsas described above
before doing your build to make suresetup.cfgis correct. But usingsetuputilsas your build backend ensures thatsetup.cfgwill be
rebuilt on every build to ensure consistency with the current state of
your source tree. To usesetuputilsas your build backend, yourpyproject.tomlshould look like this:[build-system]
requires = ["setuputils3 >= 2.1", "setuptools >= 40.8.0", "wheel"]
build-backend = "setuputils_build"You still need to includesetuptoolsandwheelas build
requirements, sincesetuputilsdepends on them; thesetuputilsbuild backend is just a thin wrapper aroundsetuptools.build_metathat ensures thatsetup.cfgis built and up to date before thesetuptoolsbuild runs.Note that if you have asetup.pyscript that was used with previous
versions ofsetuputils, you do not have to transition it to the
new format using.infiles all at once.Setuputilswill read any
global variables that are defined in yoursetup.py, as you would have
done in previoussetuputilsversions, and include them in what it
outputs tosetup.cfgafter processing them just as it would have in
previous versions, so you can transition things incrementally if that works
better for your project. (However, you should remove any calls tosetup_varsin yoursetup.pyscript, leaving only the call tosetuptools.setup()with no arguments, since all the information
it needs will be insetup.cfg.) Note that if you have asetup.pyscript, you cannot usesetuputilsas a build backend; you can only
use it to generatesetup.cfgbefore doing a build. Also note that if
you are usingsetuputilsin this "legacy" mode, you will have to
include it in your source distributions (instead of just listing it as a
requirement inpyprojects.toml), since "legacy" mode builds have no
way of specifying build requirements other than setuptools itself.See the module docstrings for more information.SETUPUTILS3 is Copyright (C) 2012-2022 by Peter A. Donis.
Released under the Python Software Foundation License.