From 99c4e883049c5a797e63df396d3530b77700a1d5 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Tue, 16 Apr 2024 09:32:10 +0200 Subject: Modernize packaging with pyproject.toml and setuptool_scm. --- .builds/archlinux.yml | 1 + .gitignore | 2 ++ CHANGELOG.rst | 1 + check | 8 ++++---- pyproject.toml | 39 +++++++++++++++++++++++++++++++++++++++ setup.py | 45 +-------------------------------------------- 6 files changed, 48 insertions(+), 48 deletions(-) create mode 100644 pyproject.toml diff --git a/.builds/archlinux.yml b/.builds/archlinux.yml index e7099c3..c3ac481 100644 --- a/.builds/archlinux.yml +++ b/.builds/archlinux.yml @@ -9,6 +9,7 @@ sources: tasks: - test: | cd hazwaz + export COVERAGE=coverage sh check coverage - qa: | cd hazwaz diff --git a/.gitignore b/.gitignore index 8534f9c..011c0ee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ *.pyc .coverage +hazwaz/_version.py + .*.sw? diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 95b453d..7f3bf74 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,7 @@ Unreleased ========== * Make the package PEP651 compliant. +* Modernize packaging with pyproject.toml and setuptool_scm. 0.0.2 ===== diff --git a/check b/check index 4961935..2082dd9 100755 --- a/check +++ b/check @@ -11,7 +11,7 @@ then fi PYTHON="${PYTHON:-python3}" -NOSE2="${NOSE2:-$PYTHON -m nose2}" +COVERAGE="${COVERAGE:-python3-coverage}" export PYTHONDEVMODE=1 @@ -20,11 +20,11 @@ shift 1 case $SUBCMD in "tests") - $NOSE2 $COVER_OPT --log-level=ERROR -B --log-capture $* + $PYTHON -m unittest discover -s tests ;; "coverage") - $NOSE2 --with-coverage --coverage-report=term-missing \ - --log-level=ERROR -B --log-capture $* + $COVERAGE run --source=hazwaz -m unittest discover -s tests + $COVERAGE report -m ;; "qa") flake8 --select=E,F,W,C90,E123 --ignore=W503 . diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..ddd0fc8 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,39 @@ +[build-system] +requires = ["setuptools", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "hazwaz" +authors = [ + {name = "Elena ``of Valhalla'' Grandi", email = "valhalla@trueelena.org"}, +] +description = "A command line scripts framework" +readme = "README.rst" +requires-python = ">= 3.9" +license = {text = "AGPLv3+"} +keywords = ["cli"] +classifiers = [ + 'Development Status :: 3 - Alpha', + 'Environment :: Console', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)', + 'Operating System :: POSIX', + 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Topic :: Software Development :: Libraries :: Python Modules', + 'Topic :: Software Development :: User Interfaces', +] +dynamic = ["version"] + +[project.urls] +Homepage = "https://hazwaz.trueelena.org/" +Documentation = "https://hazwaz.trueelena.org/" +Repository = "https://git.sr.ht/~valhalla/hazwaz" +Source = "https://git.sr.ht/~valhalla/hazwaz" +Issues = "https://todo.sr.ht/~valhalla/hazwaz" +Tracker = "https://todo.sr.ht/~valhalla/hazwaz" +Changelog = "https://git.sr.ht/~valhalla/hazwaz/tree/master/item/CHANGELOG.rst" + +[tool.setuptools_scm] +version_file = "hazwaz/_version.py" diff --git a/setup.py b/setup.py index 6a04053..1cd933d 100644 --- a/setup.py +++ b/setup.py @@ -1,47 +1,4 @@ -from setuptools import find_packages, setup - -try: - with open("README.rst", 'r') as fp: - long_description = fp.read() -except IOError: - print("Could not read README.rst, long_description will be empty.") - long_description = "" +from setuptools import setup setup( - name='hazwaz', - version='0.0.3', - packages=find_packages(), - package_data={ - "hazwaz": ["py.typed"], - }, - test_suite='tests', - install_requires=[], - python_requires='>=3', - zip_safe=False, - # Metadata - author="Elena ``of Valhalla'' Grandi", - author_email='valhalla@trueelena.org', - description='write command line scripts', - long_description=long_description, - long_description_content_type='text/x-rst', - license='AGPLv3+', - keywords='cli', - url='https://hazwaz.trueelena.org/', - classifiers=[ - 'Development Status :: 3 - Alpha', - 'Environment :: Console', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)', # noqa: E501 - 'Operating System :: POSIX', - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Topic :: Software Development :: Libraries :: Python Modules', - 'Topic :: Software Development :: User Interfaces', - ], - project_urls={ - 'Source': 'https://git.sr.ht/~valhalla/hazwaz', - 'Documentation': 'https://hazwaz.trueelena.org/', - 'Tracker': 'https://todo.sr.ht/~valhalla/hazwaz', - }, ) -- cgit v1.2.3