From af840fdcd49fdd6d5178699623a627888bcca01a Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 10 Jun 2024 21:56:59 -0500 Subject: [PATCH] feat: switch from setup.cfg to pyproject.toml + hatchling --- .gitignore | 3 +++ pyproject.toml | 58 ++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 50 -------------------------------------- setup.py | 29 ---------------------- tasks.py | 13 ++++------ wuttapos/_version.py | 5 +++- 6 files changed, 70 insertions(+), 88 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 6504721..ed843c6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ +*~ +*.pyc WuttaPOS.egg-info/ +dist/ wuttapos/assets/custom_header_logo.png diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..6ab2d14 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,58 @@ + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + + +[project] +name = "WuttaPOS" +version = "0.1.0" +description = "Pythonic Point of Sale System" +readme = "README.md" +authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] +license = {text = "GNU GPL v3+"} +classifiers = [ + "Development Status :: 3 - Alpha", + "Environment :: Win32 (MS Windows)", + "Environment :: X11 Applications", + "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", + "Topic :: Office/Business :: Financial :: Point-Of-Sale", +] +dependencies = [ + "psycopg2", + "rattail[db]", + "typer", + + # TODO: unfortunately the latest Flet versions as of writing + # (to 0.22.1) include a bug..when running `wuttapos open` + # command then quitting the app, you get an error "Event loop + # is closed" - i tried several versions of python (to 3.12.3) + # but nothing worked despite the claims made in github issue, + # https://github.com/flet-dev/flet/issues/2848 + "flet<0.21", +] + + +[project.scripts] +wuttapos = "wuttapos.commands:wuttapos_typer" + + +[project.entry-points."rattail.config.extensions"] +wuttapos = "wuttapos.config:WuttaConfigExtension" + + +[project.urls] +Homepage = "https://rattailproject.org" +Repository = "https://kallithea.rattailproject.org/rattail-project/wuttapos" +Changelog = "https://kallithea.rattailproject.org/rattail-project/wuttapos/files/master/CHANGELOG.md" + + +[tool.commitizen] +version_provider = "pep621" +tag_format = "v$version" +update_changelog_on_bump = true diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index c1e950c..0000000 --- a/setup.cfg +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8; -*- - -[metadata] -name = WuttaPOS -version = attr: wuttapos.__version__ -author = Lance Edgar -author_email = lance@edbob.org -url = https://rattailproject.org/ -license = GNU GPL v3 -description = Pythonic Point of Sale System -long_description = file: README.md -classifiers = - Development Status :: 3 - Alpha - Environment :: Win32 (MS Windows) - Environment :: X11 Applications - 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 - Topic :: Office/Business :: Financial :: Point-Of-Sale - - -[options] -install_requires = - psycopg2 - rattail[db] - typer - - # TODO: unfortunately the latest Flet versions as of writing - # (to 0.22.1) include a bug..when running `wuttapos open` - # command then quitting the app, you get an error "Event loop - # is closed" - i tried several versions of python (to 3.12.3) - # but nothing worked despite the claims made in github issue, - # https://github.com/flet-dev/flet/issues/2848 - flet<0.21 - -packages = find: -include_package_data = True -# zip_safe = False - - -[options.entry_points] - -console_scripts = - wuttapos = wuttapos.commands:wuttapos_typer - -rattail.config.extensions = - wuttapos = wuttapos.config:WuttaConfigExtension diff --git a/setup.py b/setup.py deleted file mode 100644 index 9f0788f..0000000 --- a/setup.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8; -*- -################################################################################ -# -# WuttaPOS -- Pythonic Point of Sale System -# Copyright © 2023 Lance Edgar -# -# This file is part of WuttaPOS. -# -# WuttaPOS 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. -# -# WuttaPOS 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 -# WuttaPOS. If not, see . -# -################################################################################ -""" -WuttaPOS setup script -""" - -from setuptools import setup - -setup() diff --git a/tasks.py b/tasks.py index d868274..f242ea8 100644 --- a/tasks.py +++ b/tasks.py @@ -2,7 +2,7 @@ ################################################################################ # # WuttaPOS -- Pythonic Point of Sale System -# Copyright © 2023 Lance Edgar +# Copyright © 2023-2024 Lance Edgar # # This file is part of WuttaPOS. # @@ -30,20 +30,17 @@ import shutil from invoke import task -here = os.path.abspath(os.path.dirname(__file__)) -exec(open(os.path.join(here, 'wuttapos', '_version.py')).read()) - - @task def release(c): """ Release a new version of WuttaPOS """ - # rebuild local tar.gz file for distribution + # rebuild package + if os.path.exists('dist'): + shutil.rmtree('dist') if os.path.exists('WuttaPOS.egg-info'): shutil.rmtree('WuttaPOS.egg-info') c.run('python -m build --sdist') # upload to PyPI - filename = f'WuttaPOS-{__version__}.tar.gz' - c.run(f'twine upload dist/{filename}') + c.run('twine upload dist/*') diff --git a/wuttapos/_version.py b/wuttapos/_version.py index e41b669..2792d69 100644 --- a/wuttapos/_version.py +++ b/wuttapos/_version.py @@ -1,3 +1,6 @@ # -*- coding: utf-8; -*- -__version__ = '0.1.0' +from importlib.metadata import version + + +__version__ = version('WuttaPOS')