Skip to main content

build status pre-commit.ci status

setup-py-upgrade

upgrade a setup.py to declarative metadata

installation

pip install setup-py-upgrade

cli

Consult the help for the latest usage:

$ setup-py-upgrade --help
usage: setup-py-upgrade [-h] directory

positional arguments:
  directory

optional arguments:
  -h, --help  show this help message and exit

pass the root directory of the repository you'd like to convert

the script overwrites setup.py and setup.cfg when run

sample output

$ setup-py-upgrade ../pre-commit
../pre-commit/setup.py and ../pre-commit/setup.cfg written!
$ tail -n999 ../pre-commit/setup.{py,cfg}
==> ../pre-commit/setup.py <==
from setuptools import setup
setup()

==> ../pre-commit/setup.cfg <==
[metadata]
name = pre_commit
description = A framework for managing and maintaining multi-language pre-commit hooks.
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/pre-commit/pre-commit
version = 1.14.2
author = Anthony Sottile
author_email = asottile@umich.edu
classifiers =
    License :: OSI Approved :: MIT License
    Programming Language :: Python :: 2
    Programming Language :: Python :: 2.7
    Programming Language :: Python :: 3
    Programming Language :: Python :: 3.6
    Programming Language :: Python :: 3.7
    Programming Language :: Python :: Implementation :: CPython
    Programming Language :: Python :: Implementation :: PyPy

[options]
packages = find:
install_requires =
    aspy.yaml
    cfgv>=1.4.0
    identify>=1.0.0
    importlib-metadata
    nodeenv>=0.11.1
    pyyaml
    six
    toml
    virtualenv
    futures; python_version<"3.2"
    importlib-resources; python_version<"3.7"

[options.packages.find]
exclude =
    tests*
    testing*

[options.entry_points]
console_scripts =
    pre-commit = pre_commit.main:main
    pre-commit-validate-config = pre_commit.clientlib:validate_config_main
    pre-commit-validate-manifest = pre_commit.clientlib:validate_manifest_main

[options.package_data]
pre_commit.resources =
    *.tar.gz
    empty_template_*
    hook-tmpl

[bdist_wheel]
universal = True

what versions of setuptools / pip does the output work with?

  • pip>=1.5 (when installing from a wheel)
    • released 2014-01-02
  • setuptools>=30.3 (when building from source)
    • released 2016-12-08
  • virtualenv>=15.2 (to get a sufficient setuptools via --no-download)
    • released 2018-03-21

what is not supported

declarative metadata does not support ext_modules or setuptools plugins -- those must stay in setup.py. If you're converting a project which uses one of those, you'll see a message like:

$ setup-py-upgrade ../future-breakpoint/
ext_modules= is not supported in setup.cfg

To convert those, temporarily remove the offending constructs from setup.py, then run setup-py-upgrade, then paste them back into the file.

related projects

Metadata

Release files for setup-py-upgrade 1.3.1

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

Source distribution (sdist)

Source distribution for setup-py-upgrade 1.3.1
File Size Uploaded Provenance Actions
setup_py_upgrade-1.3.1.tar.gz 5.6 kB Without provenance Details for setup_py_upgrade-1.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for setup-py-upgrade 1.3.1
File Interpreter ABI Platform Actions
setup_py_upgrade-1.3.1-py2.py3-none-any.whl Python 2, Python 3 none any Details for setup_py_upgrade-1.3.1-py2.py3-none-any.whl

Total release size: 11.7 kB

Release files / setup_py_upgrade-1.3.1.tar.gz

Download URL setup_py_upgrade-1.3.1.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
21664ff65d332ea94afcee3cedd2f37bedf9dd7a1cd63a015a7a55b543912df6
BLAKE2b-256 checksum
How to use checksums
3f14664b725777ab561f831f11ebd52bb79dda1dcaacffef8bdd11d1ac540923
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / setup_py_upgrade-1.3.1-py2.py3-none-any.whl

Download URL setup_py_upgrade-1.3.1-py2.py3-none-any.whl
Size 6.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
94b69848f3b3e916a5e014d769dfd2dcfb5c3fd7e565e021e301a20ab051c4e3
BLAKE2b-256 checksum
How to use checksums
a46dda8e97c4739f9b77a27113e4f5df16f408a990efff7f4198d5b2be9605d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Security for setup-py-upgrade 1.3.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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