Skip to content

Conversation

@arkadiuszlis
Copy link
Collaborator

@arkadiuszlis arkadiuszlis commented Nov 5, 2025

To complete the server-side check, send Python SDK version as metadata in get_version .
Also, add a get_version call when:

  1. Calling __init__ of the synch connection
  2. Creating the async session in the context manager

We call the get_version from different places in sync/async connection because it is not possible to reliably await
a get_version in 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


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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Internal linking using refs?

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>`.
Copy link
Collaborator

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?

Comment on lines +29 to +30
def get_min_server_version() -> str:
return MINIMUM_SERVER_VERSION
Copy link
Collaborator

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.

Comment on lines +1 to +4
from dataclasses import dataclass
import re
from typing import Optional
from importlib import metadata
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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?

Comment on lines +37 to +42
from volue.mesh._version_compatibility import (
get_client_version,
get_min_server_version,
get_client_version_metadata_key,
to_parsed_version,
)
Copy link
Collaborator

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 (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isort

Copy link
Collaborator

@tnoczyns-volue tnoczyns-volue left a 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()
Copy link
Collaborator

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.
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python api should only support a range of mesh server versions

3 participants