From 1402d437b5900aee406577696c5b02ae0281d5ba Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 10 Jun 2024 16:23:38 -0500 Subject: [PATCH] feat: switch from setup.cfg to pyproject.toml + hatchling --- .gitignore | 2 + pyproject.toml | 101 +++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 101 ------------------------------------------- setup.py | 29 ------------- tailbone/_version.py | 8 +++- tasks.py | 13 +++++- 6 files changed, 122 insertions(+), 132 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 03545d1a..b3006f90 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +*~ +*.pyc .coverage .tox/ dist/ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..7c894886 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,101 @@ + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + + +[project] +name = "Tailbone" +version = "0.10.16" +description = "Backoffice Web Application for Rattail" +readme = "README.rst" +authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] +license = {text = "GNU GPL v3+"} +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Web Environment", + "Framework :: Pyramid", + "Intended Audience :: Developers", + "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "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", + "Programming Language :: Python :: 3.11", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Office/Business", + "Topic :: Software Development :: Libraries :: Python Modules", +] + +dependencies = [ + "asgiref", + "colander", + "ColanderAlchemy", + "cornice", + "cornice-swagger", + "deform", + "humanize", + "Mako", + "markdown", + "openpyxl", + "paginate", + "paginate_sqlalchemy", + "passlib", + "Pillow", + "pyramid>=2", + "pyramid_beaker", + "pyramid_deform", + "pyramid_exclog", + "pyramid_fanstatic", + "pyramid_mako", + "pyramid_retry", + "pyramid_tm", + "rattail[db,bouncer]", + "six", + "sa-filters", + "simplejson", + "transaction", + "waitress", + "WebHelpers2", + "zope.sqlalchemy", +] + + +[project.optional-dependencies] +docs = ["Sphinx", "sphinx-rtd-theme"] +tests = ["coverage", "mock", "pytest", "pytest-cov"] + + +[project.entry-points."paste.app_factory"] +main = "tailbone.app:main" +webapi = "tailbone.webapi:main" + + +[project.entry-points."rattail.cleaners"] +beaker = "tailbone.cleanup:BeakerCleaner" + + +[project.entry-points."rattail.config.extensions"] +tailbone = "tailbone.config:ConfigExtension" + + +[project.urls] +Homepage = "https://rattailproject.org" +Repository = "https://kallithea.rattailproject.org/rattail-project/tailbone" +Issues = "https://redmine.rattailproject.org/projects/tailbone/issues" +Changelog = "https://kallithea.rattailproject.org/rattail-project/tailbone/files/master/CHANGES.rst" + + +[tool.commitizen] +version_provider = "pep621" +tag_format = "v$version" +update_changelog_on_bump = true + + +# [tool.hatch.build.targets.wheel] +# packages = ["corepos"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 50c057f9..00000000 --- a/setup.cfg +++ /dev/null @@ -1,101 +0,0 @@ -# -*- coding: utf-8; -*- - -[nosetests] -nocapture = 1 -cover-package = tailbone -cover-erase = 1 -cover-html = 1 -cover-html-dir = htmlcov - -[metadata] -name = Tailbone -version = attr: tailbone.__version__ -author = Lance Edgar -author_email = lance@edbob.org -url = http://rattailproject.org/ -license = GNU GPL v3 -description = Backoffice Web Application for Rattail -long_description = file: README.rst -classifiers = - Development Status :: 4 - Beta - Environment :: Web Environment - Framework :: Pyramid - Intended Audience :: Developers - License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) - Natural Language :: English - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - 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 - Programming Language :: Python :: 3.11 - Topic :: Internet :: WWW/HTTP - Topic :: Office/Business - Topic :: Software Development :: Libraries :: Python Modules - - -[options] -install_requires = - asgiref - colander - ColanderAlchemy - cornice - cornice-swagger - deform - humanize - Mako - markdown - openpyxl - paginate - paginate_sqlalchemy - passlib - Pillow - pyramid>=2 - pyramid_beaker - pyramid_deform - pyramid_exclog - pyramid_fanstatic - pyramid_mako - pyramid_retry - pyramid_tm - rattail[db,bouncer] - six - sa-filters - simplejson - transaction - waitress - WebHelpers2 - zope.sqlalchemy - -tests_require = Tailbone[tests] -test_suite = tests -packages = find: -include_package_data = True -zip_safe = False - - -[options.packages.find] -exclude = - tests.* - tests - - -[options.extras_require] -docs = Sphinx; sphinx-rtd-theme -tests = coverage; mock; pytest; pytest-cov - - -[options.entry_points] - -paste.app_factory = - main = tailbone.app:main - webapi = tailbone.webapi:main - -rattail.cleaners = - beaker = tailbone.cleanup:BeakerCleaner - -rattail.config.extensions = - tailbone = tailbone.config:ConfigExtension diff --git a/setup.py b/setup.py deleted file mode 100644 index 5645ddff..00000000 --- a/setup.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8; -*- -################################################################################ -# -# Rattail -- Retail Software Framework -# Copyright © 2010-2023 Lance Edgar -# -# This file is part of Rattail. -# -# Rattail is free software: you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation, either version 3 of the License, or (at your option) any later -# version. -# -# Rattail is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# Rattail. If not, see . -# -################################################################################ -""" -Setup script for Tailbone -""" - -from setuptools import setup - -setup() diff --git a/tailbone/_version.py b/tailbone/_version.py index e1187ee4..7095f6c8 100644 --- a/tailbone/_version.py +++ b/tailbone/_version.py @@ -1,3 +1,9 @@ # -*- coding: utf-8; -*- -__version__ = '0.10.16' +try: + from importlib.metadata import version +except ImportError: + from importlib_metadata import version + + +__version__ = version('Tailbone') diff --git a/tasks.py b/tasks.py index fba0b699..e9f47ccd 100644 --- a/tasks.py +++ b/tasks.py @@ -25,13 +25,24 @@ Tasks for Tailbone """ import os +import re import shutil from invoke import task here = os.path.abspath(os.path.dirname(__file__)) -exec(open(os.path.join(here, 'tailbone', '_version.py')).read()) +__version__ = None +pattern = re.compile(r'^version = "(\d+\.\d+\.\d+)"$') +with open(os.path.join(here, 'pyproject.toml'), 'rt') as f: + for line in f: + line = line.rstrip('\n') + match = pattern.match(line) + if match: + __version__ = match.group(1) + break +if not __version__: + raise RuntimeError("could not parse version!") @task