Skip to content

Projects

Project

Project(id, workspace, name, description=None)

Represent a Vectice project.

A project reflects a typical Data Science project, including phases and the associated assets like code, datasets, models, and documentation. Multiple projects may be defined within each workspace.

You can get a project from your Workspace object by calling project():

import vectice

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

Or you can get it directly when connecting to Vectice:

import vectice

my_project = vectice.connect(..., workspace="Iris workspace", project="Iris project")

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

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

Parameters:

Name Type Description Default
id int

The project identifier.

required
workspace Workspace

The workspace this project belongs to.

required
name str

The name of the project.

required
description str | None

A brief description of the project.

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

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

    Parameters:
        id: The project identifier.
        workspace: The workspace this project belongs to.
        name: The name of the project.
        description: A brief description of the project.
    """
    self._id = id
    self._workspace = workspace
    self._name = name
    self._description = description
    self._phase: Phase | None = None
    self._client = workspace._client

connection property

connection: Connection

The Connection to which this project belongs.

Returns:

Type Description
Connection

The Connection to which this project belongs.

description property

description: str | None

The project's description.

Returns:

Type Description
str | None

The project's description.

id property

id: int

The project's id.

Returns:

Type Description
int

The project's id.

name property

name: str

The project's name.

Returns:

Type Description
str

The project's name.

origin_dataset writable property

origin_dataset: None

Deprecated. Use steps' origin_dataset instead.

Raises:

Type Description
DeprecationError

Always.

phases property

phases: list[Phase]

The project's phases.

Returns:

Type Description
list[Phase]

The phases associated with this project.

properties property

properties: dict

The project's identifiers.

Returns:

Type Description
dict

A dictionary containing the name, id and workspace items.

workspace property

workspace: Workspace

The workspace to which this project belongs.

Returns:

Type Description
Workspace

The workspace to which this project belongs.

list_phases

list_phases()

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

Returns:

Type Description
None

None

Source code in src/vectice/models/project.py
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
def list_phases(self) -> None:
    """Prints a list of phases belonging to the project in a tabular format, limited to the first 10 items. A link is provided to view the remaining phases.

    Returns:
        None
    """
    phase_outputs = sorted(self._client.list_phases(project=self.id), key=lambda x: x.index)
    user_name, _ = _get_last_user_and_default_workspace(self._client)

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

    rich_table.add_column("phase id", justify="left", no_wrap=True, min_width=3, max_width=5)
    rich_table.add_column("name", justify="left", no_wrap=True, min_width=5, max_width=10)
    rich_table.add_column("owner", justify="left", no_wrap=True, min_width=4, max_width=4)
    rich_table.add_column("status", justify="left", no_wrap=True, min_width=4, max_width=4)
    rich_table.add_column("iterations", justify="left", no_wrap=True, min_width=4, max_width=4)
    rich_table.add_column("steps", justify="left", no_wrap=True, max_width=10)

    for count, phase in enumerate(phase_outputs, 1):
        if count > 10:
            break
        phase_iterations = self._client.list_iterations(phase.id)
        iterations_total = len(phase_iterations)
        active_iterations = len(
            [
                iteration
                for iteration in phase_iterations
                if iteration.status is not (IterationStatus.Completed or IterationStatus.Abandoned)
            ]
        )
        phase_owner = phase["owner"]["name"] if phase.get("owner") else "Unassigned"
        phase_status = get_phase_status(phase.status)
        phase_steps = self._client.list_step_definitions(phase.id)
        total_phase_steps = len(phase_steps)
        rich_table.add_row(
            str(phase.id),
            phase.name,
            phase_owner,
            phase_status,
            f"{active_iterations}/{iterations_total}",
            str(total_phase_steps),
        )
    description = f"""There are {len(phase_outputs)} phases in the project {self.name!r}."""
    tips = dedent(
        """
    >> To access a specific phase, use project.phase(PhaseID)
    >> To access an array of phases, use project.phases"""
    ).lstrip()
    link = dedent(
        f"""
    For quick access to the list of phases for this project, visit:
    {self._client.auth._API_BASE_URL}/project?w={self.workspace.id}&resourceId={self.id}"""
    ).lstrip()
    legend = """**Legend**     [C]  Completed     [IP] In Progress
           [IR] In Review     [NS] Not Started"""

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

phase

phase(phase)

Get a phase.

Parameters:

Name Type Description Default
phase str | int

The name or id of the phase to get.

required

Returns:

Type Description
Phase

The specified phase.

Source code in src/vectice/models/project.py
166
167
168
169
170
171
172
173
174
175
176
177
178
179
def phase(self, phase: str | int) -> Phase:
    """Get a phase.

    Parameters:
        phase: The name or id of the phase to get.

    Returns:
        The specified phase.
    """
    item = self._client.get_phase(phase, project_id=self._id)
    _logger.info(f"Phase {item.name!r} successfully retrieved.")
    phase_object = Phase(item.id, self, item.name, item.index, item.status)
    self._phase = phase_object
    return phase_object