Skip to content

package

Module to interact with Packages.

This module contains class to interact with Packages in Studio.

Typical usage example
package = space.get_package(PACKAGE_ID)
package = space.create_package("NEW_PACKAGE")
package.publish()

package_history = package.get_history()
package.delete()

Package

Bases: ContentNode

Package object to interact with package specific studio endpoints.

id class-attribute

id: str

key class-attribute

key: str

update

update()

Updating packages is not supported by EMS.

sync

sync()

Syncs package properties with EMS.

delete

delete()

Deletes package.

publish

publish(version=None, node_ids_to_exclude=None)

Publishes package with given version.

Parameters:

  • version (typing.Optional[str]) –

    Version to publish package with. Has to be of format X.X.X. By default gets next package version.

  • node_ids_to_exclude (typing.Optional[typing.List[str]]) –

    Nodes to exclude from publishing.

get_history

get_history()

Returns package history of all published versions.

load_version

load_version(version, root_draft_id)

Loads previously published package version.

Parameters:

  • version (str) –

    Version to load.

  • root_draft_id (str) –

    Draft id of version to load (can be found in package history).

create_variable

create_variable(key, value, type_, **kwargs)

Creates new variable for given package.

Parameters:

  • key (str) –

    Key of variable.

  • value (str) –

    Value to be set for variable.

  • type_ (str) –

    Type of variable, e.g. 'DATA_MODEL'.

  • **kwargs (typing.Any) –

    Additional parameters set for VariableDefinitionWithValue object.

Returns:

  • Variable

    A variable object for newly created variable.

get_variables

get_variables(type_=None)

Returns variables located in given package.

Parameters:

  • type_ (typing.Optional[str]) –

    If set, only variables of given type are returned.

Returns:

get_variable

get_variable(key)

Gets variable located in package with given key.

Parameters:

  • key (str) –

    Key of variable.

Returns:

  • Variable

    A Variable object for variable with given key.

Raises:

get_content_node

get_content_node(id_)

Gets content node located in package with given id.

Parameters:

  • id_ (str) –

    Id of content node.

Returns:

  • ContentNode

    A ContentNode object for content node with given id.

Raises:

get_content_nodes

get_content_nodes(asset_type=None, node_type=None)

Gets all content nodes of given package.

Returns:

get_action_flow

get_action_flow(id_)

Gets action flow of given package.

Parameters:

  • id_ (str) –

    Id of action flow.

Returns:

get_action_flows

get_action_flows()

Gets all action flows of given package.

Returns:

create_analysis

create_analysis(
    name,
    key=None,
    data_model_id=None,
    change_default_event_log=False,
    **kwargs
)

Creates new analysis with name in given package.

Parameters:

  • name (str) –

    Name of new analysis.

  • key (typing.Optional[str]) –

    Key of new analysis. Defaults to name.

  • data_model_id (typing.Optional[str]) –

    Id of data model to use.

  • change_default_event_log (bool) –

    Whether to change default event log or not.

Returns:

  • Analysis

    An analysis object for newly created analysis.

get_analysis

get_analysis(id_)

Gets analysis of given package.

Parameters:

  • id_ (str) –

    Id of analysis.

Returns:

get_analyses

get_analyses()

Gets all analyses of given package.

Returns:

create_folder

create_folder(name, key=None, **kwargs)

Create new folder with name in given package.

Parameters:

  • name (str) –

    Name of new folder.

  • key (typing.Optional[str]) –

    Key of new folder. Defaults to name.

  • **kwargs (typing.Any) –

    Additional parameters set for SaveContentNodeTransport object.

Returns:

  • Folder

    A Folder object for newly created folder.

get_folder

get_folder(id_)

Get folder of given package.

Parameters:

  • id_ (str) –

    Id of folder.

Returns:

  • Folder

    Folder with given id.

get_folders

get_folders()

Get all folders of given package.

Returns:

create_knowledge_model

create_knowledge_model(
    content,
    with_autogenerated_data_model_data=True,
    with_variable_replacement=True,
)

Creates new knowledge model in given package.

Parameters:

  • content (typing.Dict) –

    Content of new knowledge model.

  • with_autogenerated_data_model_data (bool) –

    Defines whether automatically generated records and kpis are added.

  • with_variable_replacement (bool) –

    Defines whether used variables are replaced automatically.

Returns:

  • KnowledgeModel

    A KnowledgeModel object for newly created knowledge model.

get_knowledge_model

get_knowledge_model(id_)

Gets knowledge_model of given package.

Parameters:

  • id_ (str) –

    Id of knowledge_model.

Returns:

get_knowledge_models

get_knowledge_models()

Gets all knowledge models of given package.

Returns:

get_simulation

get_simulation(id_)

Gets simulation of given package.

Parameters:

  • id_ (str) –

    Id of simulation.

Returns:

get_simulations

get_simulations()

Gets all simulations of given package.

Returns:

get_skill

get_skill(id_)

Gets skill of given package.

Parameters:

  • id_ (str) –

    Id of skill.

Returns:

  • Skill

    Skill with given id.

get_skills

get_skills()

Gets all skills of given package.

Returns:

get_view

get_view(id_)

Gets view of given package.

Parameters:

  • id_ (str) –

    Id of view.

Returns:

  • View

    View with given id.

get_views

get_views()

Gets all views of given package.

Returns: