From 65c51403f3c625335fe9fab64ebdce4d5392dfd3 Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Mon, 20 Jan 2025 10:28:19 +0100 Subject: [PATCH 01/15] add UserCreate.id attribute --- argilla-server/src/argilla_server/api/schemas/v1/users.py | 1 + 1 file changed, 1 insertion(+) diff --git a/argilla-server/src/argilla_server/api/schemas/v1/users.py b/argilla-server/src/argilla_server/api/schemas/v1/users.py index 56ec19bf33..7d8478f8cd 100644 --- a/argilla-server/src/argilla_server/api/schemas/v1/users.py +++ b/argilla-server/src/argilla_server/api/schemas/v1/users.py @@ -59,6 +59,7 @@ class User(BaseModel): class UserCreate(BaseModel): + id: Optional[UUID] = None first_name: UserFirstName last_name: Optional[UserLastName] = None username: UserUsername From 3dcc2271485bad25d934bdeac7b7e9c58db7b42f Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Mon, 20 Jan 2025 10:28:38 +0100 Subject: [PATCH 02/15] Add Workspace.id attribute --- .../src/argilla_server/api/schemas/v1/workspaces.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/argilla-server/src/argilla_server/api/schemas/v1/workspaces.py b/argilla-server/src/argilla_server/api/schemas/v1/workspaces.py index 5fba689f95..7b698d9fa4 100644 --- a/argilla-server/src/argilla_server/api/schemas/v1/workspaces.py +++ b/argilla-server/src/argilla_server/api/schemas/v1/workspaces.py @@ -13,7 +13,8 @@ # limitations under the License. from datetime import datetime -from typing import List +from optparse import Option +from typing import List, Optional from uuid import UUID from pydantic import BaseModel, Field, ConfigDict @@ -30,6 +31,7 @@ class Workspace(BaseModel): class WorkspaceCreate(BaseModel): name: str = Field(min_length=1) + id: Optional[UUID] = None class Workspaces(BaseModel): From 7c54581c32b3702027af8e9e5bb5db8baf77e7aa Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Mon, 20 Jan 2025 10:37:44 +0100 Subject: [PATCH 03/15] create users and workspaces with predefined id --- .../src/argilla_server/contexts/accounts.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/argilla-server/src/argilla_server/contexts/accounts.py b/argilla-server/src/argilla_server/contexts/accounts.py index f12fbadf0c..6eb16851b4 100644 --- a/argilla-server/src/argilla_server/contexts/accounts.py +++ b/argilla-server/src/argilla_server/contexts/accounts.py @@ -66,7 +66,15 @@ async def create_workspace(db: AsyncSession, workspace_attrs: dict) -> Workspace if await Workspace.get_by(db, name=workspace_attrs["name"]) is not None: raise NotUniqueError(f"Workspace name `{workspace_attrs['name']}` is not unique") - return await Workspace.create(db, name=workspace_attrs["name"]) + if workspace_id := workspace_attrs.get("id"): + if await Workspace.get(db, id=workspace_id) is not None: + raise NotUniqueError(f"Workspace with id `{workspace_id}` is not unique") + + return await Workspace.create( + db, + id=workspace_attrs.get("id"), + name=workspace_attrs["name"], + ) async def delete_workspace(db: AsyncSession, workspace: Workspace): @@ -108,8 +116,13 @@ async def create_user(db: AsyncSession, user_attrs: dict, workspaces: Union[List if await get_user_by_username(db, user_attrs["username"]) is not None: raise NotUniqueError(f"User username `{user_attrs['username']}` is not unique") + if user_id := user_attrs.get("id"): + if await User.get(db, id=user_id) is not None: + raise NotUniqueError(f"User with id `{user_id}` is not unique") + user = await User.create( db, + id=user_attrs.get("id"), first_name=user_attrs["first_name"], last_name=user_attrs["last_name"], username=user_attrs["username"], From 6761d9c68f300e6aeb9a91cb2099d3af48a520c3 Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Mon, 20 Jan 2025 10:46:35 +0100 Subject: [PATCH 04/15] add new tests --- .../api/handlers/v1/users/test_create_user.py | 82 ++++++++++++++++++- .../v1/workspaces/test_create_workspace.py | 72 ++++++++++++++++ 2 files changed, 153 insertions(+), 1 deletion(-) diff --git a/argilla-server/tests/unit/api/handlers/v1/users/test_create_user.py b/argilla-server/tests/unit/api/handlers/v1/users/test_create_user.py index ebe95aa6b7..4c9bf2f2e7 100644 --- a/argilla-server/tests/unit/api/handlers/v1/users/test_create_user.py +++ b/argilla-server/tests/unit/api/handlers/v1/users/test_create_user.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - +from uuid import uuid4 import pytest from argilla_server.constants import API_KEY_HEADER_NAME @@ -146,6 +146,86 @@ async def test_create_user_with_non_default_role( assert response.json()["role"] == UserRole.owner assert user.role == UserRole.owner + async def test_create_user_with_predefined_id( + self, db: AsyncSession, async_client: AsyncClient, owner_auth_header: dict + ): + user_id = uuid4() + response = await async_client.post( + self.url(), + headers=owner_auth_header, + json={ + "id": str(user_id), + "first_name": "First name", + "last_name": "Last name", + "username": "username", + "password": "12345678", + }, + ) + + assert response.status_code == 201 + + user = (await db.execute(select(User).filter_by(username="username"))).scalar_one() + assert user.id == user_id + + async def test_create_user_with_none_user_id( + self, db: AsyncSession, async_client: AsyncClient, owner_auth_header: dict + ): + response = await async_client.post( + self.url(), + headers=owner_auth_header, + json={ + "id": None, + "first_name": "First name", + "last_name": "Last name", + "username": "username", + "password": "12345678", + }, + ) + + assert response.status_code == 201 + + user = (await db.execute(select(User).filter_by(username="username"))).scalar_one() + assert user.id is not None + + async def test_create_user_with_wrong_user_id( + self, db: AsyncSession, async_client: AsyncClient, owner_auth_header: dict + ): + response = await async_client.post( + self.url(), + headers=owner_auth_header, + json={ + "id": "wrong_id", + "first_name": "First name", + "last_name": "Last name", + "username": "username", + "password": "12345678", + }, + ) + + assert response.status_code == 422 + assert (await db.execute(select(func.count(User.id)))).scalar() == 1 + + async def test_create_user_with_existing_id( + self, db: AsyncSession, async_client: AsyncClient, owner_auth_header: dict + ): + user_id = uuid4() + await UserFactory.create(id=user_id) + + response = await async_client.post( + self.url(), + headers=owner_auth_header, + json={ + "id": str(user_id), + "first_name": "First name", + "last_name": "Last name", + "username": "username", + "password": "12345678", + }, + ) + + assert response.status_code == 409 + assert (await db.execute(select(func.count(User.id)))).scalar() == 2 + async def test_create_user_without_authentication(self, db: AsyncSession, async_client: AsyncClient): response = await async_client.post( self.url(), diff --git a/argilla-server/tests/unit/api/handlers/v1/workspaces/test_create_workspace.py b/argilla-server/tests/unit/api/handlers/v1/workspaces/test_create_workspace.py index d2bb2b4e40..679ce3caca 100644 --- a/argilla-server/tests/unit/api/handlers/v1/workspaces/test_create_workspace.py +++ b/argilla-server/tests/unit/api/handlers/v1/workspaces/test_create_workspace.py @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +from uuid import uuid4 import pytest from argilla_server.constants import API_KEY_HEADER_NAME @@ -47,6 +48,77 @@ async def test_create_workspace(self, db: AsyncSession, async_client: AsyncClien "updated_at": workspace.updated_at.isoformat(), } + async def test_create_workspace_with_predefined_id( + self, db: AsyncSession, async_client: AsyncClient, owner_auth_header: dict + ): + workspace_id = uuid4() + response = await async_client.post( + self.url(), + headers=owner_auth_header, + json={"id": str(workspace_id), "name": "workspace"}, + ) + + assert response.status_code == 201 + + assert (await db.execute(select(func.count(Workspace.id)))).scalar() == 1 + workspace = (await db.execute(select(Workspace).filter_by(name="workspace"))).scalar_one() + + assert response.json() == { + "id": str(workspace_id), + "name": "workspace", + "inserted_at": workspace.inserted_at.isoformat(), + "updated_at": workspace.updated_at.isoformat(), + } + + async def test_create_workspace_with_none_id( + self, db: AsyncSession, async_client: AsyncClient, owner_auth_header: dict + ): + response = await async_client.post( + self.url(), + headers=owner_auth_header, + json={"id": None, "name": "workspace"}, + ) + + assert response.status_code == 201 + + assert (await db.execute(select(func.count(Workspace.id)))).scalar() == 1 + workspace = (await db.execute(select(Workspace).filter_by(name="workspace"))).scalar_one() + + assert response.json() == { + "id": str(workspace.id), + "name": "workspace", + "inserted_at": workspace.inserted_at.isoformat(), + "updated_at": workspace.updated_at.isoformat(), + } + + async def test_create_workspace_with_wrong_id( + self, db: AsyncSession, async_client: AsyncClient, owner_auth_header: dict + ): + response = await async_client.post( + self.url(), + headers=owner_auth_header, + json={"id": "wrong_id", "name": "workspace"}, + ) + + assert response.status_code == 422 + + assert (await db.execute(select(func.count(Workspace.id)))).scalar() == 0 + + async def test_create_workspace_with_existing_id( + self, db: AsyncSession, async_client: AsyncClient, owner_auth_header: dict + ): + workspace_id = uuid4() + await WorkspaceFactory.create(id=workspace_id) + + response = await async_client.post( + self.url(), + headers=owner_auth_header, + json={"id": str(workspace_id), "name": "workspace"}, + ) + + assert response.status_code == 409 + assert (await db.execute(select(func.count(Workspace.id)))).scalar() == 1 + async def test_create_workspace_without_authentication(self, db: AsyncSession, async_client: AsyncClient): response = await async_client.post( self.url(), From 7990fd249a6e271a1f039b34cbe54aff2cd054da Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Mon, 20 Jan 2025 11:54:34 +0100 Subject: [PATCH 05/15] fix: send the whole workspace API model when creating --- argilla/src/argilla/_api/_workspaces.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/argilla/src/argilla/_api/_workspaces.py b/argilla/src/argilla/_api/_workspaces.py index 1bf80020c6..46fbfe2708 100644 --- a/argilla/src/argilla/_api/_workspaces.py +++ b/argilla/src/argilla/_api/_workspaces.py @@ -35,7 +35,7 @@ class WorkspacesAPI(ResourceAPI[WorkspaceModel]): @api_error_handler def create(self, workspace: WorkspaceModel) -> WorkspaceModel: # TODO: Unify API endpoint - response = self.http_client.post(url="/api/v1/workspaces", json={"name": workspace.name}) + response = self.http_client.post(url="/api/v1/workspaces", json=workspace.model_dump()) response.raise_for_status() response_json = response.json() workspace = self._model_from_json(json_workspace=response_json) From b92b33a2b9d4268a6a514a98a7810a5684d446fb Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Mon, 20 Jan 2025 11:55:06 +0100 Subject: [PATCH 06/15] chore: Align init args --- argilla/src/argilla/users/_resource.py | 3 ++- argilla/src/argilla/workspaces/_resource.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/argilla/src/argilla/users/_resource.py b/argilla/src/argilla/users/_resource.py index 09d5f40b29..c048ec2b30 100644 --- a/argilla/src/argilla/users/_resource.py +++ b/argilla/src/argilla/users/_resource.py @@ -45,8 +45,8 @@ def __init__( last_name: Optional[str] = None, role: Optional[str] = None, password: Optional[str] = None, - client: Optional["Argilla"] = None, id: Optional[UUID] = None, + client: Optional["Argilla"] = None, _model: Optional[UserModel] = None, ) -> None: """Initializes a User object with a client and a username @@ -57,6 +57,7 @@ def __init__( last_name (str): The last name of the user role (str): The role of the user, either 'annotator', admin, or 'owner' password (str): The password of the user + id (UUID): The ID of the user client (Argilla): The client used to interact with Argilla Returns: diff --git a/argilla/src/argilla/workspaces/_resource.py b/argilla/src/argilla/workspaces/_resource.py index c508bf6372..e1474ede46 100644 --- a/argilla/src/argilla/workspaces/_resource.py +++ b/argilla/src/argilla/workspaces/_resource.py @@ -50,9 +50,9 @@ def __init__( """Initializes a Workspace object with a client and a name or id Parameters: - client (Argilla): The client used to interact with Argilla name (str): The name of the workspace id (UUID): The id of the workspace + client (Argilla): The client used to interact with Argilla Returns: Workspace: The initialized workspace object From 0041f6b0217a5ae0ef9d8ff5e5313c747e05a2a8 Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Mon, 20 Jan 2025 11:55:19 +0100 Subject: [PATCH 07/15] add tests --- argilla/tests/integration/test_manage_users.py | 6 ++++++ argilla/tests/integration/test_manage_workspaces.py | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/argilla/tests/integration/test_manage_users.py b/argilla/tests/integration/test_manage_users.py index 80c0f7b2d9..4c902fca45 100644 --- a/argilla/tests/integration/test_manage_users.py +++ b/argilla/tests/integration/test_manage_users.py @@ -26,6 +26,12 @@ def test_create_user(self, client: Argilla): assert user.id is not None assert client.users(username=user.username).id == user.id + def test_create_user_with_id(self, client: Argilla): + user = User(id=uuid.uuid4(), username=f"test_user_{uuid.uuid4()}", password="test_password") + client.users.add(user) + assert user.id is not None + assert client.users(username=user.username).id == user.id + def test_create_user_without_password(self, client: Argilla): user = User(username=f"test_user_{uuid.uuid4()}") with pytest.raises(expected_exception=UnprocessableEntityError): diff --git a/argilla/tests/integration/test_manage_workspaces.py b/argilla/tests/integration/test_manage_workspaces.py index 6462003a65..3a93a59aec 100644 --- a/argilla/tests/integration/test_manage_workspaces.py +++ b/argilla/tests/integration/test_manage_workspaces.py @@ -24,6 +24,13 @@ def test_create_workspace(self, client: Argilla): assert workspace in client.workspaces assert client.api.workspaces.exists(workspace.id) + def test_create_workspace_with_id(self, client: Argilla): + workspace = Workspace(id=uuid.uuid4(), name=f"test_workspace{uuid.uuid4()}") + client.workspaces.add(workspace) + + assert workspace in client.workspaces + assert client.workspaces(workspace.name).id == workspace.id + def test_create_and_delete_workspace(self, client: Argilla): workspace = client.workspaces(name="test_workspace") if workspace: From 9153625963a52f59b2a8171c708ec534e04f6d22 Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Mon, 20 Jan 2025 12:05:39 +0100 Subject: [PATCH 08/15] docs: Fix users migration script --- .../how_to_guides/migrate_from_legacy_datasets.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/argilla/docs/how_to_guides/migrate_from_legacy_datasets.md b/argilla/docs/how_to_guides/migrate_from_legacy_datasets.md index f7cb1db770..85cf578e0b 100644 --- a/argilla/docs/how_to_guides/migrate_from_legacy_datasets.md +++ b/argilla/docs/how_to_guides/migrate_from_legacy_datasets.md @@ -75,20 +75,22 @@ for workspace in workspaces_v1: ```python for user in users_v1: - user = rg.User( + user_v2 = rg.User( username=user.username, first_name=user.first_name, last_name=user.last_name, role=user.role, password="" # (1) ).create() + if user.role == "owner": continue - for workspace_name in user.workspaces: - if workspace_name != user.name: - workspace = client.workspaces(name=workspace_name) - user.add_to_workspace(workspace) + for workspace in user.workspaces: + workspace_v2 = client.workspaces(name=workspace.name) + if workspace_v2 is None: + continue + user.add_to_workspace(workspace_v2) ``` 1. You need to chose a new password for the user, to do this programmatically you can use the `uuid` package to generate a random password. Take care to keep track of the passwords you chose, since you will not be able to retrieve them later. From 71b5853054fc6d0acd178e2d9bf26665d870b6df Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Mon, 20 Jan 2025 12:07:22 +0100 Subject: [PATCH 09/15] docs: Add user and workspace ids --- argilla/docs/how_to_guides/migrate_from_legacy_datasets.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/argilla/docs/how_to_guides/migrate_from_legacy_datasets.md b/argilla/docs/how_to_guides/migrate_from_legacy_datasets.md index 85cf578e0b..83751bbc7b 100644 --- a/argilla/docs/how_to_guides/migrate_from_legacy_datasets.md +++ b/argilla/docs/how_to_guides/migrate_from_legacy_datasets.md @@ -69,13 +69,15 @@ Next, recreate the users and workspaces on the Argilla V2 server: ```python for workspace in workspaces_v1: rg.Workspace( - name=workspace.name + id=workspace.id, + name=workspace.name, ).create() ``` ```python for user in users_v1: user_v2 = rg.User( + id=user.id, username=user.username, first_name=user.first_name, last_name=user.last_name, From a2653415c0b8fdfa3bcdb0f814664a0601a6262a Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Mon, 20 Jan 2025 14:35:26 +0100 Subject: [PATCH 10/15] apply suggestions --- argilla-server/src/argilla_server/api/schemas/v1/workspaces.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/argilla-server/src/argilla_server/api/schemas/v1/workspaces.py b/argilla-server/src/argilla_server/api/schemas/v1/workspaces.py index 7b698d9fa4..4b301aa214 100644 --- a/argilla-server/src/argilla_server/api/schemas/v1/workspaces.py +++ b/argilla-server/src/argilla_server/api/schemas/v1/workspaces.py @@ -30,8 +30,8 @@ class Workspace(BaseModel): class WorkspaceCreate(BaseModel): - name: str = Field(min_length=1) id: Optional[UUID] = None + name: str = Field(min_length=1) class Workspaces(BaseModel): From c93a2cae10616004e6ac4c3eff6e9a0848d017d7 Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Mon, 20 Jan 2025 14:37:16 +0100 Subject: [PATCH 11/15] chore: Update CHANGELOGs --- argilla-server/CHANGELOG.md | 5 +++++ argilla/CHANGELOG.md | 3 +++ 2 files changed, 8 insertions(+) diff --git a/argilla-server/CHANGELOG.md b/argilla-server/CHANGELOG.md index e652289960..0b0c212cd2 100644 --- a/argilla-server/CHANGELOG.md +++ b/argilla-server/CHANGELOG.md @@ -16,6 +16,11 @@ These are the section headers that we use: ## [Unreleased]() +### Added + +- Added support to create users with predefined ids. ([#5786](https://github.com/argilla-io/argilla/pull/5786)) +- Added support to create workspaces with predefined ids. ([#5786](https://github.com/argilla-io/argilla/pull/5786)) + ## [2.6.0](https://github.com/argilla-io/argilla/compare/v2.5.0...v2.6.0) ### Added diff --git a/argilla/CHANGELOG.md b/argilla/CHANGELOG.md index 1b8d87b9e9..6f3141ae90 100644 --- a/argilla/CHANGELOG.md +++ b/argilla/CHANGELOG.md @@ -19,6 +19,9 @@ These are the section headers that we use: ### Added - Return similarity score when searching by similarity. ([#5778](https://github.com/argilla-io/argilla/pull/5778)) +- Added support to create users with predefined ids. ([#5786](https://github.com/argilla-io/argilla/pull/5786)) +- Added support to create workspaces with predefined ids. ([#5786](https://github.com/argilla-io/argilla/pull/5786)) + ## [2.6.0](https://github.com/argilla-io/argilla/compare/v2.5.0...v2.6.0) From 56c8cf8110042170a80fcac96d64ed55c987f5bd Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Mon, 20 Jan 2025 14:42:28 +0100 Subject: [PATCH 12/15] docs: Complete attribute definition --- argilla/src/argilla/users/_resource.py | 2 +- argilla/src/argilla/workspaces/_resource.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/argilla/src/argilla/users/_resource.py b/argilla/src/argilla/users/_resource.py index c048ec2b30..fb082787f7 100644 --- a/argilla/src/argilla/users/_resource.py +++ b/argilla/src/argilla/users/_resource.py @@ -57,7 +57,7 @@ def __init__( last_name (str): The last name of the user role (str): The role of the user, either 'annotator', admin, or 'owner' password (str): The password of the user - id (UUID): The ID of the user + id (UUID): The ID of the user. If provided before a .create, the will be created with this ID client (Argilla): The client used to interact with Argilla Returns: diff --git a/argilla/src/argilla/workspaces/_resource.py b/argilla/src/argilla/workspaces/_resource.py index e1474ede46..c891873f85 100644 --- a/argilla/src/argilla/workspaces/_resource.py +++ b/argilla/src/argilla/workspaces/_resource.py @@ -51,7 +51,7 @@ def __init__( Parameters: name (str): The name of the workspace - id (UUID): The id of the workspace + id (UUID): The id of the workspace. If provided before a .create, the workspace will be created with this ID client (Argilla): The client used to interact with Argilla Returns: From 9225aee1855f626fe7586037aae8776ca77459e7 Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Mon, 20 Jan 2025 15:00:44 +0100 Subject: [PATCH 13/15] using server PR --- .github/workflows/argilla.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/argilla.yml b/.github/workflows/argilla.yml index e7b7b66605..8176d43b1a 100644 --- a/.github/workflows/argilla.yml +++ b/.github/workflows/argilla.yml @@ -24,7 +24,7 @@ jobs: build: services: argilla-server: - image: argilladev/argilla-hf-spaces:develop + image: argilladev/argilla-hf-spaces:pr-5786 ports: - 6900:6900 env: From 8eb50a519686f102d5e0584f62ed80a717e4dc4a Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Mon, 20 Jan 2025 15:01:22 +0100 Subject: [PATCH 14/15] tests: Fix tests --- argilla/tests/integration/test_manage_users.py | 5 +++-- argilla/tests/integration/test_manage_workspaces.py | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/argilla/tests/integration/test_manage_users.py b/argilla/tests/integration/test_manage_users.py index 4c902fca45..fdbf6a7860 100644 --- a/argilla/tests/integration/test_manage_users.py +++ b/argilla/tests/integration/test_manage_users.py @@ -27,10 +27,11 @@ def test_create_user(self, client: Argilla): assert client.users(username=user.username).id == user.id def test_create_user_with_id(self, client: Argilla): - user = User(id=uuid.uuid4(), username=f"test_user_{uuid.uuid4()}", password="test_password") + user_id = uuid.uuid4() + user = User(id=user_id, username=f"test_user_{uuid.uuid4()}", password="test_password") client.users.add(user) assert user.id is not None - assert client.users(username=user.username).id == user.id + assert client.users(username=user.username).id == user_id def test_create_user_without_password(self, client: Argilla): user = User(username=f"test_user_{uuid.uuid4()}") diff --git a/argilla/tests/integration/test_manage_workspaces.py b/argilla/tests/integration/test_manage_workspaces.py index 3a93a59aec..6c5167679e 100644 --- a/argilla/tests/integration/test_manage_workspaces.py +++ b/argilla/tests/integration/test_manage_workspaces.py @@ -25,11 +25,11 @@ def test_create_workspace(self, client: Argilla): assert client.api.workspaces.exists(workspace.id) def test_create_workspace_with_id(self, client: Argilla): - workspace = Workspace(id=uuid.uuid4(), name=f"test_workspace{uuid.uuid4()}") + workspace_id = uuid.uuid4() + workspace = Workspace(id=workspace_id, name=f"test_workspace{uuid.uuid4()}") client.workspaces.add(workspace) - assert workspace in client.workspaces - assert client.workspaces(workspace.name).id == workspace.id + assert client.workspaces(workspace.name).id == workspace_id def test_create_and_delete_workspace(self, client: Argilla): workspace = client.workspaces(name="test_workspace") From b3630889f744662464487fc20011337705560d99 Mon Sep 17 00:00:00 2001 From: Paco Aranda Date: Mon, 20 Jan 2025 15:18:43 +0100 Subject: [PATCH 15/15] Update .github/workflows/argilla.yml --- .github/workflows/argilla.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/argilla.yml b/.github/workflows/argilla.yml index 8176d43b1a..e7b7b66605 100644 --- a/.github/workflows/argilla.yml +++ b/.github/workflows/argilla.yml @@ -24,7 +24,7 @@ jobs: build: services: argilla-server: - image: argilladev/argilla-hf-spaces:pr-5786 + image: argilladev/argilla-hf-spaces:develop ports: - 6900:6900 env: