Skip to content

Commit 82a08b3

Browse files
Format pyproject.toml with tombi and add linting
Similar to connectrpc/connect-python#193.
1 parent 5875d73 commit 82a08b3

3 files changed

Lines changed: 59 additions & 31 deletions

File tree

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ format: install $(BIN)/buf $(BIN)/license-header ## Format code
6363
buf format --write .
6464
uv run -- ruff format protovalidate test
6565
uv run -- ruff check --fix protovalidate test
66+
uv run -- tombi format
6667

6768
.PHONY: test
6869
test: generate install $(TESTDATA_FILE) ## Run unit tests
@@ -78,6 +79,8 @@ lint: install $(BIN)/buf ## Lint code
7879
uv run -- ruff format --check --diff protovalidate test
7980
uv run -- mypy protovalidate
8081
uv run -- ruff check protovalidate test
82+
uv run -- tombi format --check
83+
uv run -- tombi lint
8184
uv lock --check
8285

8386
.PHONY: install

pyproject.toml

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,75 @@
1-
[build-system]
2-
requires = ["hatchling", "hatch-vcs"]
3-
build-backend = "hatchling.build"
4-
51
[project]
62
name = "protovalidate"
73
description = "Protocol Buffer Validation for Python"
84
readme = "README.md"
9-
license = "Apache-2.0"
10-
license-files = ["LICENSE"]
11-
keywords = ["validate", "protobuf", "protocol buffer"]
125
# Keep our minimum version synced with ./.python-version.
136
requires-python = ">=3.10"
7+
license = "Apache-2.0"
8+
license-files = ["LICENSE"]
9+
keywords = ["protobuf", "protocol buffer", "validate"]
1410
classifiers = [
11+
"Operating System :: OS Independent",
1512
"Programming Language :: Python :: 3.10",
1613
"Programming Language :: Python :: 3.11",
1714
"Programming Language :: Python :: 3.12",
1815
"Programming Language :: Python :: 3.13",
1916
"Programming Language :: Python :: 3.14",
20-
"Operating System :: OS Independent",
2117
"Typing :: Typed",
2218
]
23-
dynamic = ["version"]
2419
dependencies = [
25-
# We need at least this version, which fixed Python 3.14 compatibility (tp_new metaclass issue).
26-
# The fix was never backported to the 5.x series.
27-
# Ref: https://github.com/protocolbuffers/protobuf/pull/20594
28-
"protobuf>=6.31.0; python_version >= '3.14'",
29-
"protobuf>=5",
3020
"cel-python>=0.5",
31-
# We need at least this version, which started publishing wheels for Python 3.14.
32-
# Ref: https://github.com/google/re2/issues/580
33-
"google-re2>=1.1.20251105; python_version == '3.14'",
21+
"google-re2>=1",
3422
# We need at least this version, which started publishing wheels for Python 3.13.
3523
# Ref: https://github.com/google/re2/issues/516
3624
"google-re2>=1.1.20250722; python_version == '3.13'",
25+
# We need at least this version, which started publishing wheels for Python 3.14.
26+
# Ref: https://github.com/google/re2/issues/580
27+
"google-re2>=1.1.20251105; python_version == '3.14'",
3728
# 1.1 started supporting 3.12.
3829
"google-re2>=1.1; python_version == '3.12'",
39-
"google-re2>=1",
30+
"protobuf>=5",
31+
# We need at least this version, which fixed Python 3.14 compatibility (tp_new metaclass issue).
32+
# The fix was never backported to the 5.x series.
33+
# Ref: https://github.com/protocolbuffers/protobuf/pull/20594
34+
"protobuf>=6.31.0; python_version >= '3.14'",
4035
]
36+
dynamic = ["version"]
4137

4238
[project.urls]
39+
Documentation = "https://protovalidate.com"
4340
Homepage = "https://github.com/bufbuild/protovalidate-python"
44-
Source = "https://github.com/bufbuild/protovalidate-python"
4541
Issues = "https://github.com/bufbuild/protovalidate-python/issues"
46-
Documentation = "https://protovalidate.com"
42+
Source = "https://github.com/bufbuild/protovalidate-python"
4743

4844
[dependency-groups]
4945
dev = [
5046
"google-re2-stubs>=0.1.1",
5147
"mypy>=1.17.1",
5248
"pytest>=9.0.2",
5349
"ruff>=0.12.0",
50+
"tombi>=0.9.12",
5451
"types-protobuf>=5.29.1.20250315",
5552
]
5653

54+
[build-system]
55+
requires = ["hatch-vcs", "hatchling"]
56+
build-backend = "hatchling.build"
57+
5758
[tool.hatch.version]
5859
source = "vcs"
5960
raw-options = { fallback_version = "0.0.0" }
6061

62+
[tool.mypy]
63+
mypy_path = "gen"
64+
65+
[tool.pytest]
66+
# Turn all warnings into errors,
67+
# except DeprecationWarnings (which we knowingly tolerate due to using old `protobuf` APIs).
68+
filterwarnings = ["error", "ignore::DeprecationWarning"]
69+
strict = true
70+
# restrict testpaths to speed up test discovery
71+
testpaths = ["test"]
72+
6173
[tool.ruff]
6274
line-length = 120
6375
lint.select = [
@@ -107,16 +119,5 @@ ban-relative-imports = "all"
107119
# Tests can use assertions.
108120
"test/**/*" = ["S101"]
109121

110-
[tool.pytest]
111-
strict = true
112-
# restrict testpaths to speed up test discovery
113-
testpaths = ["test"]
114-
# Turn all warnings into errors,
115-
# except DeprecationWarnings (which we knowingly tolerate due to using old `protobuf` APIs).
116-
filterwarnings = ["error", "ignore::DeprecationWarning"]
117-
118-
[tool.mypy]
119-
mypy_path = "gen"
120-
121122
[tool.ty.environment]
122123
extra-paths = ["gen"]

uv.lock

Lines changed: 24 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)