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
|
||||
MANIFEST
|
||||
|
||||
# Version file generated by setuptools_scm
|
||||
curateipsum/_version.py
|
||||
|
||||
# PyInstaller
|
||||
# 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.
|
||||
@@ -72,8 +75,9 @@ target/
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# pyenv
|
||||
# uv
|
||||
.python-version
|
||||
uv.lock
|
||||
|
||||
# celery beat schedule file
|
||||
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
|
||||
import subprocess
|
||||
# Minimal setup.py for backwards compatibility
|
||||
# All configuration is in pyproject.toml
|
||||
from setuptools import 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",
|
||||
)
|
||||
setup()
|
||||
|
||||
Reference in New Issue
Block a user