Users#
Here we describe how to manage users in Argilla via the Python client.
- class argilla.client.users.User(name=None, *, id=None)#
The User class is used to manage users in Argilla. It provides methods to create new users, list all the users, get a user by its name or ID, and delete it. While itโs not allowed to update the user information for the moment.
- Parameters:
name (Optional[str]) โ the name of the user to be managed. Defaults to None.
id (Optional[Union[str, UUID]]) โ the ID of the user to be managed. Defaults to None.
- __client#
the httpx.Client initialized to interact with the Argilla API.
- id#
the ID of the user.
- Type:
uuid.UUID
- username#
the username of the user.
- Type:
str
- first_name#
the first name of the user.
- Type:
str
- last_name#
the last name of the user. Defaults to None.
- Type:
Optional[str]
- full_name#
the full name of the user. Defaults to None.
- Type:
Optional[str]
- role#
the role of the user.
- Type:
argilla.client.sdk.users.models.UserRole
- workspaces#
the list of workspaces the user is linked to. Defaults to None.
- Type:
Optional[List[str]]
- api_key#
the API key of the user.
- Type:
str
- inserted_at#
the datetime when the user was created.
- Type:
datetime.datetime
- updated_at#
the datetime when the user was last updated.
- Type:
datetime.datetime
Examples
>>> from argilla import rg >>> user = rg.User.from_name("my-user") # or `User.from_id("...")` >>> print(user) User(id='...', username='my-user', first_name='Luke', last_name="Skywalker', full_name='Luke Skywalker', role='annotator', workspaces=['my-workspace'], api_key='...', inserted_at=datetime.datetime(2021, 8, 31, 10, 0, 0), updated_at=datetime.datetime(2021, 8, 31, 10, 0, 0))
- delete()#
Deletes the user from Argilla.
- Raises:
BaseClientError โ if the user cannot be deleted from Argilla.
- Return type:
None
Examples
>>> from argilla import rg >>> user = rg.User.from_name("my-user") >>> user.delete()
- classmethod from_id(id)#
Gets an existing user from Argilla by its ID.
- Parameters:
id (UUID) โ the ID of the user to be retrieved.
- Returns:
A User instance.
- Raises:
ValueError โ if the user with the provided ID doesnโt exist.
RuntimeError โ if there was an error while retrieving the user.
- Return type:
Examples
>>> from argilla import rg >>> user = rg.User.from_id("my-user")
- classmethod from_name(name)#
Gets an existing user from Argilla by its name.
- Parameters:
name (str) โ the name of the user to be retrieved.
- Returns:
A User instance.
- Raises:
ValueError โ if the user with the provided name doesnโt exist.
RuntimeError โ if there was an error while retrieving the user.
- Return type:
Examples
>>> from argilla import rg >>> user = rg.User.from_name("my-user")