-
Notifications
You must be signed in to change notification settings - Fork 0
Version compatibility checks #583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
docs/source/installation.rst
Outdated
|
|
||
| The Mesh Python SDK will perform the version compatibility check when connecting to the Mesh server. | ||
| It will ask the server for its version number and will validate it according to the rules | ||
| found in the `Versions <https://volue-public.github.io/energy-mesh-python/versions.html>` section. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Internal linking using refs?
docs/source/installation.rst
Outdated
| The Mesh server will also perform the version compatibility check based on the version | ||
| sent by the Mesh Python SDK. For the version metadata to be correctly populated, | ||
| the `volue.mesh` package should be installed using the | ||
| `recommended procedure <https://volue-public.github.io/energy-mesh-python/installation.html#setup-for-users-recommended>`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it is worth to mention how is it sent (via gRPC metadata) and what will happen if you run the lib from source?
| def get_min_server_version() -> str: | ||
| return MINIMUM_SERVER_VERSION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type hint is not compatible with the actually returned type.
| from dataclasses import dataclass | ||
| import re | ||
| from typing import Optional | ||
| from importlib import metadata |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| from dataclasses import dataclass | |
| import re | |
| from typing import Optional | |
| from importlib import metadata | |
| import re | |
| from dataclasses import dataclass | |
| from importlib import metadata | |
| from typing import Optional |
isort?
| from volue.mesh._version_compatibility import ( | ||
| get_client_version, | ||
| get_min_server_version, | ||
| get_client_version_metadata_key, | ||
| to_parsed_version, | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isort
| _to_proto_guid, | ||
| _to_proto_resolution, | ||
| ) | ||
| from volue.mesh._version_compatibility import ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isort
tnoczyns-volue
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be good to add tests with mocked connection (and get_version return) to Mesh?
| ) | ||
|
|
||
| async def open(self) -> None: | ||
| version_info = await self.connection.get_version() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe directly using:
await self.config_service.GetVersion(
protobuf.empty_pb2.Empty(), metadata=metadata
)Is a nice alternative? We wouldn't need to add connection to Session and we wouldn't send metadata in the user facing get_version?
| Version compatibility | ||
| ===================== | ||
|
|
||
| The Mesh Python SDK will perform the version compatibility check when connecting to the Mesh server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd still state that for aio we do the compatibility check when creating session.
To complete the server-side check, send Python SDK version as metadata in
get_version.Also, add a
get_versioncall when:__init__of the synch connectionWe call the
get_versionfrom different places in sync/async connection because it is not possible to reliablyawaita
get_versionin the async connection__init__. In the async context, this means the compatibility check will be ran on session create not on connection create.Related to https://github.com/Volue/energy-mesh/pull/7960 and https://github.com/Volue/energy-mesh/issues/5604
Fixes #70