Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
189 lines (170 loc) · 4.93 KB
/
Copy pathpyproject.toml
File metadata and controls
189 lines (170 loc) · 4.93 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
178
179
180
181
182
183
184
185
186
187
188
189
[project]
name = "grpc-server-kit"
dynamic = ["version"]
description = "Batteries-optional async gRPC server toolkit (app facade, builder, TLS, lifecycle, health, streaming-aware interceptors, observability)"
readme = "README.md"
requires-python = ">=3.12"
license = { file = "LICENSE" }
authors = [{ name = "Alex Shalaev", email = "shalaevad.alexey@gmail.com" }]
keywords = ["grpc", "grpcio", "async", "asyncio", "server", "microservices", "observability"]
classifiers = [
"Development Status :: 4 - Beta",
"Framework :: AsyncIO",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed",
]
dependencies = [
"grpcio>=1.78.0,<2.0.0",
]
[project.urls]
Repository = "https://github.com/bedrock-python/grpc-server-kit"
Documentation = "https://bedrock-python.github.io/grpc-server-kit/"
Changelog = "https://github.com/bedrock-python/grpc-server-kit/blob/master/CHANGELOG.md"
"Bug Tracker" = "https://github.com/bedrock-python/grpc-server-kit/issues"
[project.optional-dependencies]
reflection = [
"grpcio-reflection>=1.78.0,<2.0.0",
]
channelz = [
"grpcio-channelz>=1.78.0,<2.0.0",
]
settings = [
"pydantic>=2.0.0,<3.0",
]
health = [
"grpcio-health-checking>=1.78.0,<2.0.0",
]
postgres = [
"sqlalchemy[asyncio]>=2.0.0,<3.0.0",
]
redis = [
"redis>=5.0.0",
]
metrics = [
"prometheus-client>=0.15.0",
]
tracing = [
"opentelemetry-instrumentation-grpc>=0.40b0",
]
sentry = [
"sentry-sdk>=2.0.0",
]
dishka = [
"dishka>=1.4.0",
# dishka.integrations.grpcio imports google.protobuf at module level, but
# neither dishka nor grpcio declares protobuf — declare it here so the
# extra is installable in a clean environment.
"protobuf>=4.21",
]
all = [
"grpc-server-kit[reflection,channelz,settings,health,postgres,redis,metrics,tracing,sentry,dishka]",
]
[dependency-groups]
test = [
"pytest>=9.0.2",
"pytest-asyncio>=1.3.0",
"pytest-cov>=7.0.0",
"pytest-lazy-fixtures>=1.1.1",
"freezegun>=1.5.5",
]
docs = [
"zensical>=0.0.37",
"mkdocstrings-python>=2.0.3",
]
dev = [
"ruff>=0.15.1",
"mypy>=1.19.1",
"pre-commit>=4.5.1",
{ include-group = "test" },
]
[tool.uv]
link-mode = "copy"
[tool.hatch.version]
path = "grpc_server_kit/__version__.py"
[tool.hatch.build.targets.wheel]
packages = ["grpc_server_kit"]
[tool.hatch.build.targets.sdist]
include = ["/grpc_server_kit", "/README.md", "/LICENSE", "/CHANGELOG.md"]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.mypy]
python_version = "3.12"
files = ["grpc_server_kit"]
mypy_path = ["."]
plugins = ["pydantic.mypy"]
check_untyped_defs = true
disallow_untyped_defs = true
implicit_reexport = false
ignore_missing_imports = true
show_error_codes = true
warn_return_any = true
warn_unused_configs = true
warn_redundant_casts = true
warn_unreachable = true
[tool.ruff]
line-length = 120
target-version = "py312"
# The Markdown guides hold fragments -- a keyword argument on its own, a body
# without its def -- that read as code to a formatter and come out as
# something else. ruff 0.16 formats fenced Python in Markdown by default.
extend-exclude = ["*.md"]
[tool.ruff.lint]
select = ["F", "E", "W", "I", "B", "N", "S", "C4", "DTZ", "SIM", "TRY", "PERF", "RUF", "UP", "ANN", "T20", "PTH", "PLC", "PLE", "PLW"]
ignore = [
"TRY003", # long messages in raise: we prefer self-contained error messages
"ANN401", # Any in **kwargs passthroughs and duck-typed seams
]
[tool.ruff.lint.per-file-ignores]
# gRPC generated-API method names (Check/Watch) must keep their casing.
"grpc_server_kit/aio/health/servicer.py" = ["N802"]
"tests/**" = [
"S101", # asserts are the point of tests
"S104", # binding test servers to 0.0.0.0/[::]
"S105", # dummy secrets in fixtures
"S106", # dummy secrets in fixtures
"ANN401", # Any in test doubles
"PERF401", # append-in-async-for is the point when asserting partial streams
]
"examples/**/*.py" = ["ANN", "T20", "S", "DTZ"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
[tool.pytest.ini_options]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
testpaths = ["tests"]
pythonpath = ["."]
addopts = [
"-v",
"--strict-markers",
"--tb=short",
]
markers = [
"unit: mark a test as a unit test.",
"integration: mark a test as an integration test.",
]
[tool.coverage.run]
source = ["grpc_server_kit"]
omit = [
"tests/*",
"*/test_*.py",
"*/__version__.py",
]
[tool.coverage.report]
fail_under = 90
exclude_also = [
"pragma: no cover",
"if TYPE_CHECKING:",
"\\.\\.\\.",
"raise NotImplementedError",
"@(typing\\.)?overload",
]