whylogs.api.whylabs#

Package Contents#

Functions#

init(→ whylogs.api.whylabs.session.session.Session)

Set up authentication for this whylogs logging session. There are three modes that you can authentiate in.

whylogs.api.whylabs.init(reinit: bool = False, allow_anonymous: bool = True, allow_local: bool = False, whylabs_api_key: Optional[str] = None, default_dataset_id: Optional[str] = None, config_path: Optional[str] = None, **kwargs: bool) whylogs.api.whylabs.session.session.Session#

Set up authentication for this whylogs logging session. There are three modes that you can authentiate in.

  1. WHYLABS: Data is sent to WhyLabs and is associated with a specific WhyLabs account. You can get a WhyLabs api

    key from the WhyLabs Settings page after logging in.

  2. WHYLABS_ANONYMOUS: Data is sent to WhyLabs, but no authentication happens and no WhyLabs account is required.

    Sessions can be claimed into an account later on the WhyLabs website.

  3. LOCAL: No authentication. No data is automatically sent anywhere. Use this if you want to explore profiles

    locally or manually upload them somewhere.

Typically, you should only have to put why.init() with no arguments at the start of your application/notebook/script. The arguments allow for some customization of the logic that determines the session type. Here is the priority order:

  • If there is an api key directly supplied to init, then use it and authenticate session as WHYLABS.

  • If there is an api key in the environment variable WHYLABS_API_KEY, then use it and authenticate session as WHYLABS.

  • If there is an api key in the whylogs config file, then use it and authenticate session as WHYLABS.

  • If we’re in an interractive environment (notebook, colab, etc.) then prompt the user to pick a method explicitly.

    The options are determined by the allow* argument values to init().

  • If allow_anonymous is True, then authenticate session as WHYLABS_ANONYMOUS.

  • If allow_local is True, then authenticate session as LOCAL.

Parameters
  • session_type – Deprecated, use allow_anonymous and allow_local instead

  • reinit (bool) – Normally, init() is idempotent, so you can run it over and over again in a notebook without any issues, for example. If reinit=True then it will run the initialization logic again, so you can switch authentication methods without restarting.

  • allow_anonymous (bool) – If True, then the user will be able to choose WHYLABS_ANONYMOUS if no other authentication method is found.

  • allow_local (bool) – If True, then the user will be able to choose LOCAL if no other authentication method is found.

  • whylabs_api_key (Optional[str]) – A WhyLabs api key to use for uploading profiles. There are other ways that you can set an api key that don’t require direclty embedding it in code, like setting WHYLABS_API_KEY env variable or supplying the api key interractively via the init() prompt in a notebook.

  • default_dataset_id (Optional[str]) – The default dataset id to use for uploading profiles. This is only used if the session is authenticated. This is a convenience argument so that you don’t have to supply the dataset id every time you upload a profile if you’re only using a single dataset id.

  • config_path (Optional[str]) –

  • kwargs (bool) –

Return type

whylogs.api.whylabs.session.session.Session