users

module wandb.apis.public

W&B Public API for User Management.

This module provides classes for managing W&B users and their API keys. Classes include:

User: Manage W&B user accounts and authentication

  • Create new users
  • Generate and manage API keys
  • Access team memberships
  • Handle user properties and permissions

Note:

This module is part of the W&B Public API and provides methods to manage users and their authentication. Some operations require admin privileges.


class User

A class representing a W&B user with authentication and management capabilities.

This class provides methods to manage W&B users, including creating users, managing API keys, and accessing team memberships. It inherits from Attrs to handle user attributes.

Args:

  • client: (wandb.apis.internal.Api) The client instance to use
  • attrs: (dict) The user attributes

Note:

Some operations require admin privileges

method User.__init__

__init__(client, attrs)

property User.api_keys

List of API key names associated with the user.

Returns:

  • list[str]: Names of API keys associated with the user. Empty list if user has no API keys or if API key data hasn’t been loaded.

property User.teams

List of team names that the user is a member of.

Returns:

  • list (list): Names of teams the user belongs to. Empty list if user has no team memberships or if teams data hasn’t been loaded.

property User.user_api

An instance of the api using credentials from the user.


classmethod User.create

create(api, email, admin=False)

Create a new user.

Args:

  • api (Api): The api instance to use
  • email (str): The name of the team
  • admin (bool): Whether this user should be a global instance admin

Returns: A User object


method User.delete_api_key

delete_api_key(api_key)

Delete a user’s api key.

Args:

  • api_key (str): The name of the API key to delete. This should be one of the names returned by the api_keys property.

Returns: Boolean indicating success

Raises: ValueError if the api_key couldn’t be found


method User.generate_api_key

generate_api_key(description=None)

Generate a new api key.

Args:

  • description (str, optional): A description for the new API key. This can be used to identify the purpose of the API key.

Returns: The new api key, or None on failure