python3-commons 0.9.4__py3-none-any.whl → 0.9.5__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.
@@ -8,7 +8,6 @@ from typing import AsyncGenerator, Literal, Mapping, Sequence
8
8
  from uuid import uuid4
9
9
 
10
10
  from aiohttp import ClientResponse, ClientSession, ClientTimeout, client_exceptions
11
- from pydantic import HttpUrl
12
11
 
13
12
  from python3_commons import audit
14
13
  from python3_commons.conf import s3_settings
@@ -38,7 +37,7 @@ async def _store_response_for_audit(
38
37
  @asynccontextmanager
39
38
  async def request(
40
39
  client: ClientSession,
41
- base_url: HttpUrl,
40
+ base_url: str,
42
41
  uri: str,
43
42
  query: Mapping | None = None,
44
43
  method: Literal['get', 'post', 'put', 'patch', 'options', 'head', 'delete'] = 'get',
python3_commons/auth.py CHANGED
@@ -3,17 +3,17 @@ from http import HTTPStatus
3
3
  from typing import Annotated, Any, Callable, Coroutine, Sequence, Type, TypeVar
4
4
 
5
5
  import aiohttp
6
+ import msgspec
6
7
  from fastapi import Depends, HTTPException
7
8
  from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
8
9
  from jose import JWTError, jwt
9
- from pydantic import BaseModel
10
10
 
11
11
  from python3_commons.conf import oidc_settings
12
12
 
13
13
  logger = logging.getLogger(__name__)
14
14
 
15
15
 
16
- class TokenData(BaseModel):
16
+ class TokenData(msgspec.Struct):
17
17
  sub: str
18
18
  aud: str | Sequence[str]
19
19
  exp: int
@@ -22,7 +22,6 @@ class TokenData(BaseModel):
22
22
 
23
23
  T = TypeVar('T', bound=TokenData)
24
24
 
25
-
26
25
  OIDC_CONFIG_URL = f'{oidc_settings.authority_url}/.well-known/openid-configuration'
27
26
  _JWKS: dict | None = None
28
27
 
@@ -1,7 +1,7 @@
1
1
  import uuid
2
+ from datetime import datetime
2
3
 
3
4
  from fastapi_users_db_sqlalchemy import GUID, SQLAlchemyBaseUserTableUUID
4
- from pydantic import AwareDatetime
5
5
  from sqlalchemy import BIGINT, DateTime, ForeignKey, String
6
6
  from sqlalchemy.orm import Mapped, mapped_column
7
7
 
@@ -32,4 +32,4 @@ class ApiKey(BaseDBUUIDModel, Base):
32
32
  )
33
33
  partner_name: Mapped[str] = mapped_column(String, unique=True)
34
34
  key: Mapped[str] = mapped_column(String, unique=True)
35
- expires_at: Mapped[AwareDatetime | None] = mapped_column(DateTime(timezone=True))
35
+ expires_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True))
@@ -1,6 +1,6 @@
1
1
  import uuid
2
+ from datetime import datetime
2
3
 
3
- from pydantic import AwareDatetime
4
4
  from sqlalchemy import BIGINT, DateTime
5
5
  from sqlalchemy.dialects.postgresql import UUID
6
6
  from sqlalchemy.ext.compiler import compiles
@@ -27,15 +27,15 @@ def use_identity(element, compiler, **kw):
27
27
 
28
28
  class BaseDBModel:
29
29
  id: Mapped[int] = mapped_column(BIGINT, primary_key=True, sort_order=-3)
30
- created_at: Mapped[AwareDatetime] = mapped_column(
30
+ created_at: Mapped[datetime] = mapped_column(
31
31
  DateTime(timezone=True), nullable=False, server_default=UTCNow(), sort_order=-2
32
32
  )
33
- updated_at: Mapped[AwareDatetime | None] = mapped_column(DateTime(timezone=True), onupdate=UTCNow(), sort_order=-1)
33
+ updated_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), onupdate=UTCNow(), sort_order=-1)
34
34
 
35
35
 
36
36
  class BaseDBUUIDModel:
37
37
  uid: Mapped[uuid.UUID] = mapped_column(UUID, primary_key=True, sort_order=-3)
