Skip to content

Commit b3944de

Browse files
committed
Modernize release process with hatchling and dynamic versioning
Build System: - Replace setuptools/pbr with hatchling build backend - Add uv-dynamic-versioning for git tag-based versioning - Version now derived from git tags (e.g., v1.0.0 -> 1.0.0) - Remove hardcoded version from pyproject.toml CI/CD Workflows: - Add publish.yaml for PyPI trusted publishing (OIDC) - Add lint.yaml with pre-commit hooks - Rename test.yml to test.yaml, align with claude-bridge style - Remove obsolete Travis CI configuration Code Quality: - Add .pre-commit-config.yaml with ruff and standard hooks - Add pre-commit to dev dependencies Cleanup: - Remove setup.py, setup.cfg (replaced by pyproject.toml) - Remove requirements.txt, test-requirements.txt (deps in pyproject.toml) - Remove .travis.yml (replaced by GitHub Actions) - Update tox.ini to use inline dependencies - Update ChangeLog with 1.0.0 release notes To release: create a git tag (e.g., git tag v1.0.0) and push, then create a GitHub Release to trigger PyPI publishing.
1 parent 4757767 commit b3944de

14 files changed

Lines changed: 268 additions & 271 deletions

.github/workflows/lint.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.12"
20+
cache: pip
21+
22+
- name: Install dependencies
23+
run: pip install --upgrade pip && pip install ".[dev]"
24+
25+
- name: Run pre-commit
26+
uses: pre-commit/action@v3.0.1

.github/workflows/publish.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
pypi-publish:
10+
runs-on: ubuntu-latest
11+
environment: pypi
12+
permissions:
13+
id-token: write
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.12"
24+
25+
- name: Install uv
26+
uses: astral-sh/setup-uv@v5
27+
with:
28+
enable-cache: true
29+
30+
- name: Build package
31+
run: uv build
32+
33+
- name: Publish to PyPI
34+
run: uv publish dist/*

.github/workflows/test.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python-version: ["3.11", "3.12", "3.13"]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v5
29+
with:
30+
enable-cache: true
31+
32+
- name: Install dependencies
33+
run: uv sync --frozen --all-extras --dev
34+
35+
- name: Install package in editable mode
36+
run: uv pip install -e .
37+
38+
- name: Install test dependencies
39+
run: uv pip install stestr python-subunit
40+
41+
- name: Run tests
42+
run: uv run stestr run

.github/workflows/test.yml

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

.pre-commit-config.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.14.0
4+
hooks:
5+
- id: ruff
6+
args: [--fix]
7+
- id: ruff-format
8+
9+
- repo: https://github.com/pre-commit/pre-commit-hooks
10+
rev: v5.0.0
11+
hooks:
12+
- id: trailing-whitespace
13+
- id: end-of-file-fixer
14+
- id: check-yaml
15+
- id: check-added-large-files

.travis.yml

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

ChangeLog

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,43 @@
11
CHANGES
22
=======
33

4+
1.0.0
5+
-----
6+
7+
Breaking Changes:
8+
9+
* Drop support for Python 2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10
10+
* Minimum Python version is now 3.11
11+
* Remove six library dependency
12+
13+
Modernization:
14+
15+
* Migrate to modern Python 3.11+ patterns and syntax
16+
* Replace setuptools/pbr with hatchling build backend
17+
* Add uv-dynamic-versioning for git tag-based versioning
18+
* Replace pip/virtualenv workflow with UV package manager
19+
* Replace flake8/hacking with Ruff for linting and formatting
20+
* Replace Travis CI with GitHub Actions
21+
* Add PyPI trusted publishing workflow
22+
* Add pre-commit hooks for code quality
23+
* Migrate all dependencies to pyproject.toml
24+
* Remove legacy setup.py, setup.cfg, requirements.txt
25+
26+
Code Quality:
27+
28+
* Apply 100+ Ruff auto-fixes for code modernization
29+
* Replace @six.add_metaclass with native Python 3 metaclass syntax
30+
* Replace deprecated @abc.abstractproperty with @property + @abstractmethod
31+
* Replace unittest.mock instead of standalone mock package
32+
* Update all string formatting to modern patterns
33+
34+
Testing:
35+
36+
* Update test infrastructure for Python 3.11+
37+
* 96.7% test pass rate (178/184 tests)
38+
39+
New Features (from 0.1.1):
40+
441
* Add new 'gerrit project commit file-content show' command and API
542
* Add new 'gerrit project commit included-in' command and API
643
* Add new 'gerrit project commit show' command and API
@@ -14,10 +51,8 @@ CHANGES
1451
* Add new 'gerrit project tag list' command and API
1552
* Add 'status' field to 'gerrit account show' command
1653
* Add new 'gerrit account oauth show' command and API
17-
* Replace python 3.5 environment with 3.6
1854
* Add account status related commands and APIs
1955
* Change command name for fetching account state
20-
* Get rid of gerritclient side sorting procedure
2156

2257
0.1.0
2358
-----

pyproject.toml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "python-gerritclient"
3-
version = "1.0.0"
3+
dynamic = ["version"]
44
description = "CLI tool and Python API wrapper for Gerrit Code Review"
55
authors = [
66
{name = "Vitalii Kulanov", email = "vitaliy@kulanov.org.ua"}
@@ -158,15 +158,27 @@ Repository = "https://github.com/tivaliy/python-gerritclient"
158158
Issues = "https://github.com/tivaliy/python-gerritclient/issues"
159159

160160
[build-system]
161-
requires = ["setuptools>=61.0.0", "wheel"]
162-
build-backend = "setuptools.build_meta"
161+
requires = ["hatchling", "uv-dynamic-versioning>=0.8.2"]
162+
build-backend = "hatchling.build"
163+
164+
[tool.uv-dynamic-versioning]
165+
enable = true
166+
vcs = "git"
167+
style = "pep440"
168+
169+
[tool.hatch.version]
170+
source = "uv-dynamic-versioning"
171+
172+
[tool.hatch.build.targets.wheel]
173+
packages = ["gerritclient"]
163174

164175
[tool.uv]
165176
dev-dependencies = [
166177
"ruff>=0.14.0",
167178
"pytest>=8.0.0",
168179
"pytest-cov>=4.1.0",
169180
"mypy>=1.8.0",
181+
"pre-commit>=4.0.0",
170182
]
171183

172184
[tool.ruff]
@@ -194,7 +206,6 @@ ignore = [
194206
"N818", # exception naming (GerritClientException is established pattern)
195207
"B904", # exception chaining (would change error behavior)
196208
"F401", # unused imports in __init__.py (used for re-exports)
197-
"SIM105", # contextlib.suppress (setup.py compatibility)
198209
"UP015", # unnecessary open mode argument (explicit is better for test compatibility)
199210
]
200211

requirements.txt

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

0 commit comments

Comments
 (0)