From e277fc0e221a6ac97f6241416eb5c6d924b4b76f Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sun, 5 Mar 2023 22:10:05 +0100 Subject: [PATCH] Move more setup stuff to pyproject.toml (#542) Co-authored-by: Hugo van Kemenade --- .github/workflows/docs-lint.yml | 2 +- .github/workflows/release.yml | 7 ++-- .github/workflows/test.yml | 2 +- pyproject.toml | 60 ++++++++++++++++++++++++++++++- setup.py | 62 --------------------------------- tox.ini | 3 +- 6 files changed, 66 insertions(+), 70 deletions(-) delete mode 100755 setup.py diff --git a/.github/workflows/docs-lint.yml b/.github/workflows/docs-lint.yml index e3e3cb44..a2070444 100644 --- a/.github/workflows/docs-lint.yml +++ b/.github/workflows/docs-lint.yml @@ -22,7 +22,7 @@ jobs: with: python-version: "3.10" cache: pip - cache-dependency-path: "setup.py" + cache-dependency-path: "pyproject.toml" - name: Install dependencies run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 93a54496..4e855b97 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,17 +24,16 @@ jobs: with: python-version: "3.x" cache: pip - cache-dependency-path: "setup.py" + cache-dependency-path: "pyproject.toml" - name: Install dependencies run: | python -m pip install -U pip - python -m pip install -U setuptools twine wheel + python -m pip install build twine - name: Build package run: | - python setup.py --version - python setup.py sdist --format=gztar bdist_wheel + python -m build twine check dist/* - name: Upload packages to Jazzband diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e18f619d..b305a74d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: with: python-version: ${{ matrix.python-version }} cache: pip - cache-dependency-path: "setup.py" + cache-dependency-path: "pyproject.toml" - name: Install dependencies run: | diff --git a/pyproject.toml b/pyproject.toml index b30531e5..9987231b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,64 @@ [build-system] -requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"] +requires = ["setuptools>=58", "setuptools_scm[toml]>=6.2"] build-backend = "setuptools.build_meta" +[project] +name = "tablib" +description = "Format agnostic tabular data library (XLS, JSON, YAML, CSV, etc.)" +readme = "README.md" +license = {text = "MIT License"} +authors = [ + {name = "Kenneth Reitz", email = "me@kennethreitz.org"} +] +maintainers = [ + {name = "Jazzband Team", email = "roadies@jazzband.co"}, + {name = "Hugo van Kemenade"}, + {name = "Claude Paroz", email = "claude@2xlibre.net"}, +] +requires-python = ">=3.7" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Natural Language :: English", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "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", +] +dynamic = ["version"] + +[project.optional-dependencies] +all = [ + "markuppy", + "odfpy", + "openpyxl>=2.6.0", + "pandas", + "pyyaml", + "tabulate", + "xlrd", + "xlwt", +] +cli = ["tabulate"] +html = ["markuppy"] +ods = ["odfpy"] +pandas = ["pandas"] +xls = ["xlrd", "xlwt"] +xlsx = ["openpyxl>=2.6.0"] +yaml = ["pyyaml"] + +[project.urls] +homepage = "https://tablib.readthedocs.io" +documentation = "https://tablib.readthedocs.io" +repository = "https://github.com/jazzband/tablib" +changelog = "https://github.com/jazzband/tablib/blob/master/HISTORY.md" + +[tool.setuptools_scm] +write_to = "src/tablib/_version.py" + [tool.isort] profile = "black" diff --git a/setup.py b/setup.py deleted file mode 100755 index c959acff..00000000 --- a/setup.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python - -from setuptools import find_packages, setup - -setup( - name='tablib', - use_scm_version={ - 'write_to': 'src/tablib/_version.py', - }, - setup_requires=['setuptools_scm'], - description='Format agnostic tabular data library (XLS, JSON, YAML, CSV)', - long_description=( - open('README.md').read() + '\n\n' + open('HISTORY.md').read() - ), - long_description_content_type="text/markdown", - author='Kenneth Reitz', - author_email='me@kennethreitz.org', - maintainer='Jazzband', - maintainer_email='roadies@jazzband.co', - url='https://tablib.readthedocs.io', - project_urls={ - "Documentation": "https://tablib.readthedocs.io", - "Source": "https://github.com/jazzband/tablib", - }, - packages=find_packages(where="src"), - package_dir={"": "src"}, - license='MIT', - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'Natural Language :: English', - 'License :: OSI Approved :: MIT License', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3', - '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', - ], - python_requires='>=3.7', - extras_require={ - 'all': [ - 'markuppy', - 'odfpy', - 'openpyxl>=2.6.0', - 'pandas', - 'pyyaml', - 'tabulate', - 'xlrd', - 'xlwt', - ], - 'cli': ['tabulate'], - 'html': ['markuppy'], - 'ods': ['odfpy'], - 'pandas': ['pandas'], - 'xls': ['xlrd', 'xlwt'], - 'xlsx': ['openpyxl>=2.6.0'], - 'yaml': ['pyyaml'], - }, -) diff --git a/tox.ini b/tox.ini index d7ae5ebf..d1097a8f 100644 --- a/tox.ini +++ b/tox.ini @@ -24,9 +24,10 @@ commands = [testenv:lint] deps = pre-commit + build twine commands = pre-commit run --all-files - python setup.py sdist + python -m build twine check dist/* skip_install = true