tracktolib 0.43.2__tar.gz → 0.44.0__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.
- {tracktolib-0.43.2 → tracktolib-0.44.0}/PKG-INFO +4 -4
- {tracktolib-0.43.2 → tracktolib-0.44.0}/pyproject.toml +6 -10
- {tracktolib-0.43.2 → tracktolib-0.44.0}/setup.py +4 -4
- {tracktolib-0.43.2 → tracktolib-0.44.0}/tracktolib/api.py +5 -16
- {tracktolib-0.43.2 → tracktolib-0.44.0}/tracktolib/utils.py +4 -2
- {tracktolib-0.43.2 → tracktolib-0.44.0}/LICENSE +0 -0
- {tracktolib-0.43.2 → tracktolib-0.44.0}/README.md +0 -0
- {tracktolib-0.43.2 → tracktolib-0.44.0}/tracktolib/__init__.py +0 -0
- {tracktolib-0.43.2 → tracktolib-0.44.0}/tracktolib/http_utils.py +0 -0
- {tracktolib-0.43.2 → tracktolib-0.44.0}/tracktolib/logs.py +0 -0
- {tracktolib-0.43.2 → tracktolib-0.44.0}/tracktolib/pg/__init__.py +0 -0
- {tracktolib-0.43.2 → tracktolib-0.44.0}/tracktolib/pg/query.py +0 -0
- {tracktolib-0.43.2 → tracktolib-0.44.0}/tracktolib/pg/utils.py +0 -0
- {tracktolib-0.43.2 → tracktolib-0.44.0}/tracktolib/pg_sync.py +0 -0
- {tracktolib-0.43.2 → tracktolib-0.44.0}/tracktolib/pg_utils.py +0 -0
- {tracktolib-0.43.2 → tracktolib-0.44.0}/tracktolib/s3/__init__.py +0 -0
- {tracktolib-0.43.2 → tracktolib-0.44.0}/tracktolib/s3/minio.py +0 -0
- {tracktolib-0.43.2 → tracktolib-0.44.0}/tracktolib/s3/s3.py +0 -0
- {tracktolib-0.43.2 → tracktolib-0.44.0}/tracktolib/tests.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: tracktolib
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.44.0
|
|
4
4
|
Summary: Utility library for python
|
|
5
5
|
Home-page: https://github.com/tracktor/tracktolib
|
|
6
6
|
License: MIT
|
|
@@ -21,14 +21,14 @@ Provides-Extra: pg-sync
|
|
|
21
21
|
Provides-Extra: s3
|
|
22
22
|
Provides-Extra: s3-minio
|
|
23
23
|
Provides-Extra: tests
|
|
24
|
-
Requires-Dist: aiobotocore (>=2.
|
|
24
|
+
Requires-Dist: aiobotocore (>=2.9.0); extra == "s3"
|
|
25
25
|
Requires-Dist: asyncpg (>=0.27.0); extra == "pg"
|
|
26
26
|
Requires-Dist: deepdiff (>=6.6.0); extra == "tests"
|
|
27
27
|
Requires-Dist: fastapi (>=0.103.2); extra == "api"
|
|
28
28
|
Requires-Dist: httpx (>=0.25.0); extra == "http"
|
|
29
|
-
Requires-Dist: minio (>=7.
|
|
29
|
+
Requires-Dist: minio (>=7.2.0); extra == "s3-minio"
|
|
30
30
|
Requires-Dist: psycopg (>=3.1.12); extra == "pg-sync"
|
|
31
|
-
Requires-Dist: pydantic (>=
|
|
31
|
+
Requires-Dist: pydantic (>=2); extra == "api"
|
|
32
32
|
Requires-Dist: python-json-logger (>=2.0.4); extra == "logs"
|
|
33
33
|
Requires-Dist: rich (>=13.6.0); extra == "pg"
|
|
34
34
|
Project-URL: Repository, https://github.com/tracktor/tracktolib
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "tracktolib"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.44.0"
|
|
4
4
|
description = "Utility library for python"
|
|
5
5
|
authors = ["Julien Brayere <julien.brayere@tracktor.fr>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -20,12 +20,12 @@ python = ">=3.10,<4.0"
|
|
|
20
20
|
|
|
21
21
|
python-json-logger = { version = ">=2.0.4", optional = true }
|
|
22
22
|
psycopg = { version = ">=3.1.12", optional = true }
|
|
23
|
-
minio = { version = ">=7.
|
|
24
|
-
aiobotocore = { version = ">=2.
|
|
23
|
+
minio = { version = ">=7.2.0", optional = true }
|
|
24
|
+
aiobotocore = { version = ">=2.9.0", optional = true }
|
|
25
25
|
deepdiff = { version = ">=6.6.0", optional = true }
|
|
26
26
|
httpx = { version = ">=0.25.0", optional = true }
|
|
27
27
|
fastapi = { version = ">=0.103.2", optional = true }
|
|
28
|
-
pydantic = { version = ">=
|
|
28
|
+
pydantic = { version = ">=2", optional = true }
|
|
29
29
|
asyncpg = ">=0.27.0"
|
|
30
30
|
rich = { version = ">=13.6.0", optional = true }
|
|
31
31
|
|
|
@@ -45,13 +45,9 @@ pyright = "^1.1.284"
|
|
|
45
45
|
commitizen = "^3.11.0"
|
|
46
46
|
pytest = "^7.2.0"
|
|
47
47
|
pytest-cov = "^4.0.0"
|
|
48
|
-
pydantic = ">=
|
|
48
|
+
pydantic = ">=2,<3"
|
|
49
49
|
ruff = "^0.1.6"
|
|
50
50
|
|
|
51
|
-
[tool.poetry.group.pydantic-v2.dependencies]
|
|
52
|
-
pydantic = ">=2"
|
|
53
|
-
|
|
54
|
-
|
|
55
51
|
[build-system]
|
|
56
52
|
requires = ["poetry-core"]
|
|
57
53
|
build-backend = "poetry.core.masonry.api"
|
|
@@ -74,7 +70,7 @@ pythonPlatform = "Linux"
|
|
|
74
70
|
|
|
75
71
|
[tool.commitizen]
|
|
76
72
|
name = "cz_conventional_commits"
|
|
77
|
-
version = "0.
|
|
73
|
+
version = "0.44.0"
|
|
78
74
|
tag_format = "$version"
|
|
79
75
|
version_files = [
|
|
80
76
|
"pyproject.toml:version"
|
|
@@ -9,18 +9,18 @@ package_data = \
|
|
|
9
9
|
|
|
10
10
|
extras_require = \
|
|
11
11
|
{':extra == "pg"': ['asyncpg>=0.27.0'],
|
|
12
|
-
'api': ['fastapi>=0.103.2', 'pydantic>=
|
|
12
|
+
'api': ['fastapi>=0.103.2', 'pydantic>=2'],
|
|
13
13
|
'http': ['httpx>=0.25.0'],
|
|
14
14
|
'logs': ['python-json-logger>=2.0.4'],
|
|
15
15
|
'pg': ['rich>=13.6.0'],
|
|
16
16
|
'pg-sync': ['psycopg>=3.1.12'],
|
|
17
|
-
's3': ['aiobotocore>=2.
|
|
18
|
-
's3-minio': ['minio>=7.
|
|
17
|
+
's3': ['aiobotocore>=2.9.0'],
|
|
18
|
+
's3-minio': ['minio>=7.2.0'],
|
|
19
19
|
'tests': ['deepdiff>=6.6.0']}
|
|
20
20
|
|
|
21
21
|
setup_kwargs = {
|
|
22
22
|
'name': 'tracktolib',
|
|
23
|
-
'version': '0.
|
|
23
|
+
'version': '0.44.0',
|
|
24
24
|
'description': 'Utility library for python',
|
|
25
25
|
'long_description': "# Tracktolib\n\n[](https://pypi.python.org/pypi/tracktolib)\n[](https://pypi.python.org/pypi/tracktolib)\n[](https://app.circleci.com/pipelines/github/Tracktor/tracktolib?branch=master)\n\nUtility library for python\n\n# Installation\n\nYou can choose to not install all the dependencies by specifying\nthe [extra](https://python-poetry.org/docs/cli/#options-4) parameter such as:\n\n```bash\npoetry add tracktolib@latest -E pg-sync -E tests --group dev \n```\n\nHere we only install the utilities using `psycopg` (pg-sync) and `deepdiff` (tests) for the dev environment.\n\n# Utilities\n\n- **log**\n\nUtility functions for logging.\n\n```python\nimport logging\nfrom tracktolib.logs import init_logging\n\nlogger = logging.getLogger()\nformatter, stream_handler = init_logging(logger, 'json', version='0.0.1')\n```\n\n- **pg**\n\nUtility functions for [asyncpg](https://github.com/MagicStack/asyncpg)\n\n- **pg-sync**\n\nUtility functions based on psycopg such as `fetch_one`, `insert_many`, `fetch_count` ...\n\nTo use the functions, create a `Connection` using psycopg: `conn = psycopg2.connect()`\n\n*fetch_one*\n\n```python\nfrom pg.pg_sync import (\n insert_many, fetch_one, fetch_count, fetch_all\n)\n\ndata = [\n {'foo': 'bar', 'value': 1},\n {'foo': 'baz', 'value': 2}\n]\ninsert_many(conn, 'public.test', data) # Will insert the 2 dict\nquery = 'SELECT foo from public.test order by value asc'\nvalue = fetch_one(conn, query, required=True) # Will return {'foo': 'bar'}, raise an error is not found\nassert fetch_count(conn, 'public.test') == 2\nquery = 'SELECT * from public.test order by value asc'\nassert fetch_all(conn, query) == data\n\n```\n\n- **tests**\n\nUtility functions for testing\n\n- **s3-minio**\n\nUtility functions for [minio](https://min.io/docs/minio/linux/developers/python/API.html)\n\n- **s3**\n\nUtility functions for [aiobotocore](https://github.com/aio-libs/aiobotocore)\n\n- **logs**\n\nUtility functions to initialize the logging formatting and streams\n\n- **http**\n\nUtility functions using [httpx](https://www.python-httpx.org/)\n\n- **api**\n\nUtility functions using [fastapi](https://fastapi.tiangolo.com/)\n",
|
|
26
26
|
'author': 'Julien Brayere',
|
|
@@ -19,13 +19,13 @@ from typing import (
|
|
|
19
19
|
get_origin,
|
|
20
20
|
)
|
|
21
21
|
|
|
22
|
-
from .utils import json_serial
|
|
22
|
+
from .utils import json_serial
|
|
23
23
|
|
|
24
24
|
try:
|
|
25
25
|
from fastapi import params, APIRouter
|
|
26
26
|
from fastapi.responses import JSONResponse
|
|
27
|
-
import
|
|
28
|
-
from pydantic import BaseModel
|
|
27
|
+
from pydantic.alias_generators import to_camel
|
|
28
|
+
from pydantic import BaseModel, ConfigDict
|
|
29
29
|
import starlette.status
|
|
30
30
|
except ImportError:
|
|
31
31
|
raise ImportError('Please install fastapi, pydantic or tracktolib with "api" to use this module')
|
|
@@ -266,19 +266,8 @@ def model_to_list(string: str) -> str:
|
|
|
266
266
|
return f"Array[{string}]"
|
|
267
267
|
|
|
268
268
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
class CamelCaseModel(BaseModel): # type: ignore
|
|
272
|
-
class Config:
|
|
273
|
-
alias_generator = to_camel_case
|
|
274
|
-
allow_population_by_field_name = True
|
|
275
|
-
|
|
276
|
-
else:
|
|
277
|
-
from pydantic import ConfigDict
|
|
278
|
-
from pydantic.alias_generators import to_camel
|
|
279
|
-
|
|
280
|
-
class CamelCaseModel(BaseModel):
|
|
281
|
-
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
|
|
269
|
+
class CamelCaseModel(BaseModel):
|
|
270
|
+
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
|
|
282
271
|
|
|
283
272
|
|
|
284
273
|
def check_status(resp, status: int = starlette.status.HTTP_200_OK):
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import asyncio
|
|
1
2
|
import datetime as dt
|
|
3
|
+
import importlib.util
|
|
2
4
|
import itertools
|
|
3
5
|
import mmap
|
|
4
6
|
import os
|
|
@@ -7,8 +9,6 @@ from decimal import Decimal
|
|
|
7
9
|
from ipaddress import IPv4Address, IPv6Address
|
|
8
10
|
from pathlib import Path
|
|
9
11
|
from typing import Iterable, TypeVar, Iterator, Literal, overload, Any
|
|
10
|
-
import importlib.util
|
|
11
|
-
import asyncio
|
|
12
12
|
|
|
13
13
|
T = TypeVar("T")
|
|
14
14
|
|
|
@@ -85,6 +85,8 @@ def json_serial(obj):
|
|
|
85
85
|
return str(obj)
|
|
86
86
|
if isinstance(obj, Decimal):
|
|
87
87
|
return str(obj)
|
|
88
|
+
if hasattr(obj, "__dict__"):
|
|
89
|
+
return obj.__dict__
|
|
88
90
|
raise TypeError(f"Type '{type(obj)}' not serializable")
|
|
89
91
|
|
|
90
92
|
|
|
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
|