Skip to content

Python SDK: expose get_me, get_client and get_clients #4015

Description

@justinmclean

Description

The Rust client can report the currently connected client and enumerate all connected clients (core/common/src/traits/system_client.rs). The Python SDK exposes none of it, so a Python operator cannot see connection state that every other SDK can. Part of the parity work tracked in #3893.

async fn get_me(&self) -> Result<ClientInfoDetails, IggyError>;
async fn get_client(&self, client_id: u32) -> Result<Option<ClientInfoDetails>, IggyError>;
async fn get_clients(&self) -> Result<Vec<ClientInfo>, IggyError>;

get_client and get_clients require permission to read server info; get_me requires authentication only.

Affected area / component

Python SDK

Proposed solution

  • Add foreign/python/src/client_info.rs wrapping ClientInfo and ClientInfoDetails, following src/user.rs (pyclass + From conversions + gen_stub_pyclass), and register it in src/lib.rs.
  • Add the three methods to src/client.rs. get_client returns None when the id is unknown rather than raising.
  • Add the stub entries to foreign/python/apache_iggy.pyi.
  • Add foreign/python/tests/test_client_info.py: assert get_me() returns the connected client, that its id appears in get_clients(), and that get_client() on an unknown id returns None.

Alternatives considered

No response

Contribution

  • I'm willing to submit a pull request to implement this feature

Good first issue

  • I think this could be a good first issue for a new contributor

Metadata

Metadata

Labels

good first issueGood for newcomerspythonPull requests that update Python code

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions