From f966d08ce46e3ed6e40aa1bc53a1c95dba0dad72 Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Fri, 20 May 2022 13:22:03 +0300 Subject: [PATCH 1/3] Move the metadata into `setup.cfg`. Add `pyproject.toml`. Fetch version from git tags using `setuptools_scm`. --- .gitignore | 2 + HOWTOPUBLISH | 5 +-- pyproject.toml | 6 +++ setup.cfg | 33 ++++++++++++++ setup.py | 68 ----------------------------- tabulate.py => tabulate/__init__.py | 2 +- 6 files changed, 44 insertions(+), 72 deletions(-) create mode 100644 pyproject.toml create mode 100644 setup.cfg delete mode 100644 setup.py rename tabulate.py => tabulate/__init__.py (99%) diff --git a/.gitignore b/.gitignore index 460933e..0495ac7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +/tabulate/version.py + build dist .tox diff --git a/HOWTOPUBLISH b/HOWTOPUBLISH index 6730e8a..6be79c0 100644 --- a/HOWTOPUBLISH +++ b/HOWTOPUBLISH @@ -1,8 +1,7 @@ # update contributors and CHANGELOG in README +# tag version release python3 benchmark.py # then update README tox -e py33,py34,py36-extra -python3 setup.py sdist bdist_wheel +python3 -m build -nswx . twine upload --repository-url https://test.pypi.org/legacy/ dist/* twine upload dist/* -# tag version release -# bump version number in setup.py in tabulate.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..66f9550 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,6 @@ +[build-system] +requires = ["setuptools>=42.2", "wheel", "setuptools_scm[toml]>=3.4.3"] +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] +write_to = "tabulate/version.py" diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..4c5b66b --- /dev/null +++ b/setup.cfg @@ -0,0 +1,33 @@ +[metadata] +name = tabulate +author = Sergey Astanin +author_email = s.astanin@gmail.com +license = MIT +description = Pretty-print tabular data +url = https://github.com/astanin/python-tabulate +long_description = file: README.md +long_description_content_type = text/markdown +classifiers = + Development Status :: 4 - Beta + License :: OSI Approved :: MIT License + Operating System :: OS Independent + 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 :: 3.9 + Programming Language :: Python :: 3.10 + Topic :: Software Development :: Libraries + +[options] +packages = tabulate +python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* + +[options.entry_points] +console_scripts = tabulate = tabulate:_main + +[options.extras_require] +widechars = wcwidth diff --git a/setup.py b/setup.py deleted file mode 100644 index 00be096..0000000 --- a/setup.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env python - -try: - from setuptools import setup -except ImportError: - from distutils.core import setup - - -from platform import python_version_tuple, python_implementation -import os -import re - -# strip links from the descripton on the PyPI -if python_version_tuple()[0] >= "3": - LONG_DESCRIPTION = open("README.md", "r", encoding="utf-8").read() -else: - LONG_DESCRIPTION = open("README.md", "r").read() - -# strip Build Status from the PyPI package -try: - if python_version_tuple()[:2] >= ("2", "7"): - status_re = "^Build status\n(.*\n){7}" - LONG_DESCRIPTION = re.sub(status_re, "", LONG_DESCRIPTION, flags=re.M) -except TypeError: - if python_implementation() == "IronPython": - # IronPython doesn't support flags in re.sub (IronPython issue #923) - pass - else: - raise - -install_options = os.environ.get("TABULATE_INSTALL", "").split(",") -libonly_flags = set(["lib-only", "libonly", "no-cli", "without-cli"]) -if libonly_flags.intersection(install_options): - console_scripts = [] -else: - console_scripts = ["tabulate = tabulate:_main"] - - -setup( - name="tabulate", - version="0.8.10", - description="Pretty-print tabular data", - long_description=LONG_DESCRIPTION, - long_description_content_type="text/markdown", - author="Sergey Astanin", - author_email="s.astanin@gmail.com", - url="https://github.com/astanin/python-tabulate", - license="MIT", - python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", - classifiers=[ - "Development Status :: 4 - Beta", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "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 :: 3.9", - "Programming Language :: Python :: 3.10", - "Topic :: Software Development :: Libraries", - ], - py_modules=["tabulate"], - entry_points={"console_scripts": console_scripts}, - extras_require={"widechars": ["wcwidth"]}, -) diff --git a/tabulate.py b/tabulate/__init__.py similarity index 99% rename from tabulate.py rename to tabulate/__init__.py index 0579fb3..9b5363d 100644 --- a/tabulate.py +++ b/tabulate/__init__.py @@ -63,7 +63,7 @@ def _is_file(f): __all__ = ["tabulate", "tabulate_formats", "simple_separated_format"] -__version__ = "0.8.10" +from .version import version as __version__ # minimum extra space in headers From f809d36e0db2a8d8948f4e26638c926132f53557 Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Fri, 20 May 2022 14:23:26 +0300 Subject: [PATCH 2/3] Migrated the metadata into `PEP 621`-compliant `pyproject.toml`. --- pyproject.toml | 38 +++++++++++++++++++++++++++++++++++++- setup.cfg | 33 --------------------------------- 2 files changed, 37 insertions(+), 34 deletions(-) delete mode 100644 setup.cfg diff --git a/pyproject.toml b/pyproject.toml index 66f9550..cebd23c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,42 @@ [build-system] -requires = ["setuptools>=42.2", "wheel", "setuptools_scm[toml]>=3.4.3"] +requires = ["setuptools>=61.2.0", "wheel", "setuptools_scm[toml]>=3.4.3"] build-backend = "setuptools.build_meta" +[project] +name = "tabulate" +authors = [{name = "Sergey Astanin", email = "s.astanin@gmail.com"}] +license = {text = "MIT"} +description = "Pretty-print tabular data" +readme = "README.md" +classifiers = [ + "Development Status :: 4 - Beta", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "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 :: 3.9", + "Programming Language :: Python :: 3.10", + "Topic :: Software Development :: Libraries", +] +requires-python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +dynamic = ["version"] + +[project.urls] +Homepage = "https://github.com/astanin/python-tabulate" + +[project.optional-dependencies] +widechars = ["wcwidth"] + +[project.scripts] +tabulate = "tabulate:_main" + +[tool.setuptools] +packages = ["tabulate"] + [tool.setuptools_scm] write_to = "tabulate/version.py" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 4c5b66b..0000000 --- a/setup.cfg +++ /dev/null @@ -1,33 +0,0 @@ -[metadata] -name = tabulate -author = Sergey Astanin -author_email = s.astanin@gmail.com -license = MIT -description = Pretty-print tabular data -url = https://github.com/astanin/python-tabulate -long_description = file: README.md -long_description_content_type = text/markdown -classifiers = - Development Status :: 4 - Beta - License :: OSI Approved :: MIT License - Operating System :: OS Independent - 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 :: 3.9 - Programming Language :: Python :: 3.10 - Topic :: Software Development :: Libraries - -[options] -packages = tabulate -python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* - -[options.entry_points] -console_scripts = tabulate = tabulate:_main - -[options.extras_require] -widechars = wcwidth From 9d32480b13d39546b51f2fc5f848a644abb62f2d Mon Sep 17 00:00:00 2001 From: KOLANICH Date: Fri, 20 May 2022 14:21:17 +0300 Subject: [PATCH 3/3] Enabled building and storing artifacts on CircleCI --- .circleci/config.yml | 10 ++++++++++ .circleci/requirements.txt | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index bc19353..546bb26 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -39,6 +39,16 @@ jobs: - ./venv key: v1-dependencies-{{ checksum ".circleci/requirements.txt" }} + - run: + name: build wheel + command: | + . venv/bin/activate + python -m build -nwx . + + - store_artifacts: + path: dist + destination: dist + - run: name: run tests command: | diff --git a/.circleci/requirements.txt b/.circleci/requirements.txt index 650d583..ea5e80c 100644 --- a/.circleci/requirements.txt +++ b/.circleci/requirements.txt @@ -3,3 +3,8 @@ tox numpy pandas wcwidth +setuptools +pip +build +wheel +setuptools_scm