From db3cb746714e03040d1e164541eb7ffdffac5d11 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Fri, 8 May 2020 17:53:33 -0700 Subject: [PATCH] Switch to setuptools declarative syntax through setup.cfg Avoids mixing code and configuration. This approach can allow for some automation and also reduces boilerplate in setup.py. Available since setuptools 30.3.0 (Dec 8, 2016). https://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files --- setup.cfg | 51 ++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 61 ++----------------------------------------------------- 2 files changed, 53 insertions(+), 59 deletions(-) diff --git a/setup.cfg b/setup.cfg index 8f0d6a43f..07017ac13 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,54 @@ +[metadata] +name = pip-tools +url = https://github.com/jazzband/pip-tools/ +license = BSD +author = Vincent Driessen +author_email = me@nvie.com +description = pip-tools keeps your pinned dependencies fresh. +long_description = file: README.rst +classifiers = + Development Status :: 5 - Production/Stable + Intended Audience :: Developers + Intended Audience :: System Administrators + License :: OSI Approved :: BSD License + Operating System :: OS Independent + Programming Language :: Python + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: Implementation :: CPython + Programming Language :: Python :: Implementation :: PyPy + Topic :: System :: Systems Administration + +[options] +python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* +setup_requires = setuptools_scm +packages = find: +zip_safe = false +install_requires = + click >= 7 + six + pip >= 20.0 + +[options.packages.find] +exclude = tests + +[options.extras_require] +testing = + mock + pytest + pytest-rerunfailures +coverage = pytest-cov + +[options.entry_points] +console_scripts = + pip-compile = piptools.scripts.compile:cli + pip-sync = piptools.scripts.sync:cli + [bdist_wheel] universal = 1 diff --git a/setup.py b/setup.py index 6700c84f9..d5d43d7c9 100644 --- a/setup.py +++ b/setup.py @@ -1,60 +1,3 @@ -""" -pip-tools keeps your pinned dependencies fresh. -""" -from os.path import abspath, dirname, join +from setuptools import setup -from setuptools import find_packages, setup - - -def read_file(filename): - """Read the contents of a file located relative to setup.py""" - with open(join(abspath(dirname(__file__)), filename)) as thefile: - return thefile.read() - - -setup( - name="pip-tools", - use_scm_version=True, - url="https://github.com/jazzband/pip-tools/", - license="BSD", - author="Vincent Driessen", - author_email="me@nvie.com", - description=__doc__.strip(), - long_description=read_file("README.rst"), - long_description_content_type="text/x-rst", - packages=find_packages(exclude=["tests"]), - package_data={}, - python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", - setup_requires=["setuptools_scm"], - install_requires=["click>=7", "six", "pip>=20.0"], - extras_require={ - "testing": ["mock", "pytest", "pytest-rerunfailures"], - "coverage": ["pytest-cov"], - }, - zip_safe=False, - entry_points={ - "console_scripts": [ - "pip-compile = piptools.scripts.compile:cli", - "pip-sync = piptools.scripts.sync:cli", - ] - }, - platforms="any", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "Intended Audience :: System Administrators", - "License :: OSI Approved :: BSD License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", - "Topic :: System :: Systems Administration", - ], -) +setup(use_scm_version=True)