-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathpyproject.toml
More file actions
177 lines (158 loc) · 5.19 KB
/
Copy pathpyproject.toml
File metadata and controls
177 lines (158 loc) · 5.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
[project]
name = "protovalidate"
version = "2.0.0"
description = "Protocol Buffer Validation for Python"
readme = "README.md"
requires-python = ">=3.10"
license = "Apache-2.0"
license-files = ["LICENSE"]
keywords = ["protobuf", "protocol buffer", "validate"]
classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Typing :: Typed",
]
dependencies = [
"cel-python>=0.5",
"google-re2>=1",
# We need at least this version, which started publishing wheels for Python 3.13.
# Ref: https://github.com/google/re2/issues/516
"google-re2>=1.1.20250722; python_version == '3.13'",
# We need at least this version, which started publishing wheels for Python 3.14.
# Ref: https://github.com/google/re2/issues/580
"google-re2>=1.1.20251105; python_version == '3.14'",
# 1.1 started supporting 3.12.
"google-re2>=1.1; python_version == '3.12'",
"protobuf-py>=0.2.0",
]
[project.urls]
Documentation = "https://protovalidate.com"
Homepage = "https://github.com/bufbuild/protovalidate-python"
Issues = "https://github.com/bufbuild/protovalidate-python/issues"
Source = "https://github.com/bufbuild/protovalidate-python"
# cel-expr has limited wheel support and no sdist for on-the-fly installation, so
# we can't add it as a primary dependency. Users can opt-in if their platform supports it.
[project.optional-dependencies]
cel-expr = [
"cel-expr-python>=0.1.3; python_version >= '3.11'",
"protobuf>=6.31.0; python_version >= '3.11'",
]
[dependency-groups]
# We ensure all dependencies are installed by default so IDE works properly for development.
dev = [
{ include-group = "dev-optional" },
{ include-group = "dev-required" },
]
# All dependencies required for CI and development, including running baseline tests.
dev-required = [
"buf-bin==1.71.0",
"fix-protobuf-imports==0.1.7",
"google-re2-stubs==0.1.1",
"license-header==0.0.1",
"poethepoet==0.48.0",
"pytest==9.1.1",
"pytest-benchmark==5.2.3",
"ruff==0.15.21",
"tombi==1.2.0",
"ty==0.0.59",
"types-protobuf==6.32.1.20260221",
]
# Optional dependencies, used for development of optional features. We run tests without
# these installed to ensure missing optional dependencies does not introduce breakage.
# Unlike most dev dependencies, we don't pin to allow testing old and new
# versions. Floored at 6.31.0 required by the cel-expr-python backend.
dev-optional = [
"cel-expr-python>=0.1.3; python_version >= '3.11'",
"protobuf>=6.31.0",
]
[build-system]
requires = ["uv_build>=0.11.2,<0.12"]
build-backend = "uv_build"
## License headers
[tool.licenseheader]
copyright-holder = "Buf Technologies, Inc."
year-range = "2023-2026"
ignore = [
".github",
"buf.yaml",
"buf.gen.yaml",
"test/conformance/nonconforming.yaml",
]
[tool.pytest]
addopts = [
"--benchmark-disable",
"--benchmark-group-by=func,param:_id",
]
# Turn all warnings into errors,
# except DeprecationWarnings (which we knowingly tolerate due to using old `protobuf` APIs).
filterwarnings = ["error", "ignore::DeprecationWarning"]
strict = true
# restrict testpaths to speed up test discovery
testpaths = ["test"]
[tool.ruff]
target-version = "py310"
exclude = ["*_pb2.py", "*_pb2.pyi"]
[tool.ruff.format]
skip-magic-trailing-comma = true
docstring-code-format = true
[tool.ruff.lint]
typing-extensions = false
select = ["ALL"]
ignore = [
# Rules recommended to ignore when using ruff formatting
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
"W191",
"E111",
"E114",
"E117",
"E501",
"D206",
"D300",
"Q",
"COM812",
"COM819",
"TRY003", # Avoid specifying long messages outside the exception class
"SLF001", # Private member accessed
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
"PLR2004", # Magic value used in comparison - not helpful to name obvious constants
# Complexity rules: humans reviewing code can judge whether complexity is justified.
"C901", # McCabe complexity
"PLR0911", # Too many return statements
"PLR0912", # Too many branches
"PLR0913", # Too many arguments in function definition
"PLR0914", # Too many local variables
"PLR0915", # Too many statements
"PLR0916", # Too many boolean expressions
"PLR1702", # Too many nested blocks
# TODO rules
"TD",
"FIX002", # Line contains TODO, consider resolving the issue
]
[tool.ruff.lint.per-file-ignores]
"**/test/**/*.py" = [
# missing docstrings; unnecessary in tests.
"D1",
"INP001", # File is part of an implicit namespace package
"FBT001", # boolean positional args are fine in tests
"FBT002", # boolean default positional args are fine in tests
"FBT003", # boolean positional values are fine in tests
"S101", # assert is expected in tests
]
"**/scripts/*.py" = [
# missing docstrings; unnecessary in scripts.
"D1",
]
[tool.ruff.lint.isort]
required-imports = ["from __future__ import annotations"]
combine-as-imports = true
known-third-party = []
split-on-trailing-comma = false
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.uv.build-backend]
module-name = "protovalidate"
module-root = ""