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.
- {python3_commons-0.17.2/src/python3_commons.egg-info → python3_commons-0.17.3}/PKG-INFO +2 -2
- {python3_commons-0.17.2 → python3_commons-0.17.3}/pyproject.toml +1 -1
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/api_client.py +11 -11
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/cache.py +5 -5
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/db/helpers.py +1 -1
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/object_storage.py +14 -7
- {python3_commons-0.17.2 → python3_commons-0.17.3/src/python3_commons.egg-info}/PKG-INFO +2 -2
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons.egg-info/requires.txt +1 -1
- {python3_commons-0.17.2 → python3_commons-0.17.3}/uv.lock +9 -9
- {python3_commons-0.17.2 → python3_commons-0.17.3}/.coveragerc +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/.devcontainer/Dockerfile +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/.devcontainer/devcontainer.json +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/.devcontainer/docker-compose.yml +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/.env_template +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/.github/workflows/checks.yml +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/.github/workflows/python-publish.yaml +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/.github/workflows/release-on-tag-push.yml +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/.gitignore +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/.pre-commit-config.yaml +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/.python-version +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/AUTHORS.rst +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/CHANGELOG.rst +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/LICENSE +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/README.md +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/README.rst +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/docs/Makefile +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/docs/_static/.gitignore +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/docs/authors.rst +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/docs/changelog.rst +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/docs/conf.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/docs/index.rst +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/docs/license.rst +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/setup.cfg +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/__init__.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/async_functools.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/audit.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/auth.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/conf.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/db/__init__.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/db/models/__init__.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/db/models/auth.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/db/models/common.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/db/models/rbac.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/db/models/users.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/exceptions.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/fs.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/generators.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/helpers.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/log/__init__.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/log/filters.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/log/formatters.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/permissions.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/serializers/__init__.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/serializers/common.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/serializers/json.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/serializers/msgpack.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/serializers/msgspec.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons.egg-info/SOURCES.txt +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons.egg-info/dependency_links.txt +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons.egg-info/top_level.txt +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/__init__.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/integration/__init__.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/integration/test_cache.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/integration/test_osc.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/unit/__init__.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/unit/conftest.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/unit/log/__init__.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/unit/log/test_formatters.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/unit/test_async_functools.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/unit/test_audit.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/unit/test_helpers.py +0 -0
- {python3_commons-0.17.2 → python3_commons-0.17.3}/tests/unit/test_msgpack.py +0 -0
- {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.
|
|
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.
|
|
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
|
|
@@ -25,7 +25,7 @@ logger = logging.getLogger(__name__)
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
async def _store_response_for_audit(
|
|
28
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
-
|
|
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
|
-
|
|
117
|
-
body = await stream.read()
|
|
116
|
+
logger.debug('Getting object from object storage: %s:%s', bucket_name, path)
|
|
118
117
|
|
|
119
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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
|
|
@@ -668,22 +668,22 @@ wheels = [
|
|
|
668
668
|
|
|
669
669
|
[[package]]
|
|
670
670
|
name = "object-storage-client"
|
|
671
|
-
version = "0.0.
|
|
671
|
+
version = "0.0.23"
|
|
672
672
|
source = { registry = "https://pypi.org/simple" }
|
|
673
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
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/
|
|
676
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
677
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
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.
|
|
682
|
+
version = "26.2"
|
|
683
683
|
source = { registry = "https://pypi.org/simple" }
|
|
684
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
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/
|
|
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.
|
|
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'" },
|
|
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
|
|
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
|
|
File without changes
|
{python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/serializers/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/serializers/msgpack.py
RENAMED
|
File without changes
|
{python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons/serializers/msgspec.py
RENAMED
|
File without changes
|
|
File without changes
|
{python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{python3_commons-0.17.2 → python3_commons-0.17.3}/src/python3_commons.egg-info/top_level.txt
RENAMED
|
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
|