fastapi-commons 0.4.2__tar.gz → 0.4.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fastapi_commons-0.4.2/src/fastapi_commons.egg-info → fastapi_commons-0.4.4}/PKG-INFO +2 -2
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/pyproject.toml +1 -1
- fastapi_commons-0.4.4/src/fastapi_commons/log/filters.py +28 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4/src/fastapi_commons.egg-info}/PKG-INFO +2 -2
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons.egg-info/SOURCES.txt +2 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons.egg-info/requires.txt +1 -1
- fastapi_commons-0.4.4/tests/unit/__init__.py +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/uv.lock +16 -15
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/.coveragerc +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/.env_template +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/.github/workflows/checks.yml +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/.github/workflows/python-publish.yaml +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/.github/workflows/release-on-tag-push.yml +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/.gitignore +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/.pre-commit-config.yaml +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/.python-version +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/AUTHORS.rst +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/CHANGELOG.rst +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/LICENSE +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/README.md +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/README.rst +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/setup.cfg +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons/__init__.py +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons/auth.py +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons/conf.py +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons/handlers.py +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons/helpers.py +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons/instrumentation.py +0 -0
- {fastapi_commons-0.4.2/src/fastapi_commons/middleware → fastapi_commons-0.4.4/src/fastapi_commons/log}/__init__.py +0 -0
- {fastapi_commons-0.4.2/tests → fastapi_commons-0.4.4/src/fastapi_commons/middleware}/__init__.py +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons/middleware/correlation_id.py +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons/middleware/log_context.py +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons/middleware/prometheus.py +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons.egg-info/dependency_links.txt +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons.egg-info/top_level.txt +0 -0
- {fastapi_commons-0.4.2/tests/unit → fastapi_commons-0.4.4/tests}/__init__.py +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/tests/conftest.py +0 -0
- {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/tests/unit/test_poc.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastapi-commons
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.4
|
|
4
4
|
Summary: Re-usable FastAPI code
|
|
5
5
|
Author-email: Oleg Korsak <kamikaze.is.waiting.you@gmail.com>
|
|
6
6
|
License-Expression: GPL-3.0
|
|
@@ -26,7 +26,7 @@ Requires-Dist: opentelemetry-exporter-otlp~=1.41.0
|
|
|
26
26
|
Requires-Dist: opentelemetry-instrumentation-fastapi~=0.60b1
|
|
27
27
|
Requires-Dist: opentelemetry-instrumentation-logging~=0.60b1
|
|
28
28
|
Requires-Dist: prometheus-client~=0.25.0
|
|
29
|
-
Requires-Dist: python3-commons~=0.16.
|
|
29
|
+
Requires-Dist: python3-commons~=0.16.6
|
|
30
30
|
Dynamic: license-file
|
|
31
31
|
|
|
32
32
|
FastAPI commons
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
from fastapi_commons.middleware.correlation_id import correlation_id_ctx
|
|
4
|
+
from fastapi_commons.middleware.log_context import log_context
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class LogContextFilter(logging.Filter):
|
|
8
|
+
def filter(self, record: logging.LogRecord) -> bool:
|
|
9
|
+
if not (context := log_context.get()):
|
|
10
|
+
log_context.set({})
|
|
11
|
+
else:
|
|
12
|
+
for key, value in context.items():
|
|
13
|
+
if value:
|
|
14
|
+
setattr(record, key, value)
|
|
15
|
+
|
|
16
|
+
return True
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class CorrelationIDFilter(logging.Filter):
|
|
20
|
+
def filter(self, record: logging.LogRecord) -> bool:
|
|
21
|
+
try:
|
|
22
|
+
correlation_id = correlation_id_ctx.get()
|
|
23
|
+
if correlation_id:
|
|
24
|
+
record.correlation_id = correlation_id
|
|
25
|
+
except LookupError:
|
|
26
|
+
pass
|
|
27
|
+
|
|
28
|
+
return True
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastapi-commons
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.4
|
|
4
4
|
Summary: Re-usable FastAPI code
|
|
5
5
|
Author-email: Oleg Korsak <kamikaze.is.waiting.you@gmail.com>
|
|
6
6
|
License-Expression: GPL-3.0
|
|
@@ -26,7 +26,7 @@ Requires-Dist: opentelemetry-exporter-otlp~=1.41.0
|
|
|
26
26
|
Requires-Dist: opentelemetry-instrumentation-fastapi~=0.60b1
|
|
27
27
|
Requires-Dist: opentelemetry-instrumentation-logging~=0.60b1
|
|
28
28
|
Requires-Dist: prometheus-client~=0.25.0
|
|
29
|
-
Requires-Dist: python3-commons~=0.16.
|
|
29
|
+
Requires-Dist: python3-commons~=0.16.6
|
|
30
30
|
Dynamic: license-file
|
|
31
31
|
|
|
32
32
|
FastAPI commons
|
|
@@ -24,6 +24,8 @@ src/fastapi_commons.egg-info/SOURCES.txt
|
|
|
24
24
|
src/fastapi_commons.egg-info/dependency_links.txt
|
|
25
25
|
src/fastapi_commons.egg-info/requires.txt
|
|
26
26
|
src/fastapi_commons.egg-info/top_level.txt
|
|
27
|
+
src/fastapi_commons/log/__init__.py
|
|
28
|
+
src/fastapi_commons/log/filters.py
|
|
27
29
|
src/fastapi_commons/middleware/__init__.py
|
|
28
30
|
src/fastapi_commons/middleware/correlation_id.py
|
|
29
31
|
src/fastapi_commons/middleware/log_context.py
|
|
File without changes
|
|
@@ -247,25 +247,25 @@ wheels = [
|
|
|
247
247
|
|
|
248
248
|
[[package]]
|
|
249
249
|
name = "build"
|
|
250
|
-
version = "1.4.
|
|
250
|
+
version = "1.4.4"
|
|
251
251
|
source = { registry = "https://pypi.org/simple" }
|
|
252
252
|
dependencies = [
|
|
253
253
|
{ name = "colorama", marker = "os_name == 'nt'" },
|
|
254
254
|
{ name = "packaging" },
|
|
255
255
|
{ name = "pyproject-hooks" },
|
|
256
256
|
]
|
|
257
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
257
|
+
sdist = { url = "https://files.pythonhosted.org/packages/02/ec/bf5ae0a7e5ab57abe8aabdd0759c971883895d1a20c49ae99f8146840c3c/build-1.4.4.tar.gz", hash = "sha256:f832ae053061f3fb524af812dc94b8b84bac6880cd587630e3b5d91a6a9c1703", size = 89220, upload-time = "2026-04-22T20:53:44.807Z" }
|
|
258
258
|
wheels = [
|
|
259
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
259
|
+
{ url = "https://files.pythonhosted.org/packages/fa/88/6764e7a109dd84294850741501145da90d13cdeac9d4e614929464a37420/build-1.4.4-py3-none-any.whl", hash = "sha256:8c3f48a6090b39edec1a273d2d57949aaf13723b01e02f9d518396887519f64d", size = 25921, upload-time = "2026-04-22T20:53:43.251Z" },
|
|
260
260
|
]
|
|
261
261
|
|
|
262
262
|
[[package]]
|
|
263
263
|
name = "certifi"
|
|
264
|
-
version = "2026.
|
|
264
|
+
version = "2026.4.22"
|
|
265
265
|
source = { registry = "https://pypi.org/simple" }
|
|
266
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
266
|
+
sdist = { url = "https://files.pythonhosted.org/packages/25/ee/6caf7a40c36a1220410afe15a1cc64993a1f864871f698c0f93acb72842a/certifi-2026.4.22.tar.gz", hash = "sha256:8d455352a37b71bf76a79caa83a3d6c25afee4a385d632127b6afb3963f1c580", size = 137077, upload-time = "2026-04-22T11:26:11.191Z" }
|
|
267
267
|
wheels = [
|
|
268
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
268
|
+
{ url = "https://files.pythonhosted.org/packages/22/30/7cd8fdcdfbc5b869528b079bfb76dcdf6056b1a2097a662e5e8c04f42965/certifi-2026.4.22-py3-none-any.whl", hash = "sha256:3cb2210c8f88ba2318d29b0388d1023c8492ff72ecdde4ebdaddbb13a31b1c4a", size = 135707, upload-time = "2026-04-22T11:26:09.372Z" },
|
|
269
269
|
]
|
|
270
270
|
|
|
271
271
|
[[package]]
|
|
@@ -511,7 +511,7 @@ requires-dist = [
|
|
|
511
511
|
{ name = "pydantic", extras = ["email"], specifier = "~=2.13.3" },
|
|
512
512
|
{ name = "pydantic-settings", specifier = "~=2.14.0" },
|
|
513
513
|
{ name = "python-jose", specifier = "~=3.5.0" },
|
|
514
|
-
{ name = "python3-commons", specifier = "~=0.16.
|
|
514
|
+
{ name = "python3-commons", specifier = "~=0.16.6" },
|
|
515
515
|
{ name = "sqlalchemy", extras = ["asyncio"], specifier = "~=2.0.49" },
|
|
516
516
|
]
|
|
517
517
|
|
|
@@ -653,11 +653,11 @@ wheels = [
|
|
|
653
653
|
|
|
654
654
|
[[package]]
|
|
655
655
|
name = "idna"
|
|
656
|
-
version = "3.
|
|
656
|
+
version = "3.13"
|
|
657
657
|
source = { registry = "https://pypi.org/simple" }
|
|
658
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
658
|
+
sdist = { url = "https://files.pythonhosted.org/packages/ce/cc/762dfb036166873f0059f3b7de4565e1b5bc3d6f28a414c13da27e442f99/idna-3.13.tar.gz", hash = "sha256:585ea8fe5d69b9181ec1afba340451fba6ba764af97026f92a91d4eef164a242", size = 194210, upload-time = "2026-04-22T16:42:42.314Z" }
|
|
659
659
|
wheels = [
|
|
660
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
660
|
+
{ url = "https://files.pythonhosted.org/packages/5d/13/ad7d7ca3808a898b4612b6fe93cde56b53f3034dcde235acb1f0e1df24c6/idna-3.13-py3-none-any.whl", hash = "sha256:892ea0cde124a99ce773decba204c5552b69c3c67ffd5f232eb7696135bc8bb3", size = 68629, upload-time = "2026-04-22T16:42:40.909Z" },
|
|
661
661
|
]
|
|
662
662
|
|
|
663
663
|
[[package]]
|
|
@@ -1411,7 +1411,7 @@ wheels = [
|
|
|
1411
1411
|
|
|
1412
1412
|
[[package]]
|
|
1413
1413
|
name = "python3-commons"
|
|
1414
|
-
version = "0.16.
|
|
1414
|
+
version = "0.16.6"
|
|
1415
1415
|
source = { registry = "https://pypi.org/simple" }
|
|
1416
1416
|
dependencies = [
|
|
1417
1417
|
{ name = "aiobotocore" },
|
|
@@ -1426,8 +1426,9 @@ dependencies = [
|
|
|
1426
1426
|
{ name = "valkey", extra = ["libvalkey"] },
|
|
1427
1427
|
{ name = "zeep" },
|
|
1428
1428
|
]
|
|
1429
|
+
sdist = { url = "https://files.pythonhosted.org/packages/3e/dc/39a2b6da7c14f317795ce1318455f75bb2434cab750b43b70f0f67ce3e3e/python3_commons-0.16.6.tar.gz", hash = "sha256:22eb9a7abdfeb5affa20611bc8aaff605b479095cca3f26b0d68f86feb078f05", size = 111818, upload-time = "2026-04-22T22:48:17.106Z" }
|
|
1429
1430
|
wheels = [
|
|
1430
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1431
|
+
{ url = "https://files.pythonhosted.org/packages/89/20/7d8d2fe66ec9dd79a74bc57a6ec9896377a8eeb84a37dd7426c38e0aff59/python3_commons-0.16.6-py3-none-any.whl", hash = "sha256:dfccdd06d202b712aac78502caad83679eb825f91470fac4b0dac1d3c0d838c1", size = 37938, upload-time = "2026-04-22T22:48:16.017Z" },
|
|
1431
1432
|
]
|
|
1432
1433
|
|
|
1433
1434
|
[[package]]
|
|
@@ -1673,14 +1674,14 @@ wheels = [
|
|
|
1673
1674
|
|
|
1674
1675
|
[[package]]
|
|
1675
1676
|
name = "wheel"
|
|
1676
|
-
version = "0.
|
|
1677
|
+
version = "0.47.0"
|
|
1677
1678
|
source = { registry = "https://pypi.org/simple" }
|
|
1678
1679
|
dependencies = [
|
|
1679
1680
|
{ name = "packaging" },
|
|
1680
1681
|
]
|
|
1681
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
1682
|
+
sdist = { url = "https://files.pythonhosted.org/packages/39/62/75f18a0f03b4219c456652c7780e4d749b929eb605c098ce3a5b6b6bc081/wheel-0.47.0.tar.gz", hash = "sha256:cc72bd1009ba0cf63922e28f94d9d83b920aa2bb28f798a31d0691b02fa3c9b3", size = 63854, upload-time = "2026-04-22T15:51:27.727Z" }
|
|
1682
1683
|
wheels = [
|
|
1683
|
-
{ url = "https://files.pythonhosted.org/packages/87/
|
|
1684
|
+
{ url = "https://files.pythonhosted.org/packages/87/1b/9e33c09813d65e248f7f773119148a612516a4bea93e9c6f545f78455b7c/wheel-0.47.0-py3-none-any.whl", hash = "sha256:212281cab4dff978f6cedd499cd893e1f620791ca6ff7107cf270781e587eced", size = 32218, upload-time = "2026-04-22T15:51:26.296Z" },
|
|
1684
1685
|
]
|
|
1685
1686
|
|
|
1686
1687
|
[[package]]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastapi_commons-0.4.2/tests → fastapi_commons-0.4.4/src/fastapi_commons/middleware}/__init__.py
RENAMED
|
File without changes
|
{fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons/middleware/correlation_id.py
RENAMED
|
File without changes
|
{fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons/middleware/log_context.py
RENAMED
|
File without changes
|
{fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons/middleware/prometheus.py
RENAMED
|
File without changes
|
{fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|