From 760e864200ed8c21055f65ca609cf47012a102af Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Mon, 4 Sep 2023 15:19:54 +0200 Subject: [PATCH 1/3] migrate to setup.cfg --- setup.cfg | 65 +++++++++++++++++++++++++++++ setup.py | 122 +----------------------------------------------------- 2 files changed, 67 insertions(+), 120 deletions(-) diff --git a/setup.cfg b/setup.cfg index c8b3a81b2..3cd2d7069 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,3 +5,68 @@ addopts = --assert=plain --cov=gunicorn --cov-report=xml [metadata] license_files = ['LICENSE'] +name = gunicorn +version = attr: gunicorn.__version__ +author = Benoit Chesneau +author_email = benoitc@gunicorn.org +license = MIT +description = WSGI HTTP Server for UNIX +url = https://gunicorn.org +long_description = file: README.rst +classifiers = + Development Status :: 5 - Production/Stable + Environment :: Other Environment + Intended Audience :: Developers + License :: OSI Approved :: MIT License + Operating System :: MacOS :: MacOS X + Operating System :: POSIX + Programming Language :: Python + 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 :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: Implementation :: CPython + Programming Language :: Python :: Implementation :: PyPy + Topic :: Internet + Topic :: Utilities + Topic :: Software Development :: Libraries :: Python Modules + Topic :: Internet :: WWW/HTTP + Topic :: Internet :: WWW/HTTP :: WSGI + Topic :: Internet :: WWW/HTTP :: WSGI :: Server + Topic :: Internet :: WWW/HTTP :: Dynamic Content +project_urls = + Documentation = https://docs.gunicorn.org + Homepage = https://gunicorn.org + Issue tracker = https://github.com/benoitc/gunicorn/issues + Source code = https://github.com/benoitc/gunicorn + +[options] +packages = find: +zip_safe = False +install_requires = + importlib_metadata; python_version<"3.8" + packaging +include_package_data = True +python_requires = >=3.5 +tests_require = + gevent + eventlet + cryptography + coverage + pytest + pytest-cov + +[options.packages.find] +exclude = examples; tests + +[options.extras_require] +gevent = gevent>=1.4.0 +eventlet = eventlet>=0.24.1 +tornado = tornado>=0.2 +gthread = +setproctitle = setproctitle diff --git a/setup.py b/setup.py index dffd418cf..606849326 100644 --- a/setup.py +++ b/setup.py @@ -1,121 +1,3 @@ -# -*- coding: utf-8 - -# -# This file is part of gunicorn released under the MIT license. -# See the NOTICE for more information. +from setuptools import setup -import os -import sys - -from setuptools import setup, find_packages -from setuptools.command.test import test as TestCommand - -from gunicorn import __version__ - - -CLASSIFIERS = [ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Other Environment', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Operating System :: MacOS :: MacOS X', - 'Operating System :: POSIX', - 'Programming Language :: Python', - '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 :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: Implementation :: CPython', - 'Programming Language :: Python :: Implementation :: PyPy', - 'Topic :: Internet', - 'Topic :: Utilities', - 'Topic :: Software Development :: Libraries :: Python Modules', - 'Topic :: Internet :: WWW/HTTP', - 'Topic :: Internet :: WWW/HTTP :: WSGI', - 'Topic :: Internet :: WWW/HTTP :: WSGI :: Server', - 'Topic :: Internet :: WWW/HTTP :: Dynamic Content'] - -# read long description -with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as f: - long_description = f.read() - -# read dev requirements -fname = os.path.join(os.path.dirname(__file__), 'requirements_test.txt') -with open(fname) as f: - tests_require = [l.strip() for l in f.readlines()] - -class PyTestCommand(TestCommand): - user_options = [ - ("cov", None, "measure coverage") - ] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.cov = None - - def finalize_options(self): - TestCommand.finalize_options(self) - self.test_args = ['tests'] - if self.cov: - self.test_args += ['--cov', 'gunicorn'] - self.test_suite = True - - def run_tests(self): - import pytest - errno = pytest.main(self.test_args) - sys.exit(errno) - - -install_requires = [ - 'importlib_metadata; python_version<"3.8"', - 'packaging', -] - -extras_require = { - 'gevent': ['gevent>=1.4.0'], - 'eventlet': ['eventlet>=0.24.1'], - 'tornado': ['tornado>=0.2'], - 'gthread': [], - 'setproctitle': ['setproctitle'], -} - -setup( - name='gunicorn', - version=__version__, - - description='WSGI HTTP Server for UNIX', - long_description=long_description, - author='Benoit Chesneau', - author_email='benoitc@gunicorn.org', - license='MIT', - url='https://gunicorn.org', - project_urls={ - 'Documentation': 'https://docs.gunicorn.org', - 'Homepage': 'https://gunicorn.org', - 'Issue tracker': 'https://github.com/benoitc/gunicorn/issues', - 'Source code': 'https://github.com/benoitc/gunicorn', - }, - - python_requires='>=3.5', - install_requires=install_requires, - classifiers=CLASSIFIERS, - zip_safe=False, - packages=find_packages(exclude=['examples', 'tests']), - include_package_data=True, - - tests_require=tests_require, - cmdclass={'test': PyTestCommand}, - - entry_points=""" - [console_scripts] - gunicorn=gunicorn.app.wsgiapp:run - - [paste.server_runner] - main=gunicorn.app.pasterapp:serve - """, - extras_require=extras_require, -) +setup() From 7033f27e286ddcbb40c3ae548710516d3cba0cc2 Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Mon, 4 Sep 2023 15:22:37 +0200 Subject: [PATCH 2/3] remove exclusion of tests and examples dir setuptools already exclude them by default in the flat-layout setup, see https://setuptools.pypa.io/en/latest/userguide/package_discovery.html\#flat-layout --- setup.cfg | 3 --- 1 file changed, 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 3cd2d7069..e8a320074 100644 --- a/setup.cfg +++ b/setup.cfg @@ -61,9 +61,6 @@ tests_require = pytest pytest-cov -[options.packages.find] -exclude = examples; tests - [options.extras_require] gevent = gevent>=1.4.0 eventlet = eventlet>=0.24.1 From fdd23e82926d7d10ec4a8e65e42b5184a4ee20ce Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Tue, 12 Sep 2023 00:43:37 +0200 Subject: [PATCH 3/3] migrate to pyproject.toml --- pyproject.toml | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 65 ---------------------------------------- setup.py | 3 -- 3 files changed, 80 insertions(+), 68 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..ec64a3285 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,80 @@ +[build-system] +requires = ["setuptools>=61.2"] +build-backend = "setuptools.build_meta" + +[project] +name = "gunicorn" +authors = [{name = "Benoit Chesneau", email = "benoitc@gunicorn.org"}] +license = {text = "MIT"} +description = "WSGI HTTP Server for UNIX" +readme = "README.rst" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Other Environment", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: MacOS :: MacOS X", + "Operating System :: POSIX", + "Programming Language :: Python", + "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 :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Internet", + "Topic :: Utilities", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Internet :: WWW/HTTP :: WSGI", + "Topic :: Internet :: WWW/HTTP :: WSGI :: Server", + "Topic :: Internet :: WWW/HTTP :: Dynamic Content", +] +requires-python = ">=3.5" +dependencies = [ + 'importlib_metadata; python_version<"3.8"', + "packaging", +] +dynamic = ["version"] + +[project.urls] +Homepage = "https://gunicorn.org" +Documentation = "https://docs.gunicorn.org" +"Issue tracker" = "https://github.com/benoitc/gunicorn/issues" +"Source code" = "https://github.com/benoitc/gunicorn" + +[project.optional-dependencies] +gevent = ["gevent>=1.4.0"] +eventlet = ["eventlet>=0.24.1"] +tornado = ["tornado>=0.2"] +gthread = [] +setproctitle = ["setproctitle"] +testing = [ + "gevent", + "eventlet", + "cryptography", + "coverage", + "pytest", + "pytest-cov", +] + +[tool.pytest.ini_options] +norecursedirs = ["examples", "lib", "local", "src"] +testpaths = ["tests/"] +addopts = "--assert=plain --cov=gunicorn --cov-report=xml" + +[tool.setuptools] +zip-safe = false +include-package-data = true +license-files = ["['LICENSE']"] + +[tool.setuptools.packages] +find = {namespaces = false} + +[tool.setuptools.dynamic] +version = {attr = "gunicorn.__version__"} diff --git a/setup.cfg b/setup.cfg index e8a320074..07322e337 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,68 +2,3 @@ norecursedirs = examples lib local src testpaths = tests/ addopts = --assert=plain --cov=gunicorn --cov-report=xml - -[metadata] -license_files = ['LICENSE'] -name = gunicorn -version = attr: gunicorn.__version__ -author = Benoit Chesneau -author_email = benoitc@gunicorn.org -license = MIT -description = WSGI HTTP Server for UNIX -url = https://gunicorn.org -long_description = file: README.rst -classifiers = - Development Status :: 5 - Production/Stable - Environment :: Other Environment - Intended Audience :: Developers - License :: OSI Approved :: MIT License - Operating System :: MacOS :: MacOS X - Operating System :: POSIX - Programming Language :: Python - 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 :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: Implementation :: CPython - Programming Language :: Python :: Implementation :: PyPy - Topic :: Internet - Topic :: Utilities - Topic :: Software Development :: Libraries :: Python Modules - Topic :: Internet :: WWW/HTTP - Topic :: Internet :: WWW/HTTP :: WSGI - Topic :: Internet :: WWW/HTTP :: WSGI :: Server - Topic :: Internet :: WWW/HTTP :: Dynamic Content -project_urls = - Documentation = https://docs.gunicorn.org - Homepage = https://gunicorn.org - Issue tracker = https://github.com/benoitc/gunicorn/issues - Source code = https://github.com/benoitc/gunicorn - -[options] -packages = find: -zip_safe = False -install_requires = - importlib_metadata; python_version<"3.8" - packaging -include_package_data = True -python_requires = >=3.5 -tests_require = - gevent - eventlet - cryptography - coverage - pytest - pytest-cov - -[options.extras_require] -gevent = gevent>=1.4.0 -eventlet = eventlet>=0.24.1 -tornado = tornado>=0.2 -gthread = -setproctitle = setproctitle diff --git a/setup.py b/setup.py deleted file mode 100644 index 606849326..000000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup()