Manager¶
The Manager is the high-level entry point for most users.
It wraps an authenticated ApiClient and offers helper methods
that reduce boilerplate when running avatarizations.
Why use the Manager?¶
Single place to authenticate.
Shortcuts to create a
Runnerand load YAML configs.Convenience helpers to inspect recent jobs / results.
See also
For detailed information about configuring the Manager to connect to different servers (SaaS vs on-premise), authentication methods, and advanced configuration options, see Configuration.
Quick example¶
Using username/password authentication:
from avatars import Manager
manager = Manager()
manager.authenticate(username="user", password="pass")
runner = manager.create_runner(set_name="demo")
runner.add_table("wbcd", "fixtures/wbcd.csv")
runner.set_parameters("wbcd", k=15)
runner.run()
Detailed reference¶
- class avatars.manager.Manager(base_url: str | None = None, *, api_client: ApiClient | None = None, api_key: str | None = None, config: ClientConfig | None = None)[source]
Bases:
objectHigh-level convenience facade for interacting with the Avatar API.
The
Managerwraps an authenticatedavatars.client.ApiClientinstance and exposes a small, task‑oriented surface area so end users can:authenticate once (
authenticate) or use API key authenticationspin up a
avatars.runner.Runner(create_runner/create_runner_from_yaml)quickly inspect recent jobs & results (
get_last_jobs/get_last_results)perform simple platform health checks (
get_health)handle password reset flows (
forgotten_password/reset_password)
It deliberately hides the lower-level resource clients (
jobs,results,datasets…) unless you access the underlyingauth_clientdirectly. This keeps common workflows succinct while preserving an escape hatch for advanced usage. TheRunnerobjects created through the manager inherit the authenticated context, so you rarely have to pass tokens or low-level clients around manually.- auth_client
The underlying
avatars.client.ApiClientused to perform all HTTP requests.
- authenticate(username: str, password: str, should_verify_compatibility: bool | None = None) None[source]
Authenticate the user with the given username and password.
Note: This method should not be called if the Manager was initialized with an api_key. API key authentication is already active and doesn’t require calling authenticate().
- forgotten_password(email: str) None[source]
Send a forgotten password email to the user.
- reset_password(email: str, new_password: str, new_password_repeated: str, token: str | UUID) None[source]
Reset the password of the user.
- create_runner(set_name: str, seed: int | None = None, max_distribution_plots: int | None = None) Runner[source]
Create a new runner.
- get_last_results(count: int = 1) list[dict[str, str]][source]
Get the last n results.
- get_last_jobs(count: int = 1) dict[str, JobWithDisplayNameResponse][source]
Get the last n results.
- get_health() dict[str, str][source]
Get the health of the server.
- create_runner_from_yaml(yaml_path: str, set_name: str) Runner[source]
Create a new runner from a yaml file. :param yaml_path: :type yaml_path: The path to the yaml file. :param set_name: :type set_name: Name of the set of resources.