Skip to content

Workspaces

Workspace

Workspace(id, name, description=None)

Represent a Vectice Workspace.

Workspaces are containers used to organize projects, assets, and users.

Vectice users have access to a personal workspace and other workspaces so they can learn and collaborate with other users. An organization will have many workspaces, each with an Admin and Members with different privileges.

Note that only an Org Admin can create a new workspace in the organization.

You can get a workspace from your Connection object by calling workspace():

import vectice

connection = vectice.connect(...)
my_workspace = connection.workspace("Iris workspace")

Or you can get it directly when connecting to Vectice:

import vectice

my_workspace = vectice.connect(..., workspace="Iris workspace")

See Connection.connect to learn how to connect to Vectice.

Vectice users shouldn't need to instantiate Workspaces manually, but here are the workspace parameters.

Parameters:

Name Type Description Default
id int

The workspace identifier.

required
name str

The name of the workspace.

required
description str | None

The description of the workspace.

None
Source code in src/vectice/models/workspace.py
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
def __init__(self, id: int, name: str, description: str | None = None):
    """Initialize a workspace.

    Vectice users shouldn't need to instantiate Workspaces manually,
    but here are the workspace parameters.

    Parameters:
        id: The workspace identifier.
        name: The name of the workspace.
        description: The description of the workspace.
    """
    self._id = id
    self._name = name
    self._description = description
    self._client: Client
    self._connection: Connection

connection property

connection: Connection

The Connection to which this workspace belongs.

Returns:

Type Description
Connection

The Connection to which this workspace belongs.

description property

description: str | None

The workspace's description.

Returns:

Type Description
str | None

The workspace's description.

id property

id: int

The workspace's id.

Returns:

Type Description
int

The workspace's id.

name property

name: str

The workspace's name.

Returns:

Type Description
str

The workspace's name.

projects property

projects: list[Project]

List projects.

Returns:

Type Description
list[Project]

A list of projects in this workspace.

properties property

properties: dict

The workspace's name and id.

Returns:

Type Description
dict

A dictionary containing the name and id items.

list_projects

list_projects()

Prints a list of projects belonging to the workspace in a tabular format, limited to the first 10 items. A link is provided to view the remaining projects.

Returns:

Type Description
None

None

Source code in src/vectice/models/workspace.py
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
def list_projects(self) -> None:
    """Prints a list of projects belonging to the workspace in a tabular format, limited to the first 10 items. A link is provided to view the remaining projects.

    Returns:
        None
    """
    project_outputs = self.projects
    user_name, _ = _get_last_user_and_default_workspace(self._client)

    rich_table = Table(expand=True, show_edge=False)

    rich_table.add_column("project id", justify="left", no_wrap=True, min_width=4, max_width=10)
    rich_table.add_column("name", justify="left", no_wrap=True, max_width=15)
    rich_table.add_column("description", justify="left", no_wrap=True, max_width=50)

    for count, project in enumerate(project_outputs, 1):
        if count > 10:
            break
        rich_table.add_row(str(project.id), project.name, format_description(project.description))

    description = f"""There are {len(project_outputs)} projects in the workspace {self.name!r}."""
    tips = dedent(
        """
    >> To access a specific project, use workspace.project(Project ID)
    >> To access an array of projects, use workspace.projects"""
    ).lstrip()
    link = dedent(
        f"""
        For quick access to the list of projects in the Vectice web app, visit:
        {self._client.auth._API_BASE_URL}/workspace/projects?w={self.id}"""
    ).lstrip()

    _temp_print(description)
    _temp_print(table=rich_table)
    _temp_print(tips)
    _temp_print(link)

project

project(project)

Get a project.

Parameters:

Name Type Description Default
project str | int

The project name or id.

required

Returns:

Type Description
Project

The project.

Source code in src/vectice/models/workspace.py
124
125
126
127
128
129
130
131
132
133
134
135
136
def project(self, project: str | int) -> Project:
    """Get a project.

    Parameters:
        project: The project name or id.

    Returns:
        The project.
    """
    item = self._client.get_project(project, self.id)
    _logger.debug(f"Your current project: {item.id}")
    project_object = Project(item.id, self, item.name, item.description)
    return project_object