38
- created_at: Mapped[AwareDatetime] = mapped_column(
38
+ created_at: Mapped[datetime] = mapped_column(
39
39
  DateTime(timezone=True), nullable=False, server_default=UTCNow(), sort_order=-2
40
40
  )
41
- updated_at: Mapped[AwareDatetime | None] = mapped_column(DateTime(timezone=True), onupdate=UTCNow(), sort_order=-1)
41
+ updated_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), onupdate=UTCNow(), sort_order=-1)
@@ -1,7 +1,7 @@
1
1
  import uuid
2
+ from datetime import datetime
2
3
 
3
4
  from fastapi_users_db_sqlalchemy import GUID
4
- from pydantic import AwareDatetime
5
5
  from sqlalchemy import CheckConstraint, DateTime, ForeignKey, PrimaryKeyConstraint, String
6
6
  from sqlalchemy.dialects.postgresql import UUID
7
7
  from sqlalchemy.orm import Mapped, mapped_column
@@ -55,8 +55,8 @@ class RBACUserRole(Base):
55
55
  ForeignKey('rbac_roles.uid', name='fk_rbac_user_roles_role', ondelete='CASCADE'),
56
56
  index=True,
57
57
  )
58
- starts_at: Mapped[AwareDatetime] = mapped_column(DateTime(timezone=True), nullable=False)
59
- expires_at: Mapped[AwareDatetime | None] = mapped_column(DateTime(timezone=True))
58
+ starts_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False)
59
+ expires_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True))
60
60
 
61
61
  __table_args__ = (PrimaryKeyConstraint('user_id', 'role_uid', name='pk_rbac_user_roles'),)
62
62
 
@@ -74,8 +74,8 @@ class RBACApiKeyRole(Base):
74
74
  ForeignKey('rbac_roles.uid', name='fk_rbac_api_key_roles_role', ondelete='CASCADE'),
75
75
  index=True,
76
76
  )
77
- starts_at: Mapped[AwareDatetime] = mapped_column(DateTime(timezone=True), nullable=False)
78
- expires_at: Mapped[AwareDatetime | None] = mapped_column(DateTime(timezone=True))
77
+ starts_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False)
78
+ expires_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True))
79
79
 
80
80
  __table_args__ = (PrimaryKeyConstraint('api_key_uid', 'role_uid', name='pk_rbac_api_key_roles'),)
81
81
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python3-commons
3
- Version: 0.9.4
3
+ Version: 0.9.5
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
@@ -12,7 +12,7 @@ Requires-Python: ==3.13.*
12
12
  Description-Content-Type: text/x-rst
13
13
  License-File: LICENSE
14
14
  License-File: AUTHORS.rst
15
- Requires-Dist: aiobotocore~=2.23.0
15
+ Requires-Dist: aiobotocore~=2.23.2
16
16
  Requires-Dist: aiohttp[speedups]~=3.12.14
17
17
  Requires-Dist: asyncpg~=0.30.0
18
18
  Requires-Dist: fastapi-users-db-sqlalchemy~=7.0.0
@@ -1,7 +1,7 @@
1
1
  python3_commons/__init__.py,sha256=0KgaYU46H_IMKn-BuasoRN3C4Hi45KlkHHoPbU9cwiA,189
2
- python3_commons/api_client.py,sha256=LT7_YmnYVHK2ucKxIhUJCZrmxgfy-lfOxx08-R0WvW0,4505
2
+ python3_commons/api_client.py,sha256=X3nAnVl28HfW2tpVnb4i7oK7B3043DGrXSDeljFGhpQ,4472
3
3
  python3_commons/audit.py,sha256=-jYGjkQ2r8rg3gj-C-5uTQ1lXhK3dRXkktonZxOs1PM,5994
4
- python3_commons/auth.py,sha256=vVaiJ5MHUMSbiLF6TIxe4dqVPhBlLttf940jjODL3a4,2934
4
+ python3_commons/auth.py,sha256=fINE7zeq-oaEk2lwkdP1KOhfCpcIBaC8P9UzXQI37J0,2922
5
5
  python3_commons/cache.py,sha256=lf27LTD4Z9Iqi5GaK8jH8UC0cL9sHH8wicZ88YDp6Mg,7725
6
6
  python3_commons/conf.py,sha256=DYFA2_n7W40MBbpaNWv4iTWh7-GPsGU6Ilygz32tHhs,2397
7
7
  python3_commons/fs.py,sha256=wfLjybXndwLqNlOxTpm_HRJnuTcC4wbrHEOaEeCo9Wc,337
