Skip to main content

upgrade a setup.py to declarative metadata

Project description

Build 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

setup_py_upgrade-1.0.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

setup_py_upgrade-1.0.0-py2.py3-none-any.whl (5.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file setup_py_upgrade-1.0.0.tar.gz.

File metadata

  • Download URL: setup_py_upgrade-1.0.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for setup_py_upgrade-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4947f55273d5af5454d6c4a6c587e448d40e1eb5d67179f6e54c27f5b80599cf
MD5 69632b1dadb74685a9d749d28d30db3b
BLAKE2b-256 ecad48f637a06363e96ddbd851ff2665a0cacfaa4df08f6fba085a882dd0b161

See more details on using hashes here.

File details

Details for the file setup_py_upgrade-1.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: setup_py_upgrade-1.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for setup_py_upgrade-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 81fc75ad817409bd454610131ab26711fc7d702065cb23444596c01f0f41a590
MD5 bf2181e699e310361a8149d900d3565c
BLAKE2b-256 bd496b71bc33b5d428f0490bf2f5c55c868a0dfc4c3d6c5c9fe99baabe1140f0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page