python3-commons 0.17.0__py3-none-any.whl → 0.17.2__py3-none-any.whl

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.
@@ -13,7 +13,7 @@ try:
13
13
  from aiohttp import ClientResponse, ClientSession, ClientTimeout, client_exceptions
14
14
  from aiohttp.abc import URL
15
15
  except ImportError as e:
16
- msg = 'Install python3_commons[api-client] to use this feature'
16
+ msg = 'Install python3-commons[api-client] to use this feature'
17
17
  raise RuntimeError(msg) from e
18
18
 
19
19
  from python3_commons import audit
@@ -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')
python3_commons/audit.py CHANGED
@@ -9,7 +9,7 @@ try:
9
9
  from lxml import etree
10
10
  from zeep.plugins import Plugin
11
11
  except ImportError as e:
12
- msg = 'Install python3_commons[api-client] to use this feature'
12
+ msg = 'Install python3-commons[api-client] to use this feature'
13
13
  raise RuntimeError(msg) from e
14
14
 
15
15
  from python3_commons import object_storage
python3_commons/auth.py CHANGED
@@ -8,7 +8,7 @@ from typing import TypeVar
8
8
  try:
9
9
  import aiohttp
10
10
  except ImportError as e:
11
- msg = 'Install python3_commons[authn] to use this feature'
11
+ msg = 'Install python3-commons[authn] to use this feature'
12
12
  raise RuntimeError(msg) from e
13
13
 
14
14
  import msgspec
python3_commons/cache.py CHANGED
@@ -10,7 +10,7 @@ try:
10
10
  from valkey.asyncio.retry import Retry
11
11
  from valkey.backoff import FullJitterBackoff
12
12
  except ImportError as e:
13
- msg = 'Install python3_commons[cache] to use this feature'
13
+ msg = 'Install python3-commons[cache] to use this feature'
14
14
  raise RuntimeError(msg) from e
15
15
 
16
16
  from python3_commons.conf import valkey_settings
@@ -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
 
@@ -9,7 +9,7 @@ try:
9
9
  from sqlalchemy.ext.asyncio.session import async_sessionmaker
10
10
  from sqlalchemy.orm import declarative_base
11
11
  except ImportError as e:
12
- msg = 'Install python3_commons[database] to use this feature'
12
+ msg = 'Install python3-commons[database] to use this feature'
13
13
  raise RuntimeError(msg) from e
14
14
 
15
15
  if TYPE_CHECKING:
@@ -6,7 +6,7 @@ try:
6
6
  import sqlalchemy as sa
7
7
  from sqlalchemy import asc, desc, func
8
8
  except ImportError as e:
9
- msg = 'Install python3_commons[database] to use this feature'
9
+ msg = 'Install python3-commons[database] to use this feature'
10
10
  raise RuntimeError(msg) from e
11
11
 
12
12
  if TYPE_CHECKING:
@@ -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:
@@ -5,7 +5,7 @@ try:
5
5
  from sqlalchemy import UUID, DateTime, ForeignKey, String
6
6
  from sqlalchemy.orm import Mapped, mapped_column
7
7
  except ImportError as e:
8
- msg = 'Install python3_commons[database] to use this feature'
8
+ msg = 'Install python3-commons[database] to use this feature'
9
9
  raise RuntimeError(msg) from e
10
10
 
11
11
  from python3_commons.db import Base
@@ -9,7 +9,7 @@ try:
9
9
  from sqlalchemy.sql import expression
10
10
  from sqlalchemy.sql.ddl import CreateColumn
11
11
  except ImportError as e:
12
- msg = 'Install python3_commons[database] to use this feature'
12
+ msg = 'Install python3-commons[database] to use this feature'
13
13
  raise RuntimeError(msg) from e
14
14
 
15
15
 
@@ -6,7 +6,7 @@ try:
6
6
  from sqlalchemy.dialects.postgresql import UUID
7
7
  from sqlalchemy.orm import Mapped, mapped_column
8
8
  except ImportError as e:
9
- msg = 'Install python3_commons[database] to use this feature'
9
+ msg = 'Install python3-commons[database] to use this feature'
10
10
  raise RuntimeError(msg) from e
11
11
 
12
12
  from python3_commons.db import Base
