Skip to main content

setuputils3

A utility module to automate building setup configuration files. The latest official release is available on PyPI at https://pypi.org/project/setuputils3/ and the latest source code is available on Gitlab at https://gitlab.com/pdonis/setuputils3.

Running setuputils in the root of your source tree will build a setup.cfg file 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 uses setup.cfg, setuptools, also has much the same auto-discovery capability, but the advantage with setuputils is that you get to see all the output of the auto-discovery logic in the final setup.cfg file before using it to build your distribution. With setuptools, 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 of setup.cfg, you put options that you want to specify in advance in the root of your source tree in files with an .in extension, one for each section that will end up in setup.cfg. For example, you would put metadata in the file metadata.in, options in the file options.in, etc. For subsections, just use the subsection name as it would appear in setup.cfg as the base file name, so, for example, entry points would appear in options.entry_points.in. Do not include anything in the .in files that you want setuputils to auto-discover, so, for example, if you want setuputils to auto-discover your packages, you would not include "packages" in your options.in file at all (whereas with setuptools you would include "packages = find:" in your setup.cfg).

Once you have created your .in files, then you simply execute

$ python3 -m setuputils

in the root of your source tree. This will build the setup.cfg file 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 a setup.py script at all. You can use setuptools as such a backend as long as you include a pyproject.toml file and specify setuptools in it, as described in the Python packaging documentation. If you do have a setup.py script, all it would need to contain is an import of setuptools and call to setuptools.setup() with no arguments (since all of the information needed is in setup.cfg).

You can also use setuputils itself as a PEP 517 compliant build backend. In this mode, you can still run setuputils as described above before doing your build to make sure setup.cfg is correct. But using setuputils as your build backend ensures that setup.cfg will be rebuilt on every build to ensure consistency with the current state of your source tree. To use setuputils as your build backend, your pyproject.toml should look like this:

[build-system]
requires = ["setuputils3 >= 2.1", "setuptools >= 40.8.0", "wheel"]
build-backend = "setuputils_build"

You still need to include setuptools and wheel as build requirements, since setuputils depends on them; the setuputils build backend is just a thin wrapper around setuptools.build_meta that ensures that setup.cfg is built and up to date before the setuptools build runs.

Note that if you have a setup.py script that was used with previous versions of setuputils, you do not have to transition it to the new format using .in files all at once. Setuputils will read any global variables that are defined in your setup.py, as you would have done in previous setuputils versions, and include them in what it outputs to setup.cfg after 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 to setup_vars in your setup.py script, leaving only the call to setuptools.setup() with no arguments, since all the information it needs will be in setup.cfg.) Note that if you have a setup.py script, you cannot use setuputils as a build backend; you can only use it to generate setup.cfg before doing a build. Also note that if you are using setuputils in this "legacy" mode, you will have to include it in your source distributions (instead of just listing it as a requirement in pyprojects.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-2026 by Peter A. Donis. Released under the Python Software Foundation License.

Release files for setuputils3 2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for setuputils3 2.3
File Size Uploaded
setuputils3-2.3.tar.gz 14.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for setuputils3 2.3
File Interpreter ABI Platform
setuputils3-2.3-py3-none-any.whl Python 3 none any Details

Total release size: 29.7 kB

Release files / setuputils3-2.3.tar.gz

Download URL setuputils3-2.3.tar.gz
Size 14.2 kB
Tags Source
SHA-256 checksum
How to use checksums
55877d3c11aa5d8c72eb4ac34b942e96c875054a5a5e7ea797b4ec6e942471b7
BLAKE2b-256 checksum
How to use checksums
409418ec9e570da976bbf11721f0bdce027b4d2c31acd129132ae1e37f6fb062
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.10

Release files / setuputils3-2.3-py3-none-any.whl

Download URL setuputils3-2.3-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
84eb2a96651f11027e113301747602208561bf5604e65336bf5dfae66fa3d9c0
BLAKE2b-256 checksum
How to use checksums
5b873e2609150b7495994b57c58741152aed91e3c425352740c4365bebcfe02f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.10

Release history Release notifications | RSS feed

This release

2.3 This release

2 release files

2.2

2 release files

2.1

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0

2 release files

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0

1 release file

0.9.6

1 release file

0.9.5

1 release file

0.9.4

1 release file

0.9.3

1 release file

0.9.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page