citrine.resources.project module

Resources that represent both individual and collections of projects.

class citrine.resources.project.Project(name: str, *, description: str | None = None, session: Session | None = None, team_id: UUID | None = None)

Bases: Resource[Project]

A Citrine Project.

A project is a collection of training sets and AI assets, some of which belong directly to the project, and some of which have been shared with the project.

Parameters:
  • name (str) – Name of the project.

  • description (str) – Long-form description of the project.

  • session (Session, optional) – The Citrine session used to connect to the database.

access_control_dict() dict

Return an access control entity representation of this resource. Internal use only.

classmethod build(data: dict) Self

Build an instance of this object from given data.

dump() dict

Dump this instance.

classmethod get_team_id_from_project_id(session: Session, project_id: UUID)

Returns the UUID of the Team that owns the project with the provided project_id.

list_members() list[ProjectMember] | list[TeamMember]

List all of the members in the current project.

Returns:

The members of the current project, or the members of the team containing the project if teams have been released.

Return type:

list[ProjectMember] | list[TeamMember]

publish(*, resource: Resource)

Publish a resource from a project to its encompassing team.

In order to use the Resource in a different project, you should use project.pull_in_resource() to pull that resource into the other project.

Parameters:

resource (Resource) – The resource owned by this project, which will be published

Returns:

Returns True if resource successfully published

Return type:

bool

pull_in_resource(*, resource: Resource)

Pull in a public resource from this project’s team.

Parameters:

resource (Resource) – The resource owned by the encompassing team, which will be pulled in

Returns:

Returns True if resource successfully pulled in

Return type:

bool

un_publish(*, resource: Resource)

Un-publish a resource from a project from its encompassing team.

Parameters:

resource (Resource) – The resource owned by this project, which will be un-published

Returns:

Returns True if resource successfully un-published

Return type:

bool

archived = None

Whether the project is archived.

Type:

bool

property branches: BranchCollection

Return a resource representing all visible branches.

created_at = None

Time the project was created, in seconds since epoch.

Type:

int

description: str | None = None
property descriptors: DescriptorMethods

Return a resource containing a set of methods returning descriptors.

property design_spaces: DesignSpaceCollection

Return a resource representing all visible design spaces.

property design_workflows: DesignWorkflowCollection

Return a collection representing all visible design workflows.

property generative_design_executions: GenerativeDesignExecutionCollection

Return a collection representing all visible generative design executions.

name: str = None
property predictor_evaluations: PredictorEvaluationCollection

Return a collection representing all visible predictor evaluations.

property predictors: PredictorCollection

Return a resource representing all visible predictors.

status = None

Status of the project.

Type:

str

property table_configs: TableConfigCollection

Return a resource representing all Table Configs in the project.

property tables: GemTableCollection

Return a resource representing all visible Tables.

property team_id

Returns the Team’s id-scoped UUID.

uid = None

Unique uuid4 identifier of this project.

Type:

UUID

class citrine.resources.project.ProjectCollection(session: Session, *, team_id: UUID | None = None)

Bases: Collection[Project]

Represents the collection of all projects as well as the resources belonging to it.

Parameters:

session (Session, optional) – The Citrine session used to connect to the database.

archive(uid: UUID | str) Response

Archive a project.

build(data) Project

Build an individual project from a dictionary.

Parameters:

data (dict) – A dictionary representing the project.

Returns:

The project created from data.

Return type:

Project

delete(uid: UUID | str) Response

Delete a particular project.

Only empty projects can be deleted. If the project is not empty, then the Response will contain a list of all of the project’s resources. These must be deleted before the project can be deleted.

get(uid: UUID | str) Project

Get a particular project.

Parameters:

uid (UUID or str) – The uid of the project to get.

list(*, per_page: int = 1000) Iterator[Project]

List all projects using pagination.

Parameters:

per_page (int, optional) – Max number of results to return per page. Default is 1000. This parameter is used when making requests to the backend service. If the page parameter is specified it limits the maximum number of elements in the response.

Returns:

Projects in this collection.

Return type:

Iterator[Project]

list_active(*, per_page: int = 1000) Iterator[Project]

List non-archived projects using pagination.

Parameters:

per_page (int, optional) – Max number of results to return per page. Default is 1000. This parameter is used when making requests to the backend service. If the page parameter is specified it limits the maximum number of elements in the response.

Returns:

Projects in this collection.

Return type:

Iterator[Project]

list_archived(*, per_page: int = 1000) Iterable[Project]

List archived projects using pagination.

Parameters:

per_page (int, optional) – Max number of results to return per page. Default is 1000. This parameter is used when making requests to the backend service. If the page parameter is specified it limits the maximum number of elements in the response.

Returns:

Projects in this collection.

Return type:

Iterator[Project]

register(name: str, *, description: str | None = None) Project

Create and upload new project.

Parameters:
  • name (str) – Name of the project to be created.

  • description (str) – Long-form description of the project to be created.

Returns:

The newly registered project.

Return type:

Project

restore(uid: UUID | str) Response

Restore an archived project.

search(*, search_params: dict | None = None, per_page: int = 1000) Iterable[Project]

Search for projects matching the desired name or description.

You can search for projects matching the desired name or description by either exact match or substring match, as specified by the search_params argument. Defaults to no search criteria.

Like list, this method allows for pagination. This differs from the list function, because it makes a POST request to resourceType/search with search fields in a post body.

Leaving page and per_page as default values will yield all elements in the collection, paginating over all available pages.

Leaving search_params as its default value will return mimic the behavior of a full list with no search parameters.

Parameters:
  • search_params (dict, optional) –

    A dict representing the body of the post request that will be sent to the search endpoint to filter the results, e.g.,

    {
        "name": {
            "value": "Polymer Project",
            "search_method": "EXACT"
        },
        "description": {
            "value": "polymer chain length",
            "search_method": "SUBSTRING"
        },
    }
    

    The dict can contain any combination of (one or all) search specifications for the name, description, and status fields of a project. For each parameter specified, the "value" to match, as well as the "search_method" must be provided. The available search_methods are "SUBSTRING" and "EXACT". The example above demonstrates the input necessary to list projects with the exact name "Polymer Project" and descriptions including the phrase "polymer chain length".

  • per_page (int, optional) – Max number of results to return per page. Default is 100. This parameter is used when making requests to the backend service. If the page parameter is specified it limits the maximum number of elements in the response.

Returns:

Projects in this collection.

Return type:

Iterable[Project]

search_all(search_params: dict | None) Iterable[dict]

Search across all projects in a domain.

There is no pagination on search_all.

This is compatible with accounts v3 only.

Parameters:

search_params (dict, optional) –

A dict representing the body of the post request that will be sent to the search endpoint to filter the results, e.g.,

{
    "name": {
        "value": "Polymer Project",
        "search_method": "EXACT"
    },
    "description": {
        "value": "polymer chain length",
        "search_method": "SUBSTRING"
    },
}

The dict can contain any combination of (one or all) search specifications for the name, description, and status fields of a project. For each parameter specified, the "value" to match, as well as the "search_method" must be provided. The available search_methods are "SUBSTRING" and "EXACT". The example above demonstrates the input necessary to list projects with the exact name "Polymer Project" and descriptions including the phrase "polymer chain length".

Returns:

Projects in this collection.

Return type:

Iterable[Dict]

update(model: Project) Project

Projects cannot be updated.