ecodev-core 0.0.97__tar.gz → 0.0.99__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.
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/PKG-INFO +2 -1
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/app_stats/activity_export.py +2 -1
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/app_stats/consumer/ingest.py +4 -3
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/date_utils.py +11 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/db_upsertion.py +7 -1
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/pyproject.toml +2 -1
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/LICENSE.md +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/README.md +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/__init__.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/app_activity.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/app_rights.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/app_stats/__init__.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/app_stats/api_key.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/app_stats/constants.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/app_stats/consumer/__init__.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/app_stats/consumer/client.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/app_stats/consumer/processing.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/app_stats/consumer/tables.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/app_stats/contract.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/app_stats/docs/consumer_guide.md +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/app_stats/docs/producer_guide.md +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/app_stats/router.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/app_user.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/auth_configuration.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/authentication.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/backup.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/check_dependencies.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/custom_equal.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/db_connection.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/db_filters.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/db_i18n.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/db_insertion.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/db_retrieval.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/deployment.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/email_sender.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/encryption.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/enum_utils.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/es_connection.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/list_utils.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/logger.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/pandas_utils.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/permissions.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/pydantic_utils.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/read_write.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/rest_api_client.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/safe_utils.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/sequence_utils.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/settings.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/sqlmodel_utils.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/token_banlist.py +0 -0
- {ecodev_core-0.0.97 → ecodev_core-0.0.99}/ecodev_core/version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ecodev-core
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.99
|
|
4
4
|
Summary: Low level sqlmodel/fastapi/pydantic building blocks
|
|
5
5
|
License: MIT
|
|
6
6
|
License-File: LICENSE.md
|
|
@@ -40,6 +40,7 @@ Requires-Dist: bcrypt (>=4,<5)
|
|
|
40
40
|
Requires-Dist: cryptography (>=46,<47)
|
|
41
41
|
Requires-Dist: elasticsearch (==8.14.0)
|
|
42
42
|
Requires-Dist: fastapi (>=0,<1)
|
|
43
|
+
Requires-Dist: greenlet (>=3,<4)
|
|
43
44
|
Requires-Dist: httpx (>=0,<1)
|
|
44
45
|
Requires-Dist: numpy (>=2,<3)
|
|
45
46
|
Requires-Dist: openpyxl (>=3,<4)
|
|
@@ -17,6 +17,7 @@ from ecodev_core.app_stats.constants import HOUR_GRAIN
|
|
|
17
17
|
from ecodev_core.app_stats.constants import MONTH_GRAIN
|
|
18
18
|
from ecodev_core.app_stats.contract import ActivityExport
|
|
19
19
|
from ecodev_core.app_stats.contract import PagedResponse
|
|
20
|
+
from ecodev_core.date_utils import as_utc
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
def get_activities(
|
|
@@ -114,7 +115,7 @@ def _to_export(r, granularity: str) -> ActivityExport:
|
|
|
114
115
|
"""
|
|
115
116
|
return ActivityExport(
|
|
116
117
|
application=r.application,
|
|
117
|
-
period_start=r.period_start,
|
|
118
|
+
period_start=as_utc(r.period_start),
|
|
118
119
|
granularity=granularity,
|
|
119
120
|
method=r.method,
|
|
120
121
|
activity_count=r.activity_count,
|
|
@@ -17,6 +17,7 @@ from ecodev_core.app_stats.consumer.tables import RemoteActivity
|
|
|
17
17
|
from ecodev_core.app_stats.consumer.tables import RemoteAppProject
|
|
18
18
|
from ecodev_core.app_stats.contract import ActivityExport
|
|
19
19
|
from ecodev_core.app_stats.contract import ProjectExport
|
|
20
|
+
from ecodev_core.date_utils import as_utc
|
|
20
21
|
from ecodev_core.date_utils import utc_now
|
|
21
22
|
|
|
22
23
|
|
|
@@ -71,7 +72,7 @@ def upsert_remote_activities(
|
|
|
71
72
|
RemoteActivity(
|
|
72
73
|
application=application,
|
|
73
74
|
granularity=granularity,
|
|
74
|
-
period_start=item.period_start,
|
|
75
|
+
period_start=as_utc(item.period_start),
|
|
75
76
|
method=item.method,
|
|
76
77
|
activity_count=item.activity_count,
|
|
77
78
|
unique_users=item.unique_users,
|
|
@@ -97,8 +98,8 @@ def upsert_remote_projects(
|
|
|
97
98
|
project_id=item.project_id,
|
|
98
99
|
name=item.name,
|
|
99
100
|
creator=item.creator,
|
|
100
|
-
created_at=item.created_at,
|
|
101
|
-
modified_at=item.modified_at,
|
|
101
|
+
created_at=as_utc(item.created_at),
|
|
102
|
+
modified_at=as_utc(item.modified_at),
|
|
102
103
|
description=item.description,
|
|
103
104
|
client=item.client,
|
|
104
105
|
project_type=item.project_type,
|
|
@@ -13,3 +13,14 @@ def utc_now() -> datetime:
|
|
|
13
13
|
NOTE: introduced to enforce aware datetime timezone : https://github.com/fastapi/sqlmodel/releases#release-0.0.45
|
|
14
14
|
"""
|
|
15
15
|
return datetime.now(timezone.utc)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def as_utc(dt: datetime | None) -> datetime | None:
|
|
19
|
+
"""
|
|
20
|
+
Returns `dt` as timezone-aware UTC; naive values are assumed to already be UTC.
|
|
21
|
+
"""
|
|
22
|
+
if dt is None:
|
|
23
|
+
return None
|
|
24
|
+
if dt.tzinfo is None:
|
|
25
|
+
return dt.replace(tzinfo=timezone.utc)
|
|
26
|
+
return dt.astimezone(timezone.utc)
|
|
@@ -240,8 +240,12 @@ def _get_default_value(fld: Any, nullable: bool) -> Any:
|
|
|
240
240
|
"""
|
|
241
241
|
Find if any the field default value
|
|
242
242
|
"""
|
|
243
|
-
if
|
|
243
|
+
if nullable:
|
|
244
|
+
return None
|
|
245
|
+
if getattr(fld, 'default', None) not in (None, PydanticUndefined):
|
|
244
246
|
return fld.default
|
|
247
|
+
if callable(factory := getattr(fld, 'default_factory', None)):
|
|
248
|
+
return factory()
|
|
245
249
|
return None
|
|
246
250
|
|
|
247
251
|
|
|
@@ -350,6 +354,8 @@ def _python_default_to_sql(value: Any, sql_type: str) -> str:
|
|
|
350
354
|
return str(value)
|
|
351
355
|
if sql_type == 'BOOLEAN':
|
|
352
356
|
return 'TRUE' if value else 'FALSE'
|
|
357
|
+
if isinstance(value, datetime):
|
|
358
|
+
return f"'{value.isoformat()}'"
|
|
353
359
|
if sql_type == 'BYTEA':
|
|
354
360
|
if isinstance(value, bytes):
|
|
355
361
|
return f"decode('{value.hex()}', 'hex')"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "ecodev-core"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.99"
|
|
4
4
|
description = "Low level sqlmodel/fastapi/pydantic building blocks"
|
|
5
5
|
authors = ["Thomas Epelbaum <tomepel@gmail.com>",
|
|
6
6
|
"Olivier Gabriel <olivier.gabriel.geom@gmail.com>",
|
|
@@ -66,6 +66,7 @@ uvicorn = "~0"
|
|
|
66
66
|
xlsxwriter = "~3"
|
|
67
67
|
cryptography = "~46"
|
|
68
68
|
requests = "~2"
|
|
69
|
+
greenlet = "^3"
|
|
69
70
|
|
|
70
71
|
[build-system]
|
|
71
72
|
requires = ["poetry-core"]
|
|
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
|
|
File without changes
|
|
File without changes
|