From dec0b1ba19c5435bfc5e21b604aea98b0f9b6b39 Mon Sep 17 00:00:00 2001 From: Nico Tonnhofer Date: Wed, 1 Feb 2023 23:44:03 +0100 Subject: [PATCH] chore: use pep621 with hatchling https://peps.python.org/pep-0621/ --- .coveragerc | 8 ------ MANIFEST.in | 4 --- pyproject.toml | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 11 -------- setup.py | 55 ---------------------------------------- tox.ini | 1 + 6 files changed, 69 insertions(+), 78 deletions(-) delete mode 100644 .coveragerc delete mode 100644 MANIFEST.in create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 2b836a7..0000000 --- a/.coveragerc +++ /dev/null @@ -1,8 +0,0 @@ -[run] -branch = True -source = token_bucket - -parallel = True - -[report] -show_missing = True diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 31841ca..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,4 +0,0 @@ -include tests/* -include tools/* -include requirements/test -include tox.ini diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..18a5dd7 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,68 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "token-bucket" +dynamic = ["version"] +description = "Very fast implementation of the token bucket algorithm." +readme = "README.rst" +license = "Apache-2.0" +requires-python = ">=3.7" +authors = [{ name = "kgriffs", email = "mail@kgriffs.com" }] +keywords = [ + "bucket", + "cloud", + "http", + "https", + "limiting", + "rate", + "throttling", + "token", + "web", +] +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Web Environment", + "Natural Language :: English", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: Apache Software License", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Software Development :: Libraries", + "Programming Language :: Python", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "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.12", +] +dependencies = [] + +[project.urls] +Homepage = "https://github.com/falconry/token-bucket" + +[tool.hatch.version] +path = "token_bucket/version.py" + +[tool.hatch.build] +packages = ["token_bucket"] + +[tool.coverage.run] +branch = true +source = ["token_bucket"] +parallel = true + +[tool.coverage.report] +show_missing = true +exclude_lines = [ + "pragma: no cover", + "if __name__ == .__main__.:", + "@(abc\\.)?abstractmethod", +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 4629a02..0000000 --- a/setup.cfg +++ /dev/null @@ -1,11 +0,0 @@ -[egg_info] -tag_build = dev1 - -[wheel] -universal = 1 - -[aliases] -test = pytest - -[tool:pytest] -addopts = tests diff --git a/setup.py b/setup.py deleted file mode 100644 index 58ceb57..0000000 --- a/setup.py +++ /dev/null @@ -1,55 +0,0 @@ -import importlib.machinery -import importlib.util -import io -from os import path - -from setuptools import find_packages, setup - -loader = importlib.machinery.SourceFileLoader( - 'version', path.join('.', 'token_bucket', 'version.py') -) -spec = importlib.util.spec_from_loader(loader.name, loader) -module = importlib.util.module_from_spec(spec) - -loader.exec_module(module) - -VERSION = module.__version__ - -setup( - name='token_bucket', - version=VERSION, - description='Very fast implementation of the token bucket algorithm.', - long_description=io.open('README.rst', 'r', encoding='utf-8').read(), - classifiers=[ - 'Development Status :: 4 - Beta', - 'Environment :: Web Environment', - 'Natural Language :: English', - 'Intended Audience :: Developers', - 'Intended Audience :: System Administrators', - 'License :: OSI Approved :: Apache Software License', - 'Operating System :: MacOS :: MacOS X', - 'Operating System :: Microsoft :: Windows', - 'Operating System :: POSIX', - 'Topic :: Internet :: WWW/HTTP', - 'Topic :: Software Development :: Libraries', - 'Programming Language :: Python', - 'Programming Language :: Python :: Implementation :: CPython', - 'Programming Language :: Python :: Implementation :: PyPy', - '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.12', - ], - keywords='web http https cloud rate limiting token bucket throttling', - author='kgriffs', - author_email='mail@kgriffs.com', - url='https://github.com/falconry/token-bucket', - license='Apache 2.0', - packages=find_packages(exclude=['tests']), - python_requires='>=3.7', - install_requires=[], - setup_requires=['pytest-runner'], - tests_require=['pytest'], -) diff --git a/tox.ini b/tox.ini index e30b20c..c146efd 100644 --- a/tox.ini +++ b/tox.ini @@ -6,6 +6,7 @@ envlist = blue, [testenv] deps = -r{toxinidir}/requirements/tests +package = editable commands = coverage run -m pytest {posargs:tests} [testenv:nocover]