Connection
Connection ¶
Connect to the Vectice backend (application).
The Connection class encapsulates a connection to the Vectice App. Thus, it authenticates and connects to Vectice. This allows you to start interacting with your Vectice assets.
A Connection can be initialized in three ways:
-
Passing the relevant arguments to authenticate and connect to Vectice:
import vectice connect = vectice.connect( api_token="your-api-key", host="https://app.vectice.com", )
-
Passing the path to a configuration file:
import vectice connect = vectice.connect(config="vectice_config.json")
-
Letting Vectice find the configuration file in specific locations:
import vectice connect = vectice.connect()
See Connection.connect
for more info.
my_workspace
property
¶
my_workspace
connect
staticmethod
¶
connect(
api_token: str | None = None,
host: str | None = None,
config: str | None = None,
workspace: str | None = None,
project: None = None,
) -> Connection | Workspace | Project
connect(
api_token: str | None = None,
host: str | None = None,
config: str | None = None,
workspace: str | None = None,
project: str = "",
) -> Project
connect(
api_token=None,
host=None,
config=None,
workspace=None,
project=None,
)
Method to connect to the Vectice backend (application).
Authentication credentials are retrieved, in order, from:
- keyword arguments
- configuration file (
config
parameter) - environment variables
- environment files in the following order
.vectice
of the working directory.vectice
of the user home directory.env
of the working directory.env
of the user home directory/etc/vectice/api.cfg
file
This method uses the api_token
, host
, workspace
, project
arguments
or the JSON config provided. The JSON config file is available from the Vectice
webapp when creating an API token.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_token
|
str | None
|
The api token provided by the Vectice webapp (API key). |
None
|
host
|
str | None
|
The backend host to which the client will connect. If not found, the default endpoint https://app.vectice.com is used. |
None
|
config
|
str | None
|
A JSON config file containing keys VECTICE_API_TOKEN and VECTICE_HOST as well as optionally WORKSPACE and PROJECT. |
None
|
workspace
|
str | None
|
The name or id of an optional workspace to return. |
None
|
project
|
str | None
|
The name or id of an optional project to return. |
None
|
Returns:
Type | Description |
---|---|
Connection | Workspace | Project
|
A Connection, Workspace, or Project. |
browse ¶
browse(asset)
Get an asset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
asset
|
str
|
The id of the desired asset. |
required |
Returns:
Type | Description |
---|---|
Workspace | Project | Phase | Iteration | DatasetRepresentation | ModelRepresentation | DatasetVersionRepresentation | ModelVersionRepresentation
|
The desired asset. |
workspace ¶
workspace(workspace)
project ¶
project(project)
phase ¶
phase(phase)
iteration ¶
iteration(iteration)
dataset ¶
dataset(dataset)
Get a dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset
|
str
|
The id of the desired dataset. |
required |
Returns:
Type | Description |
---|---|
DatasetRepresentation
|
The representation of the desired dataset. |
dataset_version ¶
dataset_version(version)
Get a dataset version's metadata from Vectice.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
version
|
str
|
The id of the desired dataset version. A Dataset version is identified with an ID starting with 'DTV-XXX'. |
required |
Returns:
Type | Description |
---|---|
DatasetVersionRepresentation
|
The representation of the desired dataset version. (See Representation/ Dataset Version Representation). |
model ¶
model(model)
Get a model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
str
|
The id of the desired model. |
required |
Returns:
Type | Description |
---|---|
ModelRepresentation
|
The representation of the desired model. |
model_version ¶
model_version(version)
Get a model version's metadata from Vectice.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
version
|
str
|
The id of the desired model version. A model version is identified with an ID starting with 'MDV-XXX'. |
required |
Returns:
Type | Description |
---|---|
ModelVersionRepresentation
|
The representation of the desired model version (See Representation/ Model Version Representation). |
list_workspaces ¶
list_workspaces(
number_of_items=DEFAULT_NUMBER_OF_ITEMS,
display_print=True,
)
Retrieves a list of workspaces belonging where you have access to. It will also print the first 10 workspaces as a tabular form.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
number_of_items
|
int
|
The number of workspace to retrieve. Defaults to 30. |
DEFAULT_NUMBER_OF_ITEMS
|
display_print
|
bool
|
If set to True, it will print the first 10 workspaces in a tabular form. |
True
|
Returns:
Type | Description |
---|---|
list[Workspace]
|
A list of |