Migrate to pyproject.toml with setuptools_scm
Replace custom version management with setuptools_scm to eliminate source file modifications during installation. Version is now derived from git tags at build time without writing to tracked files. Changes: - Add pyproject.toml with full project metadata - Simplify setup.py to minimal backwards-compatible shim - Remove curateipsum/_version.py from version control - Add _version.py to .gitignore (auto-generated at build time) - Use PEP 440 compliant version strings Fixes #18
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -25,6 +25,9 @@ wheels/
|
|||||||
*.egg
|
*.egg
|
||||||
MANIFEST
|
MANIFEST
|
||||||
|
|
||||||
|
# Version file generated by setuptools_scm
|
||||||
|
curateipsum/_version.py
|
||||||
|
|
||||||
# PyInstaller
|
# PyInstaller
|
||||||
# Usually these files are written by a python script from a template
|
# Usually these files are written by a python script from a template
|
||||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
@@ -72,8 +75,9 @@ target/
|
|||||||
# Jupyter Notebook
|
# Jupyter Notebook
|
||||||
.ipynb_checkpoints
|
.ipynb_checkpoints
|
||||||
|
|
||||||
# pyenv
|
# uv
|
||||||
.python-version
|
.python-version
|
||||||
|
uv.lock
|
||||||
|
|
||||||
# celery beat schedule file
|
# celery beat schedule file
|
||||||
celerybeat-schedule
|
celerybeat-schedule
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
version = "master"
|
|
||||||
36
pyproject.toml
Normal file
36
pyproject.toml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["setuptools>=64", "setuptools_scm>=8"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "cura-te-ipsum"
|
||||||
|
dynamic = ["version"]
|
||||||
|
description = "Backup utility"
|
||||||
|
authors = [
|
||||||
|
{name = "Maks Snegov", email = "snegov@spqr.link"}
|
||||||
|
]
|
||||||
|
readme = "README.md"
|
||||||
|
requires-python = ">=3.6"
|
||||||
|
classifiers = [
|
||||||
|
"Development Status :: 2 - Pre-Alpha",
|
||||||
|
"Intended Audience :: Developers",
|
||||||
|
"Intended Audience :: System Administrators",
|
||||||
|
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
||||||
|
"Operating System :: OS Independent",
|
||||||
|
"Programming Language :: Python :: 3",
|
||||||
|
"Topic :: System :: Archiving :: Backup",
|
||||||
|
]
|
||||||
|
|
||||||
|
[project.urls]
|
||||||
|
Homepage = "https://github.com/snegov/cura-te-ipsum"
|
||||||
|
"Bug Tracker" = "https://github.com/snegov/cura-te-ipsum/issues"
|
||||||
|
GitHub = "https://github.com/snegov/cura-te-ipsum"
|
||||||
|
|
||||||
|
[project.scripts]
|
||||||
|
cura-te-ipsum = "curateipsum.cli:main"
|
||||||
|
|
||||||
|
[tool.setuptools]
|
||||||
|
packages = ["curateipsum"]
|
||||||
|
|
||||||
|
[tool.setuptools_scm]
|
||||||
|
version_file = "curateipsum/_version.py"
|
||||||
51
setup.py
51
setup.py
@@ -1,48 +1,5 @@
|
|||||||
import setuptools
|
# Minimal setup.py for backwards compatibility
|
||||||
import subprocess
|
# All configuration is in pyproject.toml
|
||||||
|
from setuptools import setup
|
||||||
|
|
||||||
|
setup()
|
||||||
def get_version_from_vcs():
|
|
||||||
ret_code, git_ver = subprocess.getstatusoutput("git describe")
|
|
||||||
if ret_code != 0:
|
|
||||||
from curateipsum._version import version
|
|
||||||
return version
|
|
||||||
|
|
||||||
with open("curateipsum/_version.py", "w") as fd:
|
|
||||||
fd.write("version = \"%s\"\n" % git_ver)
|
|
||||||
return git_ver
|
|
||||||
|
|
||||||
|
|
||||||
with open("README.md", "r", encoding="utf-8") as fh:
|
|
||||||
long_description = fh.read()
|
|
||||||
|
|
||||||
setuptools.setup(
|
|
||||||
name="cura-te-ipsum",
|
|
||||||
version=get_version_from_vcs(),
|
|
||||||
author="Maks Snegov",
|
|
||||||
author_email="snegov@spqr.link",
|
|
||||||
url="https://github.com/snegov/cura-te-ipsum",
|
|
||||||
description="Backup utility",
|
|
||||||
long_description=long_description,
|
|
||||||
long_description_content_type="text/markdown",
|
|
||||||
project_urls={
|
|
||||||
"Bug Tracker": "https://github.com/snegov/cura-te-ipsum/issues",
|
|
||||||
"GitHub": "https://github.com/snegov/cura-te-ipsum",
|
|
||||||
},
|
|
||||||
classifiers=[
|
|
||||||
"Development Status :: 2 - Pre-Alpha",
|
|
||||||
"Intended Audience :: Developers",
|
|
||||||
"Intended Audience :: System Administrators",
|
|
||||||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
|
||||||
"Operating System :: OS Independent",
|
|
||||||
"Programming Language :: Python :: 3",
|
|
||||||
"Topic :: System :: Archiving :: Backup",
|
|
||||||
],
|
|
||||||
packages=setuptools.find_packages(include=["curateipsum"]),
|
|
||||||
entry_points={
|
|
||||||
"console_scripts": [
|
|
||||||
"cura-te-ipsum = curateipsum.cli:main",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
python_requires=">=3.6",
|
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user