-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
301 lines (269 loc) · 7.69 KB
/
Copy pathpyproject.toml
File metadata and controls
301 lines (269 loc) · 7.69 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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
[project]
name = "fastapi-request-context"
version = "1.4.0"
description = "FastAPI middleware for request ID tracking, correlation IDs, and extensible request context with logging integration"
authors = [
{name = "Adrian Dankiv", email = "adr-007@ukr.net"}
]
license = {text = "MIT"}
readme = "README.md"
keywords = ["fastapi", "request-id", "correlation-id", "request-context", "middleware", "logging", "tracing"]
classifiers = [
"Development Status :: 4 - Beta",
"Framework :: FastAPI",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed",
]
requires-python = ">=3.12"
dependencies = [
"fastapi>=0.100.0",
]
[project.optional-dependencies]
context-logging = ["context-logging>=0.7.0"]
json-formatter = ["python-json-logger>=2.0.0"]
taskiq = ["taskiq>=0.11.0"]
build = ["uv>=0.9.0"]
all = [
"context-logging>=0.7.0",
"python-json-logger>=2.0.0",
"taskiq>=0.11.0",
]
[project.urls]
Homepage = "https://github.com/ADR-007/fastapi-request-context"
Repository = "https://github.com/ADR-007/fastapi-request-context"
Issues = "https://github.com/ADR-007/fastapi-request-context/issues"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.sdist]
exclude = [
".githooks",
".github",
"tests",
"examples",
"reports",
]
[tool.hatch.build.targets.wheel]
packages = ["fastapi_request_context"]
[dependency-groups]
dev = [
"ruff>=0.3.5",
"mypy>=1.9.0",
"pytest>=8.1.1",
"pytest-asyncio>=0.23.0",
"coverage>=7.4.4",
"tox>=4.14.2",
"tox-uv>=1.0.0",
"context-logging>=0.7.0",
"python-json-logger>=2.0.0",
"httpx>=0.27.0",
"taskiq>=0.11.0",
]
[tool.tox]
legacy_tox_ini = """
[tox]
min_version = 4.0
env_list =
lint
py{312,313}
coverage
[gh-actions]
python =
3.13: lint, py313, coverage
3.12: py312
[testenv]
runner = uv-venv-lock-runner
extras = all
commands =
coverage run -m pytest tests/
coverage html -d ./reports/htmlcov --omit="tests/*"
coverage xml -o ./reports/coverage.xml --omit="tests/*"
coverage report --skip-empty --fail-under 90
[testenv:lint]
runner = uv-venv-lock-runner
commands =
ruff check fastapi_request_context tests/ examples/
ruff format --check fastapi_request_context tests/ examples/
mypy fastapi_request_context tests/
[testenv:coverage]
runner = uv-venv-lock-runner
extras = all
commands =
coverage run -m pytest tests/
coverage html -d ./reports/htmlcov --omit="tests/*"
coverage xml -o ./reports/coverage.xml --omit="tests/*"
coverage report --skip-empty --fail-under 100
"""
[tool.semantic_release]
version_toml = [
"pyproject.toml:project.version",
]
assets = []
build_command = """
python -m pip install -e '.[build]'
uv lock --upgrade-package "$PACKAGE_NAME"
git add uv.lock
uv build
"""
commit_message = "{version}\n\nAutomatically generated by python-semantic-release"
commit_parser = "conventional"
logging_use_named_masks = false
major_on_zero = true
tag_format = "v{version}"
[tool.semantic_release.branches.main]
match = "(main|master)"
prerelease_token = "rc"
prerelease = false
[tool.semantic_release.changelog]
exclude_commit_patterns = []
[tool.semantic_release.changelog.default_templates]
changelog_file = "CHANGELOG.md"
[tool.semantic_release.changelog.environment]
block_start_string = "{%"
block_end_string = "%}"
variable_start_string = "{{"
variable_end_string = "}}"
comment_start_string = "{#"
comment_end_string = "#}"
trim_blocks = false
lstrip_blocks = false
newline_sequence = "\n"
keep_trailing_newline = false
extensions = []
autoescape = true
[tool.semantic_release.commit_author]
env = "GIT_COMMIT_AUTHOR"
default = "semantic-release <semantic-release>"
[tool.semantic_release.commit_parser_options]
allowed_tags = ["build", "chore", "ci", "docs", "feat", "fix", "perf", "style", "refactor", "test"]
minor_tags = ["feat"]
patch_tags = ["fix", "perf", "build", "docs"]
[tool.semantic_release.remote]
name = "origin"
type = "github"
ignore_token_for_push = false
[tool.semantic_release.publish]
dist_glob_patterns = ["dist/*"]
upload_to_vcs_release = true
[tool.mypy]
python_version = "3.12"
strict = true
warn_return_any = true
warn_unused_configs = true
[[tool.mypy.overrides]]
module = "tests.*"
disable_error_code = [
"call-arg",
"unused-ignore",
"misc",
]
[[tool.mypy.overrides]]
module = "context_logging.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "pythonjsonlogger.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "taskiq.*"
ignore_missing_imports = true
[tool.ruff]
target-version = "py312"
line-length = 100
[tool.ruff.lint]
select = [
"F", # Pyflakes
"E", "W", # pycodestyle
"C90", # mccabe
"I", # isort
"N", # pep8-naming
"D", # pydocstyle
"UP", # pyupgrade
"YTT", # flake8-2020
"ANN", # flake8-annotations
"ASYNC", # flake8-async
"S", # flake8-bandit
"BLE", # flake8-blind-except
"B", # flake8-bugbear
"A", # flake8-builtins
"COM", # flake8-commas
"C4", # flake8-comprehensions
"DTZ", # flake8-datetimez
"T10", # flake8-debugger
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
"INP", # flake8-no-pep420
"PIE", # flake8-pie
"T20", # flake8-print
"PYI", # flake8-pyi
"PT", # flake8-pytest-style
"RSE", # flake8-raise
"RET", # flake8-return
"SLF", # flake8-self
"SLOT", # flake8-slots
"SIM", # flake8-simplify
"TID", # flake8-tidy-imports
"TCH", # flake8-type-checking
"INT", # flake8-gettext
"ARG", # flake8-unused-arguments
"PTH", # flake8-use-pathlib
"ERA", # eradicate
"PGH", # pygrep-hooks
"PL", # Pylint
"TRY", # tryceratops
"FLY", # flynt
"PERF", # Perflint
"RUF", # Ruff-specific rules
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = [
"S101", # Allow assert in tests
"S103", # Allow os.chmod
"D100", "D101", "D102", "D103", # Allow missing docstrings in tests
"ANN102", # Missing type annotation for cls
"ANN401", # Allow Any type in fixtures
"TRY003", # Allow long exception messages
"TRY301", # Allow raise in try blocks (needed for exception tests)
"PLR2004", # Allow magic values
"PLC0415", # Allow imports not at top level (for test isolation)
"ARG001", "ARG002", # Allow unused function arguments (fixtures)
"SLF001", # Allow private member access
]
"examples/**/*.py" = [
"T201", # Allow print in examples
"D100", "D103", # Allow missing docstrings in examples
"INP001", # Allow missing __init__.py in examples
"ARG001", # Allow unused function arguments
"PLC0415", # Allow imports not at top level
"ANN401", # Allow Any type
]
[tool.pytest.ini_options]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
testpaths = ["tests"]
[tool.coverage.run]
source = ["fastapi_request_context"]
branch = true
[tool.coverage.report]
fail_under = 100
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"@abstractmethod",
"raise NotImplementedError",
"\\.\\.\\.", # Protocol method stubs
"class.*\\(Protocol\\):",
]
exclude_also = [
"def __repr__",
"@(abc\\.)?abstractmethod",
]