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

This commit is contained in:
Lance Edgar 2024-06-10 22:52:09 -05:00
parent 55a7c4a9be
commit 3216d27359
6 changed files with 70 additions and 86 deletions

3
.gitignore vendored
View file

@ -1 +1,4 @@
*~
*.pyc
dist/
rattail_nationbuilder.egg-info/

59
pyproject.toml Normal file
View file

@ -0,0 +1,59 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "rattail-nationbuilder"
version = "0.2.0"
description = "Rattail integration package for NationBuilder"
readme = "README.md"
authors = [{name = "Lance Edgar", email = "lance@edbob.org"}]
license = {text = "GNU GPL v3+"}
classifiers = [
"Development Status :: 4 - Beta",
"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",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"rattail",
]
[project.entry-points."rattail.subcommands"]
import-nationbuilder = "rattail_nationbuilder.commands:ImportNationBuilder"
[project.entry-points."rattail.typer_imports"]
rattail_nationbuilder = "rattail_nationbuilder.commands"
[project.entry-points."rattail.config.extensions"]
rattail_nationbuilder = "rattail_nationbuilder.config:RattailNationBuilderExtension"
[project.entry-points."rattail.importing"]
"to_rattail.from_nationbuilder.import" = "rattail_nationbuilder.importing.nationbuilder:FromNationBuilderToRattail"
[project.entry-points."rattail.providers"]
rattail_nationbuilder = "rattail_nationbuilder.app:NationBuilderProvider"
[project.urls]
Homepage = "https://rattailproject.org"
Repository = "https://kallithea.rattailproject.org/rattail-project/rattail-nationbuilder"
Changelog = "https://kallithea.rattailproject.org/rattail-project/rattail-nationbuilder/files/master/CHANGELOG.md"
[tool.commitizen]
version_provider = "pep621"
tag_format = "v$version"
update_changelog_on_bump = true

View file

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

View file

@ -1,47 +0,0 @@
# -*- coding: utf-8; -*-
[metadata]
name = rattail-nationbuilder
version = attr: rattail_nationbuilder.__version__
author = Lance Edgar
author_email = lance@edbob.org
url = https://rattailproject.org/
license = GNU GPL v3
description = Rattail integration package for NationBuilder
long_description = file: README.md
classifiers =
Development Status :: 4 - Beta
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
Topic :: Software Development :: Libraries :: Python Modules
[options]
install_requires =
rattail
packages = find:
include_package_data = True
[options.entry_points]
rattail.subcommands =
import-nationbuilder = rattail_nationbuilder.commands:ImportNationBuilder
rattail.typer_imports =
rattail_nationbuilder = rattail_nationbuilder.commands
rattail.config.extensions =
rattail_nationbuilder = rattail_nationbuilder.config:RattailNationBuilderExtension
rattail.importing =
to_rattail.from_nationbuilder.import = rattail_nationbuilder.importing.nationbuilder:FromNationBuilderToRattail
rattail.providers =
rattail_nationbuilder = rattail_nationbuilder.app:NationBuilderProvider

View file

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

View file

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