From 92285dcbc1a42d7636dceec88a216e8b08143055 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 10 Jun 2024 21:29:46 -0500 Subject: [PATCH] feat: switch from setup.cfg to pyproject.toml + hatchling --- .gitignore | 3 ++ messkit/_version.py | 5 +++- pyproject.toml | 67 +++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 50 --------------------------------- setup.py | 29 -------------------- tasks.py | 10 +++---- 6 files changed, 78 insertions(+), 86 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.gitignore b/.gitignore index b26036a..a596a28 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ +*~ +*.pyc Messkit.egg-info/ +dist/ docs/_build/ diff --git a/messkit/_version.py b/messkit/_version.py index 4e18c2b..09e600c 100644 --- a/messkit/_version.py +++ b/messkit/_version.py @@ -1,3 +1,6 @@ # -*- coding: utf-8; -*- -__version__ = '0.1.8' +from importlib.metadata import version + + +__version__ = version('Messkit') diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..84a9068 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,67 @@ + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + + +[project] +name = "Messkit" +version = "0.1.8" +description = "Generic-ish Data Utility App" +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 = [ + + # TODO: user should get to choose which of these is needed? + "mysql-connector-python", + "psycopg2", + + "prompt_toolkit", + "rich", + "Sphinx", + "Tailbone", + "typer", +] + + +[project.scripts] +messkit = "messkit.commands:messkit_typer" + + +[project.entry-points."paste.app_factory"] +main = "messkit.web.app:main" + + +[project.entry-points."rattail.config.extensions"] +messkit = "messkit.config:MesskitConfig" + + +[project.urls] +Homepage = "https://redmine.rattailproject.org/projects/messkit" +Repository = "https://kallithea.rattailproject.org/rattail-project/messkit" +Issues = "https://redmine.rattailproject.org/projects/messkit/issues" +Changelog = "https://kallithea.rattailproject.org/rattail-project/messkit/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/", +# ] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 6a00802..0000000 --- a/setup.cfg +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8; -*- - -[metadata] -name = Messkit -version = attr: messkit.__version__ -author = Lance Edgar -author_email = lance@edbob.org -url = https://rattailproject.org -description = Generic-ish Data Utility App -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 = - - # TODO: user should get to choose which of these is needed? - mysql-connector-python - psycopg2 - - prompt_toolkit - rich - Sphinx - Tailbone - typer - -packages = find: -include_package_data = True - - -[options.entry_points] - -console_scripts = - messkit = messkit.commands:messkit_typer - -paste.app_factory = - main = messkit.web.app:main - -rattail.config.extensions = - messkit = messkit.config:MesskitConfig diff --git a/setup.py b/setup.py deleted file mode 100644 index 59e76fb..0000000 --- a/setup.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8; -*- -###################################################################### -# -# Messkit -- Generic-ish Data Utility App -# Copyright © 2022-2023 Lance Edgar -# -# This file is part of Messkit. -# -# Messkit 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. -# -# Messkit 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 Messkit. If not, see . -# -###################################################################### -""" -Messkit setup script -""" - -from setuptools import setup - -setup() diff --git a/tasks.py b/tasks.py index 15426f6..cd27f57 100644 --- a/tasks.py +++ b/tasks.py @@ -9,19 +9,17 @@ import shutil from invoke import task -here = os.path.abspath(os.path.dirname(__file__)) -exec(open(os.path.join(here, 'messkit', '_version.py')).read()) - - @task def release(c): """ Release a new version of Messkit """ - # rebuild local tar.gz file for distribution + # rebuild package + if os.path.exists('dist'): + shutil.rmtree('dist') if os.path.exists('Messkit.egg-info'): shutil.rmtree('Messkit.egg-info') c.run('python -m build --sdist') # upload to public PyPI - c.run('twine upload dist/Messkit-{}.tar.gz'.format(__version__)) + c.run('twine upload dist/*')