From 8b2320ebc1c827c4814a424a0cc9fe09ecac4d8c Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 10 Jun 2024 21:07:33 -0500 Subject: [PATCH] feat: switch from setup.cfg to pyproject.toml + hatchling --- .gitignore | 3 ++ pyproject.toml | 83 ++++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 60 ---------------------------------- setup.py | 29 ----------------- tasks.py | 18 +++++------ theo/_version.py | 5 ++- 6 files changed, 98 insertions(+), 100 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.gitignore b/.gitignore index a3294b6..6fab68b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ +*~ +*.pyc tailbone_theo.egg-info/ dev/settings.ini +dist/ docs/_build/ machines/theo-server/.vagrant/ machines/theo-server/fabenv.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..4fc2380 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,83 @@ + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + + +[project] +name = "tailbone-theo" +version = "0.1.6" +description = "Theo, the order system" +readme = "README.rst" +authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] +classifiers = [ + "Development Status :: 3 - Alpha", + "Environment :: Console", + "Environment :: Web Environment", + "Framework :: Pyramid", + "Intended Audience :: Developers", + "Natural Language :: English", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Topic :: Office/Business", +] +dependencies = [ + "mysql-connector-python", + "psycopg2", + "Tailbone", + "typer", +] + + +[project.optional-dependencies] +catapult = ["onager", "rattail-onager", "tailbone-onager"] +corepos = ["pyCOREPOS", "rattail-corepos", "tailbone-corepos"] +fabric = ["rattail-fabric2"] +locsms = ["luckysmores", "rattail-luckysmores", "tailbone-locsms"] + + +[project.scripts] +theo = "theo.commands:theo_typer" + + +[project.entry-points."paste.app_factory"] +main = "theo.web.app:main" +webapi = "theo.web.webapi:main" + + +[project.entry-points."rattail.config.extensions"] +theo = "theo.config:TheoConfig" + + +[project.entry-points."rattail.importing"] +# nb. we always register all 3 handlers here, for version +# imports. any which fail to load will simply not appear +# available to the user. +"to_rattail_versions.from_rattail.import.theo_catapult" = "theo.importing.versions_catapult:FromTheoToTheoVersions" +"to_rattail_versions.from_rattail.import.theo_corepos" = "theo.importing.versions_corepos:FromTheoToTheoVersions" +"to_rattail_versions.from_rattail.import.theo_locsms" = "theo.importing.versions_locsms:FromTheoToTheoVersions" + + +[project.urls] +Homepage = "https://redmine.rattailproject.org/projects/theo" +Repository = "https://kallithea.rattailproject.org/rattail-project/theo" +Issues = "https://redmine.rattailproject.org/projects/theo/issues" +Changelog = "https://kallithea.rattailproject.org/rattail-project/theo/files/master/CHANGELOG.md" + + +[tool.commitizen] +version_provider = "pep621" +tag_format = "v$version" +update_changelog_on_bump = true + + +[tool.hatch.build.targets.sdist] +exclude = [ + "machines/", + "mobile/", +] + + +[tool.hatch.build.targets.wheel] +packages = ["theo"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 29dcb0c..0000000 --- a/setup.cfg +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8; -*- - -[metadata] -name = tailbone-theo -version = attr: theo.__version__ -author = Lance Edgar -author_email = lance@edbob.org -url = https://rattailproject.org -description = Theo, the order system -long_description = file: README.rst -classifiers = - Development Status :: 3 - Alpha - Environment :: Console - Environment :: Web Environment - Framework :: Pyramid - Intended Audience :: Developers - Natural Language :: English - Operating System :: POSIX :: Linux - Programming Language :: Python - Programming Language :: Python :: 3 - Topic :: Office/Business - - -[options] -install_requires = - mysql-connector-python - psycopg2 - Tailbone - typer - -packages = find: -include_package_data = True - - -[options.extras_require] -catapult = onager; rattail-onager; tailbone-onager -corepos = pyCOREPOS; rattail-corepos; tailbone-corepos -fabric = rattail-fabric2 -locsms = luckysmores; rattail-luckysmores; tailbone-locsms - - -[options.entry_points] - -console_scripts = - theo = theo.commands:theo_typer - -rattail.config.extensions = - theo = theo.config:TheoConfig - -rattail.importing = - # nb. we always register all 3 handlers here, for version - # imports. any which fail to load will simply not appear - # available to the user. - to_rattail_versions.from_rattail.import.theo_catapult = theo.importing.versions_catapult:FromTheoToTheoVersions - to_rattail_versions.from_rattail.import.theo_corepos = theo.importing.versions_corepos:FromTheoToTheoVersions - to_rattail_versions.from_rattail.import.theo_locsms = theo.importing.versions_locsms:FromTheoToTheoVersions - -paste.app_factory = - main = theo.web.app:main - webapi = theo.web.webapi:main diff --git a/setup.py b/setup.py deleted file mode 100644 index d6ebf6b..0000000 --- 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 . -# -################################################################################ -""" -Theo setup script -""" - -from setuptools import setup - -setup() diff --git a/tasks.py b/tasks.py index a1666c8..c8163b3 100644 --- a/tasks.py +++ b/tasks.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2020 Lance Edgar +# Copyright © 2010-2024 Lance Edgar # # This file is part of Rattail. # @@ -30,16 +30,14 @@ import shutil from invoke import task -here = os.path.abspath(os.path.dirname(__file__)) -exec(open(os.path.join(here, 'theo', '_version.py')).read()) - - @task -def release(ctx): +def release(c): """ Release a new version of 'tailbone-theo' """ - shutil.rmtree('tailbone_theo.egg-info') - ctx.run('python setup.py sdist --formats=gztar') - filename = 'tailbone-theo-{}.tar.gz'.format(__version__) - ctx.run('twine upload dist/{}'.format(filename)) + if os.path.exists('dist'): + shutil.rmtree('dist') + if os.path.exists('tailbone_theo.egg-info'): + shutil.rmtree('tailbone_theo.egg-info') + c.run('python -m build --sdist') + c.run('twine upload dist/*') diff --git a/theo/_version.py b/theo/_version.py index 955f1d8..83a318d 100644 --- a/theo/_version.py +++ b/theo/_version.py @@ -1,3 +1,6 @@ # -*- coding: utf-8; -*- -__version__ = '0.1.6' +from importlib.metadata import version + + +__version__ = version('tailbone-theo')