From ea6565672a5634270b149129f1b4206b899160d4 Mon Sep 17 00:00:00 2001 From: Elvis Pranskevichus Date: Mon, 14 Aug 2023 15:49:50 -0700 Subject: [PATCH] Move metadata to `pyproject.toml`, fix test fixture inclusion in sdist (#111) Fixes: #109 --- MANIFEST.in | 2 +- pyproject.toml | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 46 --------------------------------------- 3 files changed, 59 insertions(+), 47 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index d3f372ba..11526d29 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -recursive-include tests *.py +recursive-include tests *.py test-data/* recursive-include immutables *.py *.c *.h *.pyi include LICENSE* NOTICE README.rst bench.png include immutables/py.typed diff --git a/pyproject.toml b/pyproject.toml index 8b15a13e..a2f803b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,65 @@ +[project] +name = "immutables" +description = "Immutable Collections" +authors = [{name = "MagicStack Inc", email = "hello@magic.io"}] +readme = "README.rst" +license = {text = "Apache License, Version 2.0"} +dynamic = ["version"] +keywords = [ + "collections", + "immutable", + "hamt", +] +classifiers=[ + "License :: OSI Approved :: Apache Software License", + "Intended Audience :: Developers", + "Programming Language :: Python :: 3 :: Only", + "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", + "Programming Language :: Python :: Implementation :: CPython", + "Operating System :: POSIX", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Topic :: Software Development :: Libraries", +] +dependencies = [ + 'typing-extensions>=3.7.4.3;python_version<"3.8"', +] + +[project.urls] +github = "https://github.com/MagicStack/immutables" + +[project.optional-dependencies] +# Minimal dependencies required to test immutables. +# pycodestyle is a dependency of flake8, but it must be frozen because +# their combination breaks too often +# (example breakage: https://gitlab.com/pycqa/flake8/issues/427) +test = [ + 'flake8~=5.0', + 'pycodestyle~=2.9', + 'mypy~=1.4', + 'pytest~=7.4', +] + [build-system] requires = ["setuptools>=42", "wheel"] build-backend = "setuptools.build_meta" +[tool.setuptools] +zip-safe = false + +[tool.setuptools.packages.find] +include = ["immutables", "immutables.*"] + +[tool.setuptools.package-data] +immutables = ["py.typed", "*.pyi"] + +[tool.setuptools.exclude-package-data] +"*" = ["*.c", "*.h"] + [tool.pytest.ini_options] minversion = "6.0" addopts = "--capture=no --assert=plain --strict-markers --tb=native --import-mode=importlib" diff --git a/setup.py b/setup.py index 3a13d5d5..8cfc9c97 100644 --- a/setup.py +++ b/setup.py @@ -3,21 +3,6 @@ import setuptools -# Minimal dependencies required to test immutables. -TEST_DEPENDENCIES = [ - # pycodestyle is a dependency of flake8, but it must be frozen because - # their combination breaks too often - # (example breakage: https://gitlab.com/pycqa/flake8/issues/427) - 'flake8~=5.0', - 'pycodestyle~=2.9', - 'mypy~=1.4', - 'pytest~=7.4', -] - -EXTRA_DEPENDENCIES = { - 'test': TEST_DEPENDENCIES, -} - system = platform.uname().system CFLAGS = ['-O2'] @@ -62,38 +47,7 @@ ext_modules = [] -with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as f: - readme = f.read() - - setuptools.setup( - name='immutables', version=VERSION, - description='Immutable Collections', - long_description=readme, - python_requires='>=3.7', - classifiers=[ - 'License :: OSI Approved :: Apache Software License', - 'Intended Audience :: Developers', - 'Programming Language :: Python :: 3 :: Only', - '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', - 'Operating System :: POSIX', - 'Operating System :: MacOS :: MacOS X', - 'Operating System :: Microsoft :: Windows', - ], - author='MagicStack Inc', - author_email='hello@magic.io', - url='https://github.com/MagicStack/immutables', - license='Apache License, Version 2.0', - packages=['immutables'], - package_data={"immutables": ["py.typed", "*.pyi"]}, - provides=['immutables'], - include_package_data=True, ext_modules=ext_modules, - install_requires=['typing-extensions>=3.7.4.3;python_version<"3.8"'], - extras_require=EXTRA_DEPENDENCIES, )