Skip to main content

Build Status Azure DevOps coverage

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.

Release files for setup-py-upgrade 1.1.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 setup-py-upgrade 1.1.0
File Size Uploaded
setup_py_upgrade-1.1.0.tar.gz 5.6 kB Details

Built distribution (wheel)

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

Total release size: 11.7 kB

Release files / setup_py_upgrade-1.1.0.tar.gz

Download URL setup_py_upgrade-1.1.0.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b6e7f4dbbb6d3f48a69ba32b4aa366a465b4a2550101a68fe01ca5d45bcbac57
BLAKE2b-256 checksum
How to use checksums
e126f05e8826de285d214de401e4a2184438be2e8a420ae16d9bb5f59bd9094d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.6.8

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

Download URL setup_py_upgrade-1.1.0-py2.py3-none-any.whl
Size 6.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
5279cf2742e24291214fc6babe77dac4665dc6526634a4368fa227c658cfe9be
BLAKE2b-256 checksum
How to use checksums
a51128485638f10e65d6f0a2ce1a0e496d3d986ab148561be4ae9030f8c6eea9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.6.8

Release history Release notifications | RSS feed

1.3.1

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

This release

1.1.0 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

0.0.0

2 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