feat: switch from setup.cfg to pyproject.toml + hatchling

This commit is contained in:
Lance Edgar 2024-06-10 21:56:59 -05:00
parent 9378d9b0f8
commit af840fdcd4
6 changed files with 70 additions and 88 deletions

3
.gitignore vendored
View file

@ -1,2 +1,5 @@
*~
*.pyc
WuttaPOS.egg-info/ WuttaPOS.egg-info/
dist/
wuttapos/assets/custom_header_logo.png wuttapos/assets/custom_header_logo.png

58
pyproject.toml Normal file
View file

@ -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

View file

@ -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

View file

@ -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 <http://www.gnu.org/licenses/>.
#
################################################################################
"""
WuttaPOS setup script
"""
from setuptools import setup
setup()

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# WuttaPOS -- Pythonic Point of Sale System # WuttaPOS -- Pythonic Point of Sale System
# Copyright © 2023 Lance Edgar # Copyright © 2023-2024 Lance Edgar
# #
# This file is part of WuttaPOS. # This file is part of WuttaPOS.
# #
@ -30,20 +30,17 @@ import shutil
from invoke import task from invoke import task
here = os.path.abspath(os.path.dirname(__file__))
exec(open(os.path.join(here, 'wuttapos', '_version.py')).read())
@task @task
def release(c): def release(c):
""" """
Release a new version of WuttaPOS 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'): if os.path.exists('WuttaPOS.egg-info'):
shutil.rmtree('WuttaPOS.egg-info') shutil.rmtree('WuttaPOS.egg-info')
c.run('python -m build --sdist') c.run('python -m build --sdist')
# upload to PyPI # upload to PyPI
filename = f'WuttaPOS-{__version__}.tar.gz' c.run('twine upload dist/*')
c.run(f'twine upload dist/{filename}')

View file

@ -1,3 +1,6 @@
# -*- coding: utf-8; -*- # -*- coding: utf-8; -*-
__version__ = '0.1.0' from importlib.metadata import version
__version__ = version('WuttaPOS')