@@ -11,9 +11,9 @@ python3_commons/permissions.py,sha256=bhjTp-tq-oaTGFMHNnSBlcVX5XQCTL0nWcu6SdPEAB
11
11
  python3_commons/db/__init__.py,sha256=5nArsGm17e-pelpOwAeBKy2n_Py20XqklZsNgkcJ-DQ,2947
12
12
  python3_commons/db/helpers.py,sha256=PY0h08aLiGx-J54wmP3GHPCgGCcLd60rayAUnR3aWdI,1742
13
13
  python3_commons/db/models/__init__.py,sha256=zjZCf0DNDkqmPZ49quJ6KZohtKH87viI_ijDG3E0PVE,554
14
- python3_commons/db/models/auth.py,sha256=dmyD3BX7LVBgKiepPN-bxlY6J3PhcmUfVdQwhNR45fU,1187
15
- python3_commons/db/models/common.py,sha256=IwrVfMQhAkPqrPmPRkG9CAB0KRa6YG_0Mogs1aafAoA,1537
16
- python3_commons/db/models/rbac.py,sha256=7NNTUbS8whuPUHpm4oba_UWDdNiJlHrm8HBO7oGtk64,3185
14
+ python3_commons/db/models/auth.py,sha256=NMHirujigpaRR0Bhhe2gzy8Q8PPABuaA-D8ZY7aaqeE,1177
15
+ python3_commons/db/models/common.py,sha256=nRLQVi7Y0SsXo3qMIwQX6GuDO9kHnlma4O_mYXQVtHQ,1512
16
+ python3_commons/db/models/rbac.py,sha256=BIB7nJXQkCes0XA-fg-oCHP6YU0_rXIm29O73j4pNUg,3160
17
17
  python3_commons/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  python3_commons/log/filters.py,sha256=fuyjXZAUm-i2MNrxvFYag8F8Rr27x8W8MdV3ke6miSs,175
19
19
  python3_commons/log/formatters.py,sha256=p2AtZD4Axp3Em0e9gWzW8U_yOR5entD7xn7Edvc-IuM,719
@@ -21,9 +21,9 @@ python3_commons/serializers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
21
21
  python3_commons/serializers/json.py,sha256=91UaXLGKGj0yPyrnuMeNrkG2GuPUgcgAsmIokUgEwpU,808
22
22
  python3_commons/serializers/msgpack.py,sha256=WrvaPE187shSK8zkH4UHHMimEZNMv9RaDSwsBE2HlCw,1269
23
23
  python3_commons/serializers/msgspec.py,sha256=0AliXlEl5sewi0UENjI8St5ZScXE5DNRERKzqWKy2Ps,2674
24
- python3_commons-0.9.4.dist-info/licenses/AUTHORS.rst,sha256=3R9JnfjfjH5RoPWOeqKFJgxVShSSfzQPIrEr1nxIo9Q,90
25
- python3_commons-0.9.4.dist-info/licenses/LICENSE,sha256=xxILuojHm4fKQOrMHPSslbyy6WuKAN2RiG74HbrYfzM,34575
26
- python3_commons-0.9.4.dist-info/METADATA,sha256=69ltIxCgAOTygVE5iqhGUHvWyOFLUn-Fr4oIAH7Boas,1133
27
- python3_commons-0.9.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
28
- python3_commons-0.9.4.dist-info/top_level.txt,sha256=lJI6sCBf68eUHzupCnn2dzG10lH3jJKTWM_hrN1cQ7M,16
29
- python3_commons-0.9.4.dist-info/RECORD,,
24
+ python3_commons-0.9.5.dist-info/licenses/AUTHORS.rst,sha256=3R9JnfjfjH5RoPWOeqKFJgxVShSSfzQPIrEr1nxIo9Q,90
25
+ python3_commons-0.9.5.dist-info/licenses/LICENSE,sha256=xxILuojHm4fKQOrMHPSslbyy6WuKAN2RiG74HbrYfzM,34575
26
+ python3_commons-0.9.5.dist-info/METADATA,sha256=bvHBs4YVOrfhyyHAtuDvnpUAZTtWOBV-Axg-2LsWPR0,1133
27
+ python3_commons-0.9.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
28
+ python3_commons-0.9.5.dist-info/top_level.txt,sha256=lJI6sCBf68eUHzupCnn2dzG10lH3jJKTWM_hrN1cQ7M,16
29
+ python3_commons-0.9.5.dist-info/RECORD,,