atoti.config package

Submodules

atoti.config.parsing module

exception atoti.config.parsing.ConfigParsingError(message, parsed_object=None)

Bases: ValueError

Error raised when the parsing of the config failed.

Module contents

class atoti.config.SessionConfiguration(inherit, port, url_pattern, metadata_db, roles, authentication, sampling_mode, max_memory, java_args, i18n_directory, default_locale)

Bases: atoti._serialization_utils.FromDict, atoti.config._utils.Mergeable

Configuration of the session.

authentication: Optional[Auth] = None
default_locale: Optional[str] = None
i18n_directory: Optional[Union[Path, str]] = None
inherit: bool = None
java_args: Optional[Collection[str]] = None
max_memory: Optional[str] = None
metadata_db: Optional[str] = None
port: Optional[int] = None
roles: Optional[Collection[Role]] = None
sampling_mode: Optional[SamplingMode] = None
url_pattern: Optional[str] = None
atoti.config.create_config(*, inherit=True, port=None, url_pattern=None, metadata_db=None, roles=None, authentication=None, sampling_mode=None, max_memory=None, java_args=None, i18n_directory=None, default_locale=None)

Create a configuration.

Parameters
  • inherit (bool) – Whether this config should be merged with the default config if it exists.

  • port (Optional[int]) – The port on which the session will be exposed. Defaults to a random available port.

  • url_pattern (Optional[str]) – The pattern of the public URL of the session. The {host} and {port} placeholders will be replaced with, respectively, the actual host address and port number. If None, defaults to http://localhost:{port}.

  • metadata_db (Optional[str]) – The description of the database where the session’s metadata will be stored. It is the path to a file, which will be created if needed.

  • roles (Optional[Collection[Role]]) – The roles and their restrictions.

  • authentication (Optional[Auth]) – The authentication used by the server.

  • sampling_mode (Optional[SamplingMode]) –

    The sampling mode describing how files are loaded into the stores. It’s faster to build the data model when only part of the data is loaded.

    Modes are available in atoti.sampling.

    If atoti.sampling.FULL isn’t passed, call load_all_data() to load everything once the model definition is done.

  • max_memory (Optional[str]) – Max memory allocated to each session. Actually sets the -Xmx JVM parameter. The format is a string containing a number followed by a unit among G, M and K. For instance: 64G. Defaults to the JVM default memory which is 25% of the machine memory.

  • java_args (Optional[Collection[str]]) – Collection of additional arguments to pass to the Java process. For instance: ["-verbose:gc", "-Xms1g", "-XX:+UseG1GC"].

  • i18n_directory (Union[Path, str, None]) –

    The directory from which translation files will be loaded. It should contain a list of files (one per locale) named after the locale they contain translations for (i.e. en-US.json for US translations). The application will behave differently depending on how the metadata_db is configured:

    • If a local metadata_db, backed by a file, has been configured:

      • If a value is specified for i18n_directory those files will be uploaded to the local metadata_db, overriding any previously defined translations.

      • If no value is specified for i18n_directory the default translations for atoti will be uploaded to the local metadata_db

    • If a remote metadata_db has been configured:

      • If a value is specified for i18n_directory this data will be pushed to the remote metadata_db, overriding any previously existing values

      • If no value has been specified for i18n_directory and translations exist in the remote metadata_db, those values will be loaded into the session

      • If no value has been specified for i18n_directory and no translations exist in the remote metodata_db, the default translations for atoti will be uploaded to the remote metadata_db

  • default_locale (Optional[str]) – The default locale to use for internationalizing the session.

Return type

SessionConfiguration

atoti.config.create_role(name, *, restrictions=None)

Create a role with the given restrictions.

Parameters
Return type

Role

atoti.config.create_basic_user(name, password, *, roles=None)

Create a basic user with roles.

Parameters
Return type

BasicUser

atoti.config.create_basic_authentication(users, *, realm=None)

Create a basic authentication.

Parameters
  • users (Collection[BasicUser]) – The list of users that can authenticate against the session.

  • realm (Optional[str]) – The realm describing the protected area. Different realms can be used to isolate sessions running on the same domain (regardless of the port). The realm will also be displayed by the browser when prompting for credentials. Defaults to f"{session_name} atoti session at {session_id}".

Return type

BasicAuthentication

atoti.config.create_oidc_authentication(*, provider_id=None, issuer_url=None, client_id=None, client_secret=None, name_attribute=None, paths_to_authorities=None, scopes=None, role_mapping=None)

Create an OpenID connect authentication.

Parameters
  • provider_id (Optional[str]) – The name of your provider. This string is used to build the redirectUrl using this template {baseUrl}:{port}/login/oauth2/code/{providerId} .

  • issuer_url (Optional[str]) – The issuer URL parameter from your provider’s OpenID connect configuration endpoint.

  • client_id (Optional[str]) – Your app’s clientId, obtained from your authentication provider.

  • client_secret (Optional[str]) – Your app’s clientSecret, obtained from your authentication provider.

  • name_attribute (Optional[str]) – The key in the IdToken of the parameter to display as the username in the application.

  • paths_to_authorities (Optional[Collection[str]]) – The location of the authoritios to use for atoti in the returned access token or id token.

  • scopes (Optional[Collection[str]]) – The scopes to request from the authentication provider (e.g. : email, username, etc.).

  • role_mapping (Optional[Mapping[str, Collection[str]]]) – The mapping between the roles returned by the authentication provider and the corresponding roles to use in atoti.

Return type

OidcAuthentication

class atoti.config.BasicUser(name, password, roles=<factory>)

Bases: atoti._serialization_utils.FromDict

Basic user with roles.

name: str = None
password: str = None
roles: Collection[str] = None
class atoti.config.BasicAuthentication(users, realm=None)

Bases: atoti.config._auth.Auth, atoti.config._utils.Mergeable

Basic authentication.

realm: Optional[str] = None
users: Collection[BasicUser] = None
class atoti.config.OidcAuthentication(provider_id, issuer_url, client_id, client_secret, name_attribute, paths_to_authorities, scopes, role_mapping)

Bases: atoti.config._auth.Auth, atoti.config._utils.Mergeable

OpenID connect authentication.

client_id: Optional[str] = None
client_secret: Optional[str] = None
issuer_url: Optional[str] = None
name_attribute: Optional[str] = None
paths_to_authorities: Optional[Collection[str]] = None
provider_id: Optional[str] = None
role_mapping: Optional[Mapping[str, Collection[str]]] = None
scopes: Optional[Collection[str]] = None