From 220b469f33276d76594a57439d946dbaff3bcd01 Mon Sep 17 00:00:00 2001 From: teplyakov <teolyakov@perx.ru> Date: Tue, 18 Feb 2025 15:47:26 +0300 Subject: [PATCH 1/4] feat: AUTO-3805 Update requirements --- perxis-proto | 2 +- requirements.txt | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/perxis-proto b/perxis-proto index f10336d..0627c9f 160000 --- a/perxis-proto +++ b/perxis-proto @@ -1 +1 @@ -Subproject commit f10336dc4a4f58111c12dd95afec82be18388803 +Subproject commit 0627c9f829178bc6de2623a0b6d42964c44de496 diff --git a/requirements.txt b/requirements.txt index de92370..13a0165 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,17 +1,18 @@ 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 +idna==3.7 oauthlib==3.2.2 protobuf==4.24.2 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 + -- GitLab From e559a25d72fb6710842fa3f0f7bfcb90ee3df30c Mon Sep 17 00:00:00 2001 From: teplyakov <teolyakov@perx.ru> Date: Tue, 18 Feb 2025 17:41:44 +0300 Subject: [PATCH 2/4] feat: AUTO-3805 Add init_collections function --- perxis/collections/helpers.py | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/perxis/collections/helpers.py b/perxis/collections/helpers.py index 06ad1e1..f0398f8 100644 --- a/perxis/collections/helpers.py +++ b/perxis/collections/helpers.py @@ -1,7 +1,11 @@ from perxis.collections import collections_pb2 +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 +17,27 @@ def make_collection_instances(schemes_dir: str, schemes_mapping: dict[str, str]) name=collection_name, schema=collection_schema ) - collections.append(collection) + return collections + + +def init_collections( + schemes_dir: str, + schemes_mapping: dict[str, str], + collections_settings_mapping: dict[str, dict[str, ...]], +) -> list[collections_pb2.Collection]: - return collections \ No newline at end of file + 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 -- GitLab From 3034910b2ff4fa3ccae85c33d730f61f34ae42dd Mon Sep 17 00:00:00 2001 From: teplyakov <teolyakov@perx.ru> Date: Wed, 19 Feb 2025 14:47:36 +0300 Subject: [PATCH 3/4] feat: AUTO-3805 Update requirements --- build-requirements.txt | 48 ++--------------------------------- perxis/collections/helpers.py | 3 ++- requirements.txt | 5 ++-- 3 files changed, 6 insertions(+), 50 deletions(-) diff --git a/build-requirements.txt b/build-requirements.txt index 128aa16..eb9933f 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/collections/helpers.py b/perxis/collections/helpers.py index f0398f8..33aeb71 100644 --- a/perxis/collections/helpers.py +++ b/perxis/collections/helpers.py @@ -1,4 +1,5 @@ from perxis.collections import collections_pb2 +from typing import TypedDict from typing_extensions import deprecated @@ -24,7 +25,7 @@ def make_collection_instances( def init_collections( schemes_dir: str, schemes_mapping: dict[str, str], - collections_settings_mapping: dict[str, dict[str, ...]], + collections_settings_mapping: dict[str, TypedDict], ) -> list[collections_pb2.Collection]: collections = [] diff --git a/requirements.txt b/requirements.txt index 13a0165..16c8359 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,14 +5,13 @@ asyncstdlib==3.10.8 certifi==2024.7.4 chardet==5.2.0 charset-normalizer==3.3.2 -grpcio==1.57.0 +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.32.0 requests-oauthlib==1.4.0 six==1.16.0 urllib3==2.2.2 deepdiff==6.7.1 - -- GitLab From af149a212b0f243d3b72a5511e78507a5fd5488f Mon Sep 17 00:00:00 2001 From: teplyakov <teolyakov@perx.ru> Date: Wed, 19 Feb 2025 15:19:08 +0300 Subject: [PATCH 4/4] feat: AUTO-3805 Update version --- perxis/collections/helpers.py | 9 ++++++++- setup.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/perxis/collections/helpers.py b/perxis/collections/helpers.py index 33aeb71..44c99f8 100644 --- a/perxis/collections/helpers.py +++ b/perxis/collections/helpers.py @@ -22,10 +22,17 @@ def make_collection_instances( return collections +class CollectionProps(TypedDict): + single: bool + system: bool + no_data: bool + hidden: bool + + def init_collections( schemes_dir: str, schemes_mapping: dict[str, str], - collections_settings_mapping: dict[str, TypedDict], + collections_settings_mapping: dict[str, CollectionProps], ) -> list[collections_pb2.Collection]: collections = [] diff --git a/setup.py b/setup.py index 210545e..84d4659 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', -- GitLab