@@ -4,7 +4,7 @@ try:
4
4
  from sqlalchemy import UUID, ForeignKey, String
5
5
  from sqlalchemy.orm import Mapped, mapped_column
6
6
  except ImportError as e:
7
- msg = 'Install python3_commons[database] to use this feature'
7
+ msg = 'Install python3-commons[database] to use this feature'
8
8
  raise RuntimeError(msg) from e
9
9
 
10
10
  from python3_commons.db import Base
@@ -10,7 +10,7 @@ try:
10
10
  from botocore.config import Config
11
11
  from object_storage_client import ObjectStorageClient
12
12
  except ImportError as e:
13
- msg = 'Install python3_commons[object-storage] to use this feature'
13
+ msg = 'Install python3-commons[object-storage] to use this feature'
14
14
  raise RuntimeError(msg) from e
15
15
 
16
16
  if TYPE_CHECKING:
@@ -136,7 +136,7 @@ async def list_objects(bucket_name: str, prefix: str, *, recursive: bool = True)
136
136
 
137
137
 
138
138
  async def get_object_streams(
139
- bucket_name: str, path: str, *, recursive: bool = True
139
+ bucket_name: str, path: str, *, recursive: bool = True
140
140
  ) -> AsyncGenerator[tuple[str, datetime, StreamingBody]]:
141
141
  async for obj in list_objects(bucket_name, path, recursive=recursive):
142
142
  object_name = obj['Key']
