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

This commit is contained in:
Lance Edgar 2024-06-10 19:57:20 -05:00
parent a8107b6ab1
commit 63b7bd3742
6 changed files with 91 additions and 72 deletions

3
.gitignore vendored
View file

@ -1,2 +1,5 @@
*~
*.pyc
Corporal.egg-info/
dist/
machines/*/.vagrant/

View file

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

76
pyproject.toml Normal file
View file

@ -0,0 +1,76 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "Corporal"
version = "0.1.16"
description = "Companion Back-end for CORE-POS"
readme = "README.md"
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 = [
# NOTE: we do not specify a restriction here, but in practice you may
# need to explicitly install e.g. 8.0.17 depending on how it behaves...
"mysql-connector-python",
"invoke",
"psycopg2",
"Tailbone",
"tailbone-corepos",
"typer",
]
[project.scripts]
corporal = "corporal.commands:corporal_typer"
[project.entry-points."paste.app_factory"]
main = "corporal.web.app:main"
[project.entry-points."rattail.config.extensions"]
corporal = "corporal.config:CorporalConfig"
[project.entry-points."rattail.emails"]
corporal = "corporal.emails"
[project.entry-points."rattail.projects"]
corepos_poser = "corporal.projects.corepos_poser:COREPOSPoserProjectGenerator"
corporal = "corporal.projects.corporal:CorporalProjectGenerator"
[project.urls]
Homepage = "https://redmine.rattailproject.org/projects/corepos-integration"
Repository = "https://kallithea.rattailproject.org/rattail-project/corporal"
Issues = "https://redmine.rattailproject.org/projects/corepos-integration/issues"
Changelog = "https://kallithea.rattailproject.org/rattail-project/corporal/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/",
]

View file

@ -1,57 +0,0 @@
# -*- coding: utf-8; -*-
[metadata]
name = Corporal
version = attr: corporal.__version__
author = Lance Edgar
author_email = lance@edbob.org
url = https://rattailproject.org
description = Companion Back-end for CORE-POS
long_description = file: README.md
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 =
# NOTE: we do not specify a restriction here, but in practice you may
# need to explicitly install e.g. 8.0.17 depending on how it behaves...
mysql-connector-python
invoke
psycopg2
Tailbone
tailbone-corepos
typer
packages = find:
include_package_data = True
[options.entry_points]
console_scripts =
corporal = corporal.commands:corporal_typer
paste.app_factory =
main = corporal.web.app:main
rattail.config.extensions =
corporal = corporal.config:CorporalConfig
rattail.emails =
corporal = corporal.emails
rattail.projects =
corepos_poser = corporal.projects.corepos_poser:COREPOSPoserProjectGenerator
corporal = corporal.projects.corporal:CorporalProjectGenerator

View file

@ -1,5 +0,0 @@
# -*- coding: utf-8; -*-
from setuptools import setup
setup()

View file

@ -9,18 +9,17 @@ import shutil
from invoke import task
here = os.path.abspath(os.path.dirname(__file__))
exec(open(os.path.join(here, 'corporal', '_version.py')).read())
@task
def release(ctx):
def release(c):
"""
Release a new version of Corporal
"""
# rebuild local tar.gz file for distribution
shutil.rmtree('Corporal.egg-info')
ctx.run('python -m build --sdist')
# rebuild package
if os.path.exists('dist'):
shutil.rmtree('dist')
if os.path.exists('Corporal.egg-info'):
shutil.rmtree('Corporal.egg-info')
c.run('python -m build --sdist')
# upload to public PyPI
ctx.run('twine upload dist/corporal-{}.tar.gz'.format(__version__))
c.run('twine upload dist/*')