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.
Files changed (38) hide show
  1. {fastapi_commons-0.4.2/src/fastapi_commons.egg-info → fastapi_commons-0.4.4}/PKG-INFO +2 -2
  2. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/pyproject.toml +1 -1
  3. fastapi_commons-0.4.4/src/fastapi_commons/log/filters.py +28 -0
  4. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4/src/fastapi_commons.egg-info}/PKG-INFO +2 -2
  5. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons.egg-info/SOURCES.txt +2 -0
  6. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons.egg-info/requires.txt +1 -1
  7. fastapi_commons-0.4.4/tests/unit/__init__.py +0 -0
  8. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/uv.lock +16 -15
  9. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/.coveragerc +0 -0
  10. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/.env_template +0 -0
  11. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/.github/workflows/checks.yml +0 -0
  12. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/.github/workflows/python-publish.yaml +0 -0
  13. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/.github/workflows/release-on-tag-push.yml +0 -0
  14. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/.gitignore +0 -0
  15. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/.pre-commit-config.yaml +0 -0
  16. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/.python-version +0 -0
  17. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/AUTHORS.rst +0 -0
  18. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/CHANGELOG.rst +0 -0
  19. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/LICENSE +0 -0
  20. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/README.md +0 -0
  21. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/README.rst +0 -0
  22. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/setup.cfg +0 -0
  23. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons/__init__.py +0 -0
  24. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons/auth.py +0 -0
  25. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons/conf.py +0 -0
  26. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons/handlers.py +0 -0
  27. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons/helpers.py +0 -0
  28. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons/instrumentation.py +0 -0
  29. {fastapi_commons-0.4.2/src/fastapi_commons/middleware → fastapi_commons-0.4.4/src/fastapi_commons/log}/__init__.py +0 -0
  30. {fastapi_commons-0.4.2/tests → fastapi_commons-0.4.4/src/fastapi_commons/middleware}/__init__.py +0 -0
  31. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons/middleware/correlation_id.py +0 -0
  32. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons/middleware/log_context.py +0 -0
  33. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons/middleware/prometheus.py +0 -0
  34. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons.egg-info/dependency_links.txt +0 -0
  35. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/src/fastapi_commons.egg-info/top_level.txt +0 -0
  36. {fastapi_commons-0.4.2/tests/unit → fastapi_commons-0.4.4/tests}/__init__.py +0 -0
  37. {fastapi_commons-0.4.2 → fastapi_commons-0.4.4}/tests/conftest.py +0 -0
  38. {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.2
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.4
29
+ Requires-Dist: python3-commons~=0.16.6
30
30
  Dynamic: license-file
31
31
 
32
32
  FastAPI commons
@@ -32,7 +32,7 @@ dependencies = [
32
32
  "opentelemetry-instrumentation-fastapi~=0.60b1",
33
33
  "opentelemetry-instrumentation-logging~=0.60b1",
34
34
  "prometheus-client~=0.25.0",
35
- "python3-commons~=0.16.4",
35
+ "python3-commons~=0.16.6",
36
36
  ]
37
37
 
38
38
  [dependency-groups]
@@ -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.2
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.4
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
@@ -12,4 +12,4 @@ opentelemetry-exporter-otlp~=1.41.0
12
12
  opentelemetry-instrumentation-fastapi~=0.60b1
13
13
  opentelemetry-instrumentation-logging~=0.60b1
14
14
  prometheus-client~=0.25.0
15
- python3-commons~=0.16.4
15
+ python3-commons~=0.16.6
File without changes
@@ -247,25 +247,25 @@ wheels = [
247
247
 
248
248
  [[package]]
249
249
  name = "build"
250
- version = "1.4.3"
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/3f/16/4b272700dea44c1d2e8ca963ebb3c684efe22b3eba8cfa31c5fdb60de707/build-1.4.3.tar.gz", hash = "sha256:5aa4231ae0e807efdf1fd0623e07366eca2ab215921345a2e38acdd5d0fa0a74", size = 89314, upload-time = "2026-04-10T21:25:40.857Z" }
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/b2/30/f169e1d8b2071beaf8b97088787e30662b1d8fb82f8c0941d14678c0cbf1/build-1.4.3-py3-none-any.whl", hash = "sha256:1bc22b19b383303de8f2c8554c9a32894a58d3f185fe3756b0b20d255bee9a38", size = 26171, upload-time = "2026-04-10T21:25:39.671Z" },
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.2.25"
264
+ version = "2026.4.22"
265
265
  source = { registry = "https://pypi.org/simple" }
266
- sdist = { url = "https://files.pythonhosted.org/packages/af/2d/7bf41579a8986e348fa033a31cdd0e4121114f6bce2457e8876010b092dd/certifi-2026.2.25.tar.gz", hash = "sha256:e887ab5cee78ea814d3472169153c2d12cd43b14bd03329a39a9c6e2e80bfba7", size = 155029, upload-time = "2026-02-25T02:54:17.342Z" }
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/9a/3c/c17fb3ca2d9c3acff52e30b309f538586f9f5b9c9cf454f3845fc9af4881/certifi-2026.2.25-py3-none-any.whl", hash = "sha256:027692e4402ad994f1c42e52a4997a9763c646b73e4096e4d5d6db8af1d6f0fa", size = 153684, upload-time = "2026-02-25T02:54:15.766Z" },
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.4" },
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.12"
656
+ version = "3.13"
657
657
  source = { registry = "https://pypi.org/simple" }
658
- sdist = { url = "https://files.pythonhosted.org/packages/22/12/2948fbe5513d062169bd91f7d7b1cd97bc8894f32946b71fa39f6e63ca0c/idna-3.12.tar.gz", hash = "sha256:724e9952cc9e2bd7550ea784adb098d837ab5267ef67a1ab9cf7846bdbdd8254", size = 194350, upload-time = "2026-04-21T13:32:48.916Z" }
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/53/b2/acc33950394b3becb2b664741a0c0889c7ef9f9ffbfa8d47eddb53a50abd/idna-3.12-py3-none-any.whl", hash = "sha256:60ffaa1858fac94c9c124728c24fcde8160f3fb4a7f79aa8cdd33a9d1af60a67", size = 68634, upload-time = "2026-04-21T13:32:47.403Z" },
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.4"
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/d8/cc/e74c9c8d7a469e00f5fcf6ac7af8cdd52afba5defe9251cadc87c7b6dc28/python3_commons-0.16.4-py3-none-any.whl", hash = "sha256:b0dfb364a77a0182c0c94a34eea98e264adae5b62484ba65353a47824fd9b185", size = 37938, upload-time = "2026-04-22T09:28:52.939Z" },
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.46.3"
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/89/24/a2eb353a6edac9a0303977c4cb048134959dd2a51b48a269dfc9dde00c8a/wheel-0.46.3.tar.gz", hash = "sha256:e3e79874b07d776c40bd6033f8ddf76a7dad46a7b8aa1b2787a83083519a1803", size = 60605, upload-time = "2026-01-22T12:39:49.136Z" }
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/22/b76d483683216dde3d67cba61fb2444be8d5be289bf628c13fc0fd90e5f9/wheel-0.46.3-py3-none-any.whl", hash = "sha256:4b399d56c9d9338230118d705d9737a2a468ccca63d5e813e2a4fc7815d8bc4d", size = 30557, upload-time = "2026-01-22T12:39:48.099Z" },
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