python3-commons 0.17.2__tar.gz → 0.17.3__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 (73) hide show
  1. {python3_commons-0.17.2/src/python3_commons.egg-info → python3_commons-0.17.3}/PKG-INFO +2 -2
  2. {python3_commons-0.17.2 → python3_commons-0.17.3}/pyproject.toml +1 -1
  3. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/api_client.py +11 -11
  4. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/cache.py +5 -5
  5. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/db/helpers.py +1 -1
  6. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/object_storage.py +14 -7
  7. {python3_commons-0.17.2 → python3_commons-0.17.3/src/python3_commons.egg-info}/PKG-INFO +2 -2
  8. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons.egg-info/requires.txt +1 -1
  9. {python3_commons-0.17.2 → python3_commons-0.17.3}/uv.lock +9 -9
  10. {python3_commons-0.17.2 → python3_commons-0.17.3}/.coveragerc +0 -0
  11. {python3_commons-0.17.2 → python3_commons-0.17.3}/.devcontainer/Dockerfile +0 -0
  12. {python3_commons-0.17.2 → python3_commons-0.17.3}/.devcontainer/devcontainer.json +0 -0
  13. {python3_commons-0.17.2 → python3_commons-0.17.3}/.devcontainer/docker-compose.yml +0 -0
  14. {python3_commons-0.17.2 → python3_commons-0.17.3}/.env_template +0 -0
  15. {python3_commons-0.17.2 → python3_commons-0.17.3}/.github/workflows/checks.yml +0 -0
  16. {python3_commons-0.17.2 → python3_commons-0.17.3}/.github/workflows/python-publish.yaml +0 -0
  17. {python3_commons-0.17.2 → python3_commons-0.17.3}/.github/workflows/release-on-tag-push.yml +0 -0
  18. {python3_commons-0.17.2 → python3_commons-0.17.3}/.gitignore +0 -0
  19. {python3_commons-0.17.2 → python3_commons-0.17.3}/.pre-commit-config.yaml +0 -0
  20. {python3_commons-0.17.2 → python3_commons-0.17.3}/.python-version +0 -0
  21. {python3_commons-0.17.2 → python3_commons-0.17.3}/AUTHORS.rst +0 -0
  22. {python3_commons-0.17.2 → python3_commons-0.17.3}/CHANGELOG.rst +0 -0
  23. {python3_commons-0.17.2 → python3_commons-0.17.3}/LICENSE +0 -0
  24. {python3_commons-0.17.2 → python3_commons-0.17.3}/README.md +0 -0
  25. {python3_commons-0.17.2 → python3_commons-0.17.3}/README.rst +0 -0
  26. {python3_commons-0.17.2 → python3_commons-0.17.3}/docs/Makefile +0 -0
  27. {python3_commons-0.17.2 → python3_commons-0.17.3}/docs/_static/.gitignore +0 -0
  28. {python3_commons-0.17.2 → python3_commons-0.17.3}/docs/authors.rst +0 -0
  29. {python3_commons-0.17.2 → python3_commons-0.17.3}/docs/changelog.rst +0 -0
  30. {python3_commons-0.17.2 → python3_commons-0.17.3}/docs/conf.py +0 -0
  31. {python3_commons-0.17.2 → python3_commons-0.17.3}/docs/index.rst +0 -0
  32. {python3_commons-0.17.2 → python3_commons-0.17.3}/docs/license.rst +0 -0
  33. {python3_commons-0.17.2 → python3_commons-0.17.3}/setup.cfg +0 -0
  34. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/__init__.py +0 -0
  35. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/async_functools.py +0 -0
  36. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/audit.py +0 -0
  37. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/auth.py +0 -0
  38. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/conf.py +0 -0
  39. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/db/__init__.py +0 -0
  40. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/db/models/__init__.py +0 -0
  41. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/db/models/auth.py +0 -0
  42. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/db/models/common.py +0 -0
  43. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/db/models/rbac.py +0 -0
  44. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/db/models/users.py +0 -0
  45. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/exceptions.py +0 -0
  46. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/fs.py +0 -0
  47. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/generators.py +0 -0
  48. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/helpers.py +0 -0
  49. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/log/__init__.py +0 -0
  50. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/log/filters.py +0 -0
  51. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/log/formatters.py +0 -0
  52. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/permissions.py +0 -0
  53. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/serializers/__init__.py +0 -0
  54. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/serializers/common.py +0 -0
  55. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/serializers/json.py +0 -0
  56. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/serializers/msgpack.py +0 -0
  57. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/serializers/msgspec.py +0 -0
  58. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons.egg-info/SOURCES.txt +0 -0
  59. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons.egg-info/dependency_links.txt +0 -0
  60. {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons.egg-info/top_level.txt +0 -0
  61. {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/__init__.py +0 -0
  62. {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/integration/__init__.py +0 -0
  63. {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/integration/test_cache.py +0 -0
  64. {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/integration/test_osc.py +0 -0
  65. {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/unit/__init__.py +0 -0
  66. {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/unit/conftest.py +0 -0
  67. {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/unit/log/__init__.py +0 -0
  68. {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/unit/log/test_formatters.py +0 -0
  69. {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/unit/test_async_functools.py +0 -0
  70. {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/unit/test_audit.py +0 -0
  71. {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/unit/test_helpers.py +0 -0
  72. {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/unit/test_msgpack.py +0 -0
  73. {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/unit/test_msgspec.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python3-commons
3
- Version: 0.17.2
3
+ Version: 0.17.3
4
4
  Summary: Re-usable Python3 code
5
5
  Author-email: Oleg Korsak <kamikaze.is.waiting.you@gmail.com>
6
6
  License-Expression: GPL-3.0
@@ -37,7 +37,7 @@ Requires-Dist: asyncpg~=0.31.0; extra == "database"
37
37
  Requires-Dist: SQLAlchemy[asyncio]~=2.0.49; extra == "database"
38
38
  Provides-Extra: object-storage
39
39
  Requires-Dist: aiobotocore~=3.5.0; extra == "object-storage"
40
- Requires-Dist: object-storage-client==0.0.22; extra == "object-storage"
40
+ Requires-Dist: object-storage-client==0.0.23; extra == "object-storage"
41
41
  Dynamic: license-file
42
42
 
43
43
  Re-usable Python3 code
@@ -53,7 +53,7 @@ database = [
53
53
  ]
54
54
  object-storage = [
55
55
  "aiobotocore~=3.5.0",
56
- "object-storage-client==0.0.22"
56
+ "object-storage-client==0.0.23"
57
57
  ]
58
58
 
59
59
 
@@ -25,7 +25,7 @@ logger = logging.getLogger(__name__)
25
25
 
26
26
 
27
27
  async def _store_response_for_audit(
28
- response: ClientResponse, audit_name: str, uri_path: str, method: str, request_id: str
28
+ response: ClientResponse, audit_name: str, uri_path: str, method: str, request_id: str
29
29
  ) -> None:
30
30
  response_text = await response.text()
31
31
 
@@ -43,16 +43,16 @@ async def _store_response_for_audit(
43
43
 
44
44
  @asynccontextmanager
45
45
  async def request(
46
- client: ClientSession,
47
- base_url: str,
48
- uri: str,
49
- query: Mapping | None = None,
50
- method: Literal['get', 'post', 'put', 'patch', 'options', 'head', 'delete'] = 'get',
51
- headers: Mapping | None = None,
52
- json: Mapping | Sequence | str | None = None,
53
- data: bytes | None = None,
54
- timeout: ClientTimeout | Enum | None = None,
55
- audit_name: str | None = None,
46
+ client: ClientSession,
47
+ base_url: str,
48
+ uri: str,
49
+ query: Mapping | None = None,
50
+ method: Literal['get', 'post', 'put', 'patch', 'options', 'head', 'delete'] = 'get',
51
+ headers: Mapping | None = None,
52
+ json: Mapping | Sequence | str | None = None,
53
+ data: bytes | None = None,
54
+ timeout: ClientTimeout | Enum | None = None,
55
+ audit_name: str | None = None,
56
56
  ) -> AsyncGenerator[ClientResponse]:
57
57
  now = datetime.now(tz=UTC)
58
58
  date_path = now.strftime('%Y/%m/%d')
@@ -81,11 +81,11 @@ def get_valkey_client() -> Valkey:
81
81
 
82
82
 
83
83
  async def scan(
84
- cursor: int = 0,
85
- match: bytes | str | memoryview | None = None,
86
- count: int | None = None,
87
- _type: str | None = None,
88
- **kwargs,
84
+ cursor: int = 0,
85
+ match: bytes | str | memoryview | None = None,
86
+ count: int | None = None,
87
+ _type: str | None = None,
88
+ **kwargs,
89
89
  ) -> ResponseT:
90
90
  return await get_valkey_client().scan(cursor, match, count, _type, **kwargs)
91
91
 
@@ -16,7 +16,7 @@ logger = logging.getLogger(__name__)
16
16
 
17
17
 
18
18
  def get_query(
19
- search: Mapping[str, str] | None = None, order_by: str | None = None, columns: Mapping | None = None
19
+ search: Mapping[str, str] | None = None, order_by: str | None = None, columns: Mapping | None = None
20
20
  ) -> tuple[ColumnElement[bool] | None, tuple[ColumnElement[bool]] | None]:
21
21
  """
22
22
  :columns:
@@ -113,10 +113,17 @@ async def get_object_stream(bucket_name: str, path: str) -> AsyncGenerator[Strea
113
113
 
114
114
 
115
115
  async def get_object(bucket_name: str, path: str) -> bytes:
116
- async with get_object_stream(bucket_name, path) as stream:
117
- body = await stream.read()
116
+ logger.debug('Getting object from object storage: %s:%s', bucket_name, path)
118
117
 
119
- logger.debug('Loaded object from object storage: %s:%s', bucket_name, path)
118
+ try:
119
+ client = get_client()
120
+ absolute_path = get_absolute_path(path)
121
+ url = f's3://{bucket_name}/{absolute_path}'
122
+ body = await client.get_object(url)
123
+ except Exception as e:
124
+ logger.exception('Failed getting object from object storage: %s:%s', bucket_name, path, exc_info=e)
125
+
126
+ raise
120
127
 
121
128
  return body
122
129
 
@@ -136,7 +143,7 @@ async def list_objects(bucket_name: str, prefix: str, *, recursive: bool = True)
136
143
 
137
144
 
138
145
  async def get_object_streams(
139
- bucket_name: str, path: str, *, recursive: bool = True
146
+ bucket_name: str, path: str, *, recursive: bool = True
140
147
  ) -> AsyncGenerator[tuple[str, datetime, StreamingBody]]:
141
148
  async for obj in list_objects(bucket_name, path, recursive=recursive):
142
149
  object_name = obj['Key']
@@ -147,7 +154,7 @@ async def get_object_streams(
147
154
 
148
155
 
149
156
  async def get_objects(
150
- bucket_name: str, path: str, *, recursive: bool = True
157
+ bucket_name: str, path: str, *, recursive: bool = True
151
158
  ) -> AsyncGenerator[tuple[str, datetime, bytes]]:
152
159
  async for object_name, last_modified, stream in get_object_streams(bucket_name, path, recursive=recursive):
153
160
  data = await stream.read()
@@ -169,7 +176,7 @@ async def remove_object(bucket_name: str, object_name: str) -> None:
169
176
 
170
177
 
171
178
  async def remove_objects(
172
- bucket_name: str, prefix: str | None = None, object_names: Iterable[str] | None = None
179
+ bucket_name: str, prefix: str | None = None, object_names: Iterable[str] | None = None
173
180
  ) -> Sequence[Mapping] | None:
174
181
  storage = ObjectStorage(s3_settings)
175
182
 
@@ -192,7 +199,7 @@ async def remove_objects(
192
199
  chunk_size = 1000
193
200
 
194
201
  for i in range(0, len(objects_to_delete), chunk_size):
195
- chunk = objects_to_delete[i: i + chunk_size]
202
+ chunk = objects_to_delete[i : i + chunk_size]
196
203
 
197
204
  response = await s3_client.delete_objects(Bucket=bucket_name, Delete={'Objects': chunk})
198
205
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python3-commons
3
- Version: 0.17.2
3
+ Version: 0.17.3
4
4
  Summary: Re-usable Python3 code
5
5
  Author-email: Oleg Korsak <kamikaze.is.waiting.you@gmail.com>
6
6
  License-Expression: GPL-3.0
@@ -37,7 +37,7 @@ Requires-Dist: asyncpg~=0.31.0; extra == "database"
37
37
  Requires-Dist: SQLAlchemy[asyncio]~=2.0.49; extra == "database"
38
38
  Provides-Extra: object-storage
39
39
  Requires-Dist: aiobotocore~=3.5.0; extra == "object-storage"
40
- Requires-Dist: object-storage-client==0.0.22; extra == "object-storage"
40
+ Requires-Dist: object-storage-client==0.0.23; extra == "object-storage"
41
41
  Dynamic: license-file
42
42
 
43
43
  Re-usable Python3 code
@@ -31,4 +31,4 @@ SQLAlchemy[asyncio]~=2.0.49
31
31
 
32
32
  [object-storage]
33
33
  aiobotocore~=3.5.0
34
- object-storage-client==0.0.22
34
+ object-storage-client==0.0.23
@@ -668,22 +668,22 @@ wheels = [
668
668
 
669
669
  [[package]]
670
670
  name = "object-storage-client"
671
- version = "0.0.22"
671
+ version = "0.0.23"
672
672
  source = { registry = "https://pypi.org/simple" }
673
- sdist = { url = "https://files.pythonhosted.org/packages/1a/49/9af56487b380cef1132c1aa718702095a0ab3ddb3e82bb4eab9593dde316/object_storage_client-0.0.22.tar.gz", hash = "sha256:00535617e1f50c0dab066e7dc6bdc9d1690e989febcfaacc27737988dd5a4101", size = 40622, upload-time = "2026-04-21T12:36:41.782Z" }
673
+ sdist = { url = "https://files.pythonhosted.org/packages/8d/05/2789ff2531d2f8e5be4643505dc8052f4d72cd15f635bdee160c464a6cce/object_storage_client-0.0.23.tar.gz", hash = "sha256:991ba770604c96ffdd992939a2fe2438a0250dc1cd17e3ddf3a6def436985507", size = 41641, upload-time = "2026-04-26T18:50:40.694Z" }
674
674
  wheels = [
675
- { url = "https://files.pythonhosted.org/packages/e3/0b/c9a4dc7ae9bc8f67877190d97c0efb94a0a9e7aef6423feaa45d93232215/object_storage_client-0.0.22-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:db7d843f11e1d281ba16533bc573343ec9e0a8d2cf779cd43464df6adca0a5a8", size = 1922610, upload-time = "2026-04-21T12:36:40.278Z" },
676
- { url = "https://files.pythonhosted.org/packages/7e/f3/3e34cc1e70e9f48ad0be5d7af1771d864a3ee618c07aad43978e2d3a131c/object_storage_client-0.0.22-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4d7c92c2ca19f9d734be99162df7dc573535e7022e5a9b5c1dce121a102a85ae", size = 2114290, upload-time = "2026-04-21T12:36:37.82Z" },
677
- { url = "https://files.pythonhosted.org/packages/ee/73/4af6bf9dc086e9c0a69988d2258d2f6f5d02d00ef891d9df3d6d08c3355a/object_storage_client-0.0.22-cp314-cp314-win_amd64.whl", hash = "sha256:df863a2a3f8f1c77d06bdc547d674b321878dca7cb7db94606b763cb9cc7e508", size = 2095414, upload-time = "2026-04-21T12:36:38.966Z" },
675
+ { url = "https://files.pythonhosted.org/packages/ea/26/f2a6f1d83b580d1b3fddc2aa40b3a295f4fcd34e78ef860f7d9485c8eccc/object_storage_client-0.0.23-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:ef7d3736c26dcfebe5b468cd662dc19bd6f724e82dfb61b0f568d66f1fdf7a05", size = 1945209, upload-time = "2026-04-26T18:50:39.519Z" },
676
+ { url = "https://files.pythonhosted.org/packages/c9/19/a41fba90759ae91dab35f98665d1895aeb193f42d2fe899977d428bb4820/object_storage_client-0.0.23-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0f3a6535a564e0ab97636d810bfc5ad49c10048a1f0ad241b09c91a4fc916bbf", size = 2137323, upload-time = "2026-04-26T18:50:45.91Z" },
677
+ { url = "https://files.pythonhosted.org/packages/a8/20/2b309e05ad849cfc2e757c3b62030211904e82b32cb07d48648d941c72c1/object_storage_client-0.0.23-cp314-cp314-win_amd64.whl", hash = "sha256:b71e1fe22f2fc900a08b8b4a356cab4b927eaf84b483b5330f7c96157c4dd9ae", size = 2126848, upload-time = "2026-04-26T18:50:41.661Z" },
678
678
  ]
679
679
 
680
680
  [[package]]
681
681
  name = "packaging"
682
- version = "26.1"
682
+ version = "26.2"
683
683
  source = { registry = "https://pypi.org/simple" }
684
- sdist = { url = "https://files.pythonhosted.org/packages/df/de/0d2b39fb4af88a0258f3bac87dfcbb48e73fbdea4a2ed0e2213f9a4c2f9a/packaging-26.1.tar.gz", hash = "sha256:f042152b681c4bfac5cae2742a55e103d27ab2ec0f3d88037136b6bfe7c9c5de", size = 215519, upload-time = "2026-04-14T21:12:49.362Z" }
684
+ sdist = { url = "https://files.pythonhosted.org/packages/d7/f1/e7a6dd94a8d4a5626c03e4e99c87f241ba9e350cd9e6d75123f992427270/packaging-26.2.tar.gz", hash = "sha256:ff452ff5a3e828ce110190feff1178bb1f2ea2281fa2075aadb987c2fb221661", size = 228134, upload-time = "2026-04-24T20:15:23.917Z" }
685
685
  wheels = [
686
- { url = "https://files.pythonhosted.org/packages/7a/c2/920ef838e2f0028c8262f16101ec09ebd5969864e5a64c4c05fad0617c56/packaging-26.1-py3-none-any.whl", hash = "sha256:5d9c0669c6285e491e0ced2eee587eaf67b670d94a19e94e3984a481aba6802f", size = 95831, upload-time = "2026-04-14T21:12:47.56Z" },
686
+ { url = "https://files.pythonhosted.org/packages/df/b2/87e62e8c3e2f4b32e5fe99e0b86d576da1312593b39f47d8ceef365e95ed/packaging-26.2-py3-none-any.whl", hash = "sha256:5fc45236b9446107ff2415ce77c807cee2862cb6fac22b8a73826d0693b0980e", size = 100195, upload-time = "2026-04-24T20:15:22.081Z" },
687
687
  ]
688
688
 
689
689
  [[package]]
@@ -1067,7 +1067,7 @@ requires-dist = [
1067
1067
  { name = "lxml", marker = "extra == 'audit'", specifier = "~=6.1.0" },
1068
1068
  { name = "msgpack", specifier = "~=1.1.2" },
1069
1069
  { name = "msgspec", specifier = "==0.21.1" },
1070
- { name = "object-storage-client", marker = "extra == 'object-storage'", specifier = "==0.0.22" },
1070
+ { name = "object-storage-client", marker = "extra == 'object-storage'", specifier = "==0.0.23" },
1071
1071
  { name = "pydantic-settings", specifier = "~=2.14.0" },
1072
1072
  { name = "python3-commons", extras = ["api-client", "audit", "authn", "authz", "cache", "database", "object-storage"], marker = "extra == 'all'" },
1073
1073
  { name = "python3-commons", extras = ["database"], marker = "extra == 'authz'" },