Skip to main content

Simplify your setup.py

Version on pypi Tested with Github Actions Code coverage with coveralls Python versions tested (link to github project) Version on conda-forge

Writing a setup.py typically involves lots of boilerplate and copy-pasting from project to project.

This package aims to simplify that and bring some DRY principle to python packaging. Here’s what your (complete, and ready to ship to pypi) setup.py could look like with setupmeta:

from setuptools import setup

setup(
    name="myproject",
    versioning="distance",          # Optional, would activate tag-based versioning
    setup_requires="setupmeta"      # This is where setupmeta comes in
)

And that should be it - setupmeta will take it from there, extracting everything else from the rest of your project (following typical conventions commonly used).

You can use the explain command (see commands) to see what setupmeta deduced from your project, for the above it would look something like this (you can see which file and which line each setting came from, note that a lot of info is typically extracted from your project, if you follow usual conventions):

~/myproject: python setup.py explain

          author: (auto-adjust     ) Your Name
              \_: (myproject.py:7  ) Your Name<your@email.com>
    author_email: (auto-adjust     ) your@email.com
     description: (README.rst:1    ) First line of your README
    entry_points: (entry_points.ini) [console_scripts] ...
install_requires: (requirements.txt) ["click", ...
         license: (auto-fill       ) MIT
long_description: (README.rst      ) Long description would be your inlined README
            name: (explicit        ) myproject
      py_modules: (auto-fill       ) ["myproject"]
  setup_requires: (explicit        ) ["setupmeta"]
         version: (git             ) 1.2.3.post2
      versioning: (explicit        ) distance

See examples for more.

Note: setupmeta’s versioning is based on:

git describe --dirty --tags --long --first-parent --match 'v*.*'

you will need git version >= 1.8.4 if you wish to use setupmeta’s versioning capabilities.

Goal

The goal of this project is to:

  • Allow to write very short (yet complete) setup.py-s, without boilerplate, and encourage good common packaging practices

  • Point out missing important info (example: version) in setup.py explain

  • Support tag-based versioning (like setuptools_scm, but with super simple configuration/defaults and automated bump capability)

  • Provide useful Commands to see the metadata (explain), version (including support for bumping versions), and check

How it works?

  • Everything that you explicitly provide in your original setuptools.setup() call is taken as-is (never changed), and internally labelled as explicit. So if you don’t like something that setupmeta deduces, you can always explicitly state it.

  • name is auto-filled from your setup.py’s __title__ (if there is one, sometimes having a constant is quite handy…)

  • packages and package_dir is auto-filled accordingly if you have a <name>/__init__.py or src/<name>/__init__.py file

  • py_modules is auto-filled if you have a <name>.py file

  • entry_points is auto-filled from file entry_points.ini (bonus: tools like PyCharm have a nice syntax highlighter for those)

  • install_requires is auto-filled from requirements.in (preferred), then requirements.txt (or pinned.txt for older projects), pinning is abstracted away by default as per community recommendation, see requirements for more info.

  • description will be the 1st line of your README (unless that 1st line is too short, or is just the project’s name), or the 1st line of the first docstring found in the scanned files (see list below)

  • long_description is auto-filled from your README file (looking for README.rst, README.md, then README*, first one found wins). Special tokens can be used (notation aimed at them easily being rst comments):

    • .. [[end long_description]] as end marker, so you don’t have to use the entire file as long description

    • .. [[include <relative-path>]] if you want another file included as well (for example, people like to add HISTORY.txt as well)

    • these tokens must appear either at beginning/end of line, or be after/before at least one space character

  • version can be stated explicitly, or be computed from git tags using versioning=... (see versioning for more info):

    • With versioning="distance", your git tags will be of the form v{major}.{minor}.0, the number of commits since latest version tag will be used to auto-fill the “patch” part of the version:

      • tag “v1.0.0”, no commits since tag -> version is “1.0.0”

      • tag “v1.0.0”, 5 commits since tag -> version is “1.0.5”

      • if checkout is dirty, a marker is added -> version would be “1.0.5+dirty”

    • With versioning="post", your git tags will be of the form v{major}.{minor}.{patch}, a “post” addendum will be present if there are commits since latest version tag:

      • tag “v1.0.0”, no commits since tag -> version is “1.0.0”

      • tag “v1.0.0”, 5 commits since tag -> version is “1.0.0.post5”

      • if checkout is dirty, a marker is added -> version would be “1.0.0.post5+dirty”

    • With versioning="build-id", your git tags will be of the form v{major}.{minor}.0, the number of commits since latest version tag will be used to auto-fill the “patch” part of the version:

      • tag “v1.0.0”, no commits since tag, BUILD_ID=12 -> version is “1.0.0+h12.g123”

      • tag “v1.0.0”, no commits since tag, BUILD_ID not defined -> version is “1.0.0+hlocal.g123”

      • tag “v1.0.0”, 5 commits since tag, BUILD_ID=12 -> version is “1.0.5+h12.g456”

      • tag “v1.0.0”, 5 commits since tag, BUILD_ID not defined -> version is “1.0.5+hlocal.g456”

      • if checkout is dirty, a marker is added -> version would be “1.0.5+hlocal.g456.dirty”

    • Use the version command (see commands) to easily bump (ie: increment major, minor or patch + apply git tag)

    • Version format can be customized, see versioning for more info

  • version, versioning, url, download_url, bugtrack_url, license, keywords, author, contact, maintainer, and platforms will be auto-filled from:

    • Lines of the form __key__ = "value" in your modules (simple constants only, expressions are ignored - the modules are not imported but scanned using regexes)

    • Lines of the form key: value in your docstring

    • Files are examined in this order (first find wins):

      • setup.py

      • <package>.py (mccabe for example)

      • <package>/__about__.py (cryptography for example)

      • <package>/__version__.py (requests for example)

      • <package>/__init__.py (changes, arrow for example)

      • src/ is also examined (for those who like to have their packages under src)

    • URLs can be simplified:

      • if url points to your general github repo (like: https://github.com/codrsquad), the name of your project is auto-appended to it

      • relative urls are auto-filled by prefixing them with url

      • urls may use {name} and/or {version} markers, it will be expanded appropriately

    • author, maintainer and contact names and emails can be combined into one line (setupmeta will figure out the email part and auto-fill it properly)

      • i.e.: author: Bob D bob@example.com will yield the proper author and author_email settings

This should hopefully work nicely for the vast majority of python projects out there. If you need advanced stuff, you can still leverage setupmeta for all the usual stuff above, and go explicit wherever needed.

Release files for setupmeta 3.9.0

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

Source distribution (sdist)

Source distribution for setupmeta 3.9.0
File Size Uploaded
setupmeta-3.9.0.tar.gz 83.7 kB Details

Built distribution (wheel)

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

Total release size: 121.3 kB

Release files / setupmeta-3.9.0.tar.gz

Download URL setupmeta-3.9.0.tar.gz
Size 83.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c1719697ac8407dd84018f5699121cdb4ec70bde28263b665a35e36f108aac29
BLAKE2b-256 checksum
How to use checksums
9b6d32384a27a9c1d3d896335bdae3f0010cc025857d466938b678334c0e0ad6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 17, 2026.

Transparency log

Release files / setupmeta-3.9.0-py3-none-any.whl

Download URL setupmeta-3.9.0-py3-none-any.whl
Size 37.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
464498e35aeab28aa8c27bd0283530fb69696358723a5e7157cdb11255e1abc7
BLAKE2b-256 checksum
How to use checksums
17ed5bc71f908e4fc139f5429502e8683ccd8a78fe1aca7ea3b3c6b31badf89a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

3.9.0 This release

2 release files

3.8.0

2 release files

3.7.2

2 release files

3.6.1

2 release files

3.6.0

2 release files

3.5.2

2 release files

3.5.1

2 release files

3.4.1

2 release files

3.4.0

9 release files

3.3.2

8 release files

3.3.1

8 release files

3.3.0

7 release files

3.2.0

7 release files

3.1.0

7 release files

3.0.0

7 release files

2.8.3

7 release files

2.8.2

7 release files

2.8.1

7 release files

2.8.0

7 release files

2.7.16

7 release files

2.7.15

6 release files

2.7.14

7 release files

2.7.13

7 release files

2.7.12

7 release files

2.7.11

7 release files

2.7.10

7 release files

2.7.9

7 release files

2.7.8

7 release files

2.7.7

7 release files

2.7.6

7 release files

2.7.5

7 release files

2.7.4

7 release files

2.7.3

7 release files

2.7.2

7 release files

2.7.1

7 release files

2.7.0

7 release files

2.6.24

7 release files

2.6.22

7 release files

2.6.21

7 release files

2.6.17

7 release files

2.6.16

7 release files

2.6.15

8 release files

2.6.14

8 release files

2.6.12

8 release files

2.6.11

8 release files

2.6.10

8 release files

2.6.9

8 release files

2.6.8

8 release files

2.6.7

8 release files

2.6.6

8 release files

2.6.5

8 release files

2.6.4

8 release files

2.5.4

6 release files

2.4.3

6 release files

2.3.4

6 release files

2.2.1

6 release files

2.1.3

6 release files

2.0.6

6 release files

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