Skip to content

Commit c7dfecd

Browse files
committed
chore: migrate from setup.py to pyproject.toml
Modernize build system to use pyproject.toml as the single source of truth for package metadata and version. Replace custom build scripts with pk3 CLI commands. Changes: - Add `pyproject.toml` with static version and metadata - Remove `setup.py` and `_building/build_setup.py` - Remove `_building/install.sh` and `_building/publish.sh` - Update `_building/common.mk` to use `pk3 tag` and `pk3 publish` - Use `importlib.metadata` in `__init__.py` for runtime version
1 parent c963c79 commit c7dfecd

7 files changed

Lines changed: 63 additions & 249 deletions

File tree

__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
1212
"""
1313

14-
__version__ = "0.1.14"
14+
from importlib.metadata import version
15+
16+
__version__ = version("k3git")
1517
__name__ = "k3git"
1618

1719
from .gitopt import GitOpt

_building/build_setup.py

Lines changed: 0 additions & 190 deletions
This file was deleted.

_building/common.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ static_check:
2323
readme:
2424
python _building/build_readme.py
2525

26-
build_setup_py:
27-
PYTHONPATH="$$(cd ..; pwd)" python _building/build_setup.py
26+
release:
27+
pk3 tag
2828

2929
publish:
30-
./_building/publish.sh
30+
pk3 publish
3131

3232
install:
33-
./_building/install.sh
33+
pip install -e .

_building/install.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

_building/publish.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

pyproject.toml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "k3git"
7+
version = "0.1.14"
8+
description = "wrapper of git command-line"
9+
readme = "README.md"
10+
license = {text = "MIT"}
11+
requires-python = ">=3.6"
12+
authors = [
13+
{ name = "Zhang Yanpo", email = "drdr.xp@gmail.com" }
14+
]
15+
keywords = ["git", "cli", "commandline"]
16+
classifiers = [
17+
"Development Status :: 4 - Beta",
18+
"Intended Audience :: Developers",
19+
"Topic :: Software Development :: Libraries",
20+
"License :: OSI Approved :: MIT License",
21+
"Programming Language :: Python :: 3",
22+
"Programming Language :: Python :: 3.6",
23+
"Programming Language :: Python :: 3.7",
24+
"Programming Language :: Python :: 3.8",
25+
"Programming Language :: Python :: Implementation :: PyPy",
26+
]
27+
dependencies = [
28+
"k3str>=0.1.1,<0.2",
29+
"k3ut>=0.1.7,<0.2",
30+
"k3handy>=0.1.7,<0.2",
31+
"k3fs>=0.1.5,<0.2",
32+
]
33+
34+
[project.urls]
35+
Homepage = "https://github.com/pykit3/k3git"
36+
Documentation = "https://k3git.readthedocs.io"
37+
38+
[project.optional-dependencies]
39+
dev = [
40+
"pytest>=7.0",
41+
"ruff",
42+
]
43+
publish = [
44+
"build",
45+
"twine",
46+
"pk3",
47+
]
48+
49+
[tool.setuptools]
50+
packages = ["k3git"]
51+
52+
[tool.setuptools.package-dir]
53+
k3git = "."
54+
55+
[tool.ruff]
56+
line-length = 120

setup.py

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)