Skip to content

Commit 7eff5bb

Browse files
committed
adding bump-version.py script
1 parent 9700307 commit 7eff5bb

File tree

4 files changed

+71
-21
lines changed

4 files changed

+71
-21
lines changed

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- main
88

99
jobs:
10-
docs:
10+
deploy:
1111
runs-on: ubuntu-24.04
1212
steps:
1313
- uses: actions/checkout@v4
@@ -38,4 +38,4 @@ jobs:
3838
env:
3939
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
4040
run: |
41-
uv publish -t "$PYPI_TOKEN" --managed-python
41+
uv publish -t "$PYPI_TOKEN" --managed-python --check-url https://pypi.org/simple

bin/bump-version.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env python3
2+
import tomllib
3+
import subprocess
4+
5+
import tomli_w
6+
7+
8+
def bump_version(version: str) -> str:
9+
splitted_version = version.split(".")
10+
bumped_version = int(splitted_version[-1]) + 1
11+
splitted_version[-1] = str(bumped_version)
12+
return ".".join(splitted_version)
13+
14+
15+
def main() -> None:
16+
with open("uv.lock", "rb") as fd:
17+
data = tomllib.load(fd)
18+
19+
package = next(p for p in data["package"] if p["name"] == "edit-python-pe")
20+
21+
version = bump_version(package["version"])
22+
23+
package["version"] = version
24+
25+
with open("uv.lock", "wb") as fd:
26+
tomli_w.dump(data, fd)
27+
28+
with open("pyproject.toml", "rb") as fd:
29+
data = tomllib.load(fd)
30+
31+
data["project"]["version"] = package["version"]
32+
33+
with open("pyproject.toml", "wb") as fd:
34+
tomli_w.dump(data, fd)
35+
36+
subprocess.run(["git", "add", "uv.lock"])
37+
subprocess.run(["git", "add", "pyproject.toml"])
38+
subprocess.run(["git", "commit", "-m", f"bump version to {version}"])
39+
40+
41+
if __name__ == "__main__":
42+
main()

pyproject.toml

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,16 @@ name = "edit-python-pe"
33
version = "0.2.1"
44
description = "Allows member and project profile editing onto python.pe git repository"
55
readme = "README.md"
6-
license = { file = "LICENSE" }
76
authors = [
8-
{ name = "Jean-Pierre Chauvel", email = "jean.p.chauvel@gmail.com" }
7+
{ name = "Jean-Pierre Chauvel", email = "jean.p.chauvel@gmail.com" },
98
]
109
requires-python = ">=3.13"
1110
classifiers = [
12-
# How mature is this project? Common values are
13-
# 3 - Alpha
14-
# 4 - Beta
15-
# 5 - Production/Stable
16-
"Development Status :: 4 - Beta",
17-
18-
# Indicate who your project is intended for
19-
"Intended Audience :: Developers",
20-
"Topic :: Documentation :: Sphinx",
21-
22-
# Specify the Python versions you support here.
23-
"Programming Language :: Python :: 3",
24-
"Programming Language :: Python :: 3.13",
11+
"Development Status :: 4 - Beta",
12+
"Intended Audience :: Developers",
13+
"Topic :: Documentation :: Sphinx",
14+
"Programming Language :: Python :: 3",
15+
"Programming Language :: Python :: 3.13",
2516
]
2617
module = "edit_python_pe"
2718
dependencies = [
@@ -33,6 +24,9 @@ dependencies = [
3324
"babel==2.17.0",
3425
]
3526

27+
[project.license]
28+
file = "LICENSE"
29+
3630
[project.urls]
3731
Homepage = "http://github.com/pythonpe/edit-python.pe"
3832
Documentation = "https://github.com/pythonpe/edit-python.pe/blob/main/README.md"
@@ -43,12 +37,17 @@ Issues = "https://github.com/pythonpe/edit-python.pe/issues"
4337
edit-python-pe = "edit_python_pe.main:main"
4438

4539
[build-system]
46-
requires = ["hatchling"]
40+
requires = [
41+
"hatchling",
42+
]
4743
build-backend = "hatchling.build"
4844

4945
[tool.hatch.version]
5046
path = "src/edit_python_pe/__about__.py"
5147

48+
[tool.black]
49+
line-length = 79
50+
5251
[dependency-groups]
5352
dev = [
5453
"black>=25.1.0",
@@ -58,7 +57,5 @@ dev = [
5857
"pytest>=8.4.1",
5958
"pytest-cov>=6.2.1",
6059
"textual-dev==1.7.0",
60+
"tomli-w>=1.2.0",
6161
]
62-
63-
[tool.black]
64-
line-length = 79

uv.lock

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)