diff --git a/build-requirements.txt b/build-requirements.txt index 128aa165423eb3690bf5db0d3f75954051427d19..eb9933ff7b5f3cf99ebd3b6e22204460fa9cdf4e 100644 --- a/build-requirements.txt +++ b/build-requirements.txt @@ -1,46 +1,2 @@ -appdirs==1.4.4 -backports.entry-points-selectable==1.3.0 -bleach==6.1.0 -build==1.1.1 -certifi==2024.2.2 -chardet==5.2.0 -charset-normalizer==3.3.2 -check-manifest==0.49 -colorama==0.4.6 -distlib==0.3.8 -docutils==0.20.1 -filelock==3.13.1 -flake8==7.0.0 -grpcio==1.62.1 -grpcio-tools==1.57.0 -idna==3.6 -importlib-metadata==7.0.2 -keyring==24.3.1 -lazy==1.6 -mccabe==0.7.0 -packaging==24.0 -pep517==0.13.1 -pkginfo==1.10.0 -platformdirs==4.2.0 -pluggy==1.4.0 -protobuf==4.24.2 -py==1.11.0 -pycodestyle==2.11.1 -pyflakes==3.2.0 -Pygments==2.17.2 -pyparsing==3.1.2 -readme-renderer==43.0 -requests==2.31.0 -requests-toolbelt==1.0.0 -rfc3986==2.0.0 -six==1.16.0 -toml==0.10.2 -tomli==2.0.1 -tox==4.14.1 -tqdm==4.66.2 -twine==5.0.0 -typing_extensions==4.10.0 -urllib3==2.2.1 -virtualenv==20.25 -webencodings==0.5.1 -zipp==3.18.1 +flake8==7.1.2 +grpcio-tools==1.67.1 diff --git a/perxis-proto b/perxis-proto index f10336dc4a4f58111c12dd95afec82be18388803..0627c9f829178bc6de2623a0b6d42964c44de496 160000 --- a/perxis-proto +++ b/perxis-proto @@ -1 +1 @@ -Subproject commit f10336dc4a4f58111c12dd95afec82be18388803 +Subproject commit 0627c9f829178bc6de2623a0b6d42964c44de496 diff --git a/perxis/collections/helpers.py b/perxis/collections/helpers.py index 06ad1e1e3f106d9d8c0ae174e8200e8d3739b1ce..44c99f8dceef08f1ca76c0983638528370056bb0 100644 --- a/perxis/collections/helpers.py +++ b/perxis/collections/helpers.py @@ -1,7 +1,12 @@ from perxis.collections import collections_pb2 +from typing import TypedDict +from typing_extensions import deprecated -def make_collection_instances(schemes_dir: str, schemes_mapping: dict[str, str]) -> list[collections_pb2.Collection]: +@deprecated("This function is deprecated. Use `init_collections` instead.") +def make_collection_instances( + schemes_dir: str, schemes_mapping: dict[str, str] +) -> list[collections_pb2.Collection]: collections = [] for collection_id, collection_name in schemes_mapping.items(): @@ -13,7 +18,34 @@ def make_collection_instances(schemes_dir: str, schemes_mapping: dict[str, str]) name=collection_name, schema=collection_schema ) - collections.append(collection) + return collections + + +class CollectionProps(TypedDict): + single: bool + system: bool + no_data: bool + hidden: bool - return collections \ No newline at end of file + +def init_collections( + schemes_dir: str, + schemes_mapping: dict[str, str], + collections_settings_mapping: dict[str, CollectionProps], +) -> list[collections_pb2.Collection]: + + collections = [] + for collection_id, collection_name in schemes_mapping.items(): + with open(f"{schemes_dir}/{collection_id}.json", "r") as file: + collection_schema = file.read() + + kwargs = { + **(collections_settings_mapping.get(collection_id) or {}), + "id": collection_id, + "name": collection_name, + "schema": collection_schema, + } + collection = collections_pb2.Collection(**kwargs) + collections.append(collection) + return collections diff --git a/requirements.txt b/requirements.txt index de92370a788386046a20c65212c4e663e7de121e..16c8359b71b62d96c933ff330bbb4d1a98b6ddee 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,17 +1,17 @@ aiocron==1.8 -aiohttp==3.9.3 +aiohttp==3.10.11 aiofile==3.8.8 asyncstdlib==3.10.8 -certifi==2024.2.2 +certifi==2024.7.4 chardet==5.2.0 charset-normalizer==3.3.2 -grpcio==1.57.0 -idna==3.6 +grpcio==1.67.1 +idna==3.7 oauthlib==3.2.2 -protobuf==4.24.2 +protobuf==5.29.3 PyJWT==2.8.0 -requests==2.31.0 +requests==2.32.0 requests-oauthlib==1.4.0 six==1.16.0 -urllib3==2.2.1 +urllib3==2.2.2 deepdiff==6.7.1 diff --git a/setup.py b/setup.py index 210545e031b37284a61243f5301e122847727fa2..84d4659015bf46eb40ad3d806f2bb269d8af0557 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ def load_requirements(): setup( name='perxis', - version='1.7.3', + version='1.8.0', description='Perxis python client', long_description=long_description, long_description_content_type='text/markdown',