From ab7eac67d583f27b57c32e8f681a980b391cff40 Mon Sep 17 00:00:00 2001 From: Valentin Niess Date: Fri, 23 May 2025 17:48:56 +0200 Subject: [PATCH] Switch to pyproject.toml --- .github/workflows/pypi.yml | 2 +- MANIFEST.in | 1 + VERSION | 1 - pyproject.toml | 58 +++++++++++++++++++++++ python_appimage/__init__.py | 2 + setup.py | 91 ------------------------------------- 6 files changed, 62 insertions(+), 93 deletions(-) create mode 100644 MANIFEST.in delete mode 100644 VERSION create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index e1947d5..363c671 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -4,7 +4,7 @@ on: branches: - master paths: - - 'VERSION' + - 'python_appimage/version.py' workflow_dispatch: inputs: upload: diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..0d0d93b --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include python_appimage/data/* diff --git a/VERSION b/VERSION deleted file mode 100644 index 347f583..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.4.1 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..9e27915 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,58 @@ +[project] +name = "python_appimage" +authors = [ + { name="Valentin Niess", email="valentin.niess@gmail.com" }, +] +dynamic = ["version"] +description = "Appimage releases of Python" +readme = "README.md" +requires-python = ">=3.9" +dependencies = [ + "requests", +] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Programming Language :: Python", + "Topic :: Software Development", + "Operating System :: POSIX :: Linux", +] +license = "GPL-3.0-or-later" +license-files = ["LICENSE"] + +[project.scripts] +python-appimage = "python_appimage.__main__:main" + +[project.urls] +homepage = "https://github.com/niess/python-appimage" +documentation = "https://python-appimage.readthedocs.io" +download = "https://pypi.python.org/pypi/python-appimage" +source = "https://github.com/niess/python-appimage" +issues = "https://github.com/niess/python-appimage/issues" + +[build-system] +requires = ["setuptools >= 77.0.3"] +build-backend = "setuptools.build_meta" + +[tool.setuptools.packages.find] +include = ["python_appimage*"] + +[tool.setuptools.dynamic] +version = {attr = "python_appimage.__version__"} + +[tool.bumpversion] +current_version = "1.4.1" +parse = "(?P\\d+)\\.(?P\\d+)\\.(?P\\d+)" +serialize = ["{major}.{minor}.{patch}"] +search = "{current_version}" +replace = "{new_version}" +regex = false +ignore_missing_version = false +tag = false +allow_dirty = false +commit = true +message = "Bump version: v{new_version}" +commit_args = "" + +[[tool.bumpversion.files]] +filename = "python_appimage/version.py" diff --git a/python_appimage/__init__.py b/python_appimage/__init__.py index b5418da..82947d8 100644 --- a/python_appimage/__init__.py +++ b/python_appimage/__init__.py @@ -1,5 +1,7 @@ import platform +from .version import version as __version__ + if platform.system() != 'Linux': raise RuntimeError('invalid system: ' + platform.system()) diff --git a/setup.py b/setup.py deleted file mode 100644 index 6324651..0000000 --- a/setup.py +++ /dev/null @@ -1,91 +0,0 @@ -import json -import os -import setuptools -import ssl -import subprocess - -from python_appimage.utils.deps import ensure_excludelist -from python_appimage.utils.url import urlopen - - -CLASSIFIERS = '''\ -Development Status :: 4 - Beta -Intended Audience :: Developers -License :: OSI Approved :: GNU General Public License v3 (GPLv3) -Programming Language :: Python -Topic :: Software Development -Operating System :: POSIX :: Linux -''' - - -with open('README.md') as f: - long_description = f.read() - - -def get_version(): - '''Get the next version number from PyPI - ''' - with open('VERSION') as f: - version = f.read().strip() - - p = subprocess.Popen( - 'git describe --match=NeVeRmAtCh --always --dirty 2> /dev/null || ' - 'echo unknown', - shell=True, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) - stdout, _ = p.communicate() - try: - stdout = stdout.decode() - except AttributeError: - stdout = str(stdout) - git_revision = stdout.strip() - - with open('python_appimage/version.py', 'w+') as f: - f.write('''\ -# This file was generated by setup.py -version = '{version:}' -git_revision = '{git_revision:}' -'''.format(version=version, git_revision=git_revision)) - - return version - - -def get_package_data(): - '''Get the list of package data - ''' - ensure_excludelist() - - prefix = os.path.dirname(__file__) or '.' - return ['data/' + file_ - for file_ in os.listdir(prefix + '/python_appimage/data')] - - -setuptools.setup( - name = 'python_appimage', - version = get_version(), - author = 'Valentin Niess', - author_email = 'valentin.niess@gmail.com', - description = 'Appimage releases of Python', - long_description = long_description, - long_description_content_type = 'text/markdown', - url = 'https://github.com/niess/python-appimage', - download_url = 'https://pypi.python.org/pypi/python-appimage', - project_urls = { - 'Bug Tracker' : 'https://github.com/niess/python-appimage/issues', - 'Source Code' : 'https://github.com/niess/python-appimage', - }, - packages = setuptools.find_packages(), - classifiers = [s for s in CLASSIFIERS.split(os.linesep) if s.strip()], - license = 'GPLv3', - platforms = ['Linux'], - python_requires = '>=3.9', - install_requires=[ - 'requests', - ], - include_package_data = True, - package_data = {'': get_package_data()}, - entry_points = { - 'console_scripts' : ( - 'python-appimage = python_appimage.__main__:main',) - } -)