@@ -147,7 +147,7 @@ async def get_object_streams(
147
147
 
148
148
 
149
149
  async def get_objects(
150
- bucket_name: str, path: str, *, recursive: bool = True
150
+ bucket_name: str, path: str, *, recursive: bool = True
151
151
  ) -> AsyncGenerator[tuple[str, datetime, bytes]]:
152
152
  async for object_name, last_modified, stream in get_object_streams(bucket_name, path, recursive=recursive):
153
153
  data = await stream.read()
@@ -169,7 +169,7 @@ async def remove_object(bucket_name: str, object_name: str) -> None:
169
169
 
170
170
 
171
171
  async def remove_objects(
172
- bucket_name: str, prefix: str | None = None, object_names: Iterable[str] | None = None
172
+ bucket_name: str, prefix: str | None = None, object_names: Iterable[str] | None = None
173
173
  ) -> Sequence[Mapping] | None:
174
174
  storage = ObjectStorage(s3_settings)
175
175
 
@@ -192,7 +192,7 @@ async def remove_objects(
192
192
  chunk_size = 1000
193
193
 
194
194
  for i in range(0, len(objects_to_delete), chunk_size):
195
- chunk = objects_to_delete[i : i + chunk_size]
195
+ chunk = objects_to_delete[i: i + chunk_size]
196
196
 
197
197
  response = await s3_client.delete_objects(Bucket=bucket_name, Delete={'Objects': chunk})
198
198
 
@@ -6,7 +6,7 @@ try:
6
6
  import sqlalchemy as sa
7
7
  from sqlalchemy import and_, exists, func
8
8
  except ImportError as e:
9
- msg = 'Install python3_commons[authz] to use this feature'
9
+ msg = 'Install python3-commons[authz] to use this feature'
10
10
  raise RuntimeError(msg) from e
11
11
 
12
12
  from python3_commons.db.models.rbac import RBACApiKeyRole, RBACPermission, RBACRolePermission, RBACUserRole
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python3-commons
3
- Version: 0.17.0
3
+ Version: 0.17.2
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
@@ -16,12 +16,16 @@ Requires-Dist: msgpack~=1.1.2
16
16
  Requires-Dist: msgspec==0.21.1
17
17
  Requires-Dist: pydantic-settings~=2.14.0
18
18
  Provides-Extra: all
19
- Requires-Dist: python3_commons[audit,authn,authz,database,object-storage,valkey]; extra == "all"
19
+ Requires-Dist: python3_commons[api-client,audit,authn,authz,cache,database,object-storage]; extra == "all"
20
20
  Provides-Extra: api-client
21
21
  Requires-Dist: aiohttp[speedups]<3.15.0,>=3.13.5; extra == "api-client"
22
22
  Requires-Dist: lxml~=6.1.0; extra == "api-client"
23
23
  Requires-Dist: zeep~=4.3.2; extra == "api-client"
24
24
  Requires-Dist: python3_commons[object-storage]; extra == "api-client"
25
+ Provides-Extra: audit
26
+ Requires-Dist: lxml~=6.1.0; extra == "audit"
27
+ Requires-Dist: zeep~=4.3.2; extra == "audit"
28
+ Requires-Dist: python3_commons[object-storage]; extra == "audit"
25
29
  Provides-Extra: authn
26
30
  Requires-Dist: aiohttp[speedups]<3.15.0,>=3.13.5; extra == "authn"
27
31
  Provides-Extra: authz
@@ -1,23 +1,23 @@
1
1
  python3_commons/__init__.py,sha256=0KgaYU46H_IMKn-BuasoRN3C4Hi45KlkHHoPbU9cwiA,189
2
- python3_commons/api_client.py,sha256=1Rj2b2KSSTHn2x7CHghw_ZeVfrYYIZAELIxivMWroBU,5418
2
+ python3_commons/api_client.py,sha256=6EmXSO8cGEIfMufgEQVjFsXhAUYO8yTtel6NIp74WR0,5462
3
3
  python3_commons/async_functools.py,sha256=A2HvwFzZHxOWTp4IQM5UiBY2yg1S_0U1CWra5BWK0gk,9101
4
- python3_commons/audit.py,sha256=VFZlcBAX_ZPhAlj7pNiV7njUdciq2N8-WKiOWU2F1MA,2278
5
- python3_commons/auth.py,sha256=EgCtoMCZNx2nKomCYIZkpxqQGFy5FuGqnWw3CM0YYNM,2231
6
- python3_commons/cache.py,sha256=1JGnU7BKul-R3fsA3n5uH1Y5YCtvdIt2oyz-88HmVvs,8018
4
+ python3_commons/audit.py,sha256=vO4-eIeFEwd6FfydY4ZqX8eUXfx0KiDo8IXotYvpYQg,2278
5
+ python3_commons/auth.py,sha256=TtE4uj6gKiV3GzzXDDjXb7gwPX_hLnDDfGmufPJRe0g,2231
6
+ python3_commons/cache.py,sha256=zhyFfMpGwG8bcSVtur5cGin3e8pqxVwFFvLBbW1Lwus,8038
7
7
  python3_commons/conf.py,sha256=N9CJmARQBy-M68KpTQlLIe4KqPyXYD9DFscermxpOiE,2861
8
8
  python3_commons/exceptions.py,sha256=EGjHZVBnsM6CeBfPMqhL0IPMKjDJ_2-Z-aSPXwq91LE,36
9
9
  python3_commons/fs.py,sha256=dn8ZcwsQf9xcAEg6neoxLN6IzJbWpprfm8wV8S55BL0,337
10
10
  python3_commons/generators.py,sha256=P6sKdCFhHT79-DZgzPU-qmwZvHg3wU8a75UFIwrycOY,1163
11
11
  python3_commons/helpers.py,sha256=2U0XyiBhylPrPIdPkZ16jrJRDZBE-yKv9GjRIY4C-EA,4541
12
- python3_commons/object_storage.py,sha256=khfFhYmejWJAlk4VF4w3OEEvmGicFgA8O5PJkn3-uOM,7093
13
- python3_commons/permissions.py,sha256=5a7l8asHr5iK-dCSb8jvvka5ghm5t5evwV95NIleOm4,1724
14
- python3_commons/db/__init__.py,sha256=ovOoGzSe5kMLvVjmushhn6kiStZBQTUSX-uNK2lLkFU,3105
15
- python3_commons/db/helpers.py,sha256=vn_tEOuCDM3oir3QhmNkSi2aacY4tZzPYiCRnfA15ko,2001
12
+ python3_commons/object_storage.py,sha256=4pW1GnoWP2FrMxYYSWiXpJYzMWGOcqB0Zb_5wA8_9IU,7104
13
+ python3_commons/permissions.py,sha256=gaMKSWg0MgPQTdP1voll4ItXcblXku9BlD0Lq3Xv64U,1724
14
+ python3_commons/db/__init__.py,sha256=i60JvWiUY8kz8nEaVjc5MA1IN_P5g3tK7jX8KgcUd0Y,3105
15
+ python3_commons/db/helpers.py,sha256=bhRFU5XjlmpqqB9IZc8qw-LhaitutxTREZe-l6WHBBU,2005
16
16
  python3_commons/db/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- python3_commons/db/models/auth.py,sha256=C9ZP4rnzskKEHT130uOXoDCut4TAZeOpgCTYNNPXmUQ,773
18
- python3_commons/db/models/common.py,sha256=KqXzUUN4bPqf06myyWNtzSdTtQOLV-XRXuy7R6FCF9Q,1674
19
- python3_commons/db/models/rbac.py,sha256=7TinDsO58Mk6SbqOSgSh7OLH8b6xADbzeJpW3dSdp2Q,3259
20
- python3_commons/db/models/users.py,sha256=W4bX7e2gu3uLCtPpJKs8ma7aTvUBAqG_mH2nQrziwMo,783
17
+ python3_commons/db/models/auth.py,sha256=t6z_0c7l_1eB-CCdnPSV9OzJ_ymgkwD1cLpecNhQgoA,773
18
+ python3_commons/db/models/common.py,sha256=mC76mxjHR5bnUrAAAbIaS4kzruBJbuD3ZDecHZpJq_M,1674
19
+ python3_commons/db/models/rbac.py,sha256=NZXaNNs4Wte9sKayNkV78noHH85A_9z0JOZta8msNnI,3259
20
+ python3_commons/db/models/users.py,sha256=yZSHEJf57t809CmNDlkU5RoAxHzbX150-MY2Iu_3aLo,783
21
21
  python3_commons/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  python3_commons/log/filters.py,sha256=fuyjXZAUm-i2MNrxvFYag8F8Rr27x8W8MdV3ke6miSs,175
23
23
  python3_commons/log/formatters.py,sha256=URhPJzTGWQgRExtdKqXGAirynvaR6LhWfYB5CMajIJo,2768
@@ -26,9 +26,9 @@ python3_commons/serializers/common.py,sha256=VkA7C6wODvHk0QBXVX_x2JieDstihx3U__U
26
26
  python3_commons/serializers/json.py,sha256=UPkC3ps13x2C_NxwVV-K7Ewp4VjkVHSSUkJVw5k7Wiw,712
27
27
  python3_commons/serializers/msgpack.py,sha256=zESFBX34GsZ8rDu6Zk5V6CLT6P0mPilU0r04Ka6TblI,1474
28
28
  python3_commons/serializers/msgspec.py,sha256=upy5CBmK66-8hYnK5bAM_sZvZY5CAqZmzCw9GIF346I,2988
29
- python3_commons-0.17.0.dist-info/licenses/AUTHORS.rst,sha256=3R9JnfjfjH5RoPWOeqKFJgxVShSSfzQPIrEr1nxIo9Q,90
30
- python3_commons-0.17.0.dist-info/licenses/LICENSE,sha256=xxILuojHm4fKQOrMHPSslbyy6WuKAN2RiG74HbrYfzM,34575
31
- python3_commons-0.17.0.dist-info/METADATA,sha256=Zl9ivamOswkww5CSyqISGYdjVG32x6_JSzsjP-8A0IU,1666
32
- python3_commons-0.17.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
33
- python3_commons-0.17.0.dist-info/top_level.txt,sha256=lJI6sCBf68eUHzupCnn2dzG10lH3jJKTWM_hrN1cQ7M,16
34
- python3_commons-0.17.0.dist-info/RECORD,,
29
+ python3_commons-0.17.2.dist-info/licenses/AUTHORS.rst,sha256=3R9JnfjfjH5RoPWOeqKFJgxVShSSfzQPIrEr1nxIo9Q,90
30
+ python3_commons-0.17.2.dist-info/licenses/LICENSE,sha256=xxILuojHm4fKQOrMHPSslbyy6WuKAN2RiG74HbrYfzM,34575
31
+ python3_commons-0.17.2.dist-info/METADATA,sha256=WCk5ylmg_JRdjHW-fhxeLqTg3AeCrINXRQZFcc2YrXM,1853
32
+ python3_commons-0.17.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
33
+ python3_commons-0.17.2.dist-info/top_level.txt,sha256=lJI6sCBf68eUHzupCnn2dzG10lH3jJKTWM_hrN1cQ7M,16
34
+ python3_commons-0.17.2.dist-info/RECORD,,