8.1.1.1. stelar.client package

Subpackages

Submodules

stelar.client.admin module

class stelar.client.admin.AdminAPI(*args, **kwargs)[source]

Bases: BaseAPI

Represents a class that handles administrative API actions, including policy and user management.

stelar.client.api_call module

class stelar.client.api_call.api_call(arg: APIContext)[source]

Bases: api_call_base

Class that exposes the STELAR API for a given entity.

api_call(proxy).foo(…) returns the ‘result’ of the STELAR API response on success, and raises a ProxyOperationError on failure.

api_call(client).foo(…) does the same.

dataset_export_zenodo(dataset_id: str) dict[source]

Export a dataset to Zenodo.

Parameters:

dataset_id (str) – The ID of the dataset to export.

Returns:

A dictionary containing the export message, ready to be sent to zenodo.

Return type:

dict

image_registry_token_create(title: str, expiration: str | None = None)[source]

Create a new image registry token. :param title: The title of the token. :type title: str :param expiration: The expiration date of the token in ISO format. Defaults to None. :type expiration: str | None, optional

Returns:

A dictionary containing the created token information.

Return type:

dict

image_registry_token_delete(uuid: str)[source]

Delete an image registry token.

Parameters:

uuid (str) – The UUID of the token to delete.

Returns:

A dictionary containing the deletion result.

Return type:

dict

image_registry_token_list(limit: int = None, offset: int = None)[source]

List image registry tokens.

Parameters:
  • limit (int, optional) – The maximum number of tokens to return.

  • offset (int, optional) – The offset for pagination.

  • Returns

image_registry_token_show(id: str)[source]

Show an image registry token.

Parameters:

uuid (str) – The UUID of the token to show.

Returns:

A dictionary containing the token information.

Return type:

dict

policy_create(policy_yaml: str | bytes)[source]

Create a new policy.

Parameters:

prolicy_data (str | bytes)

Returns:

A dictionary containing the created policy information.

Return type:

dict

policy_fetch(limit: int = None, offset: int = None)[source]

Fetch policies.

Parameters:
  • limit (int, optional) – The maximum number of policies to return.

  • offset (int, optional) – The offset for pagination.

Returns:

A list of dictionaries containing policy information.

Return type:

list

policy_list(limit: int = None, offset: int = None)[source]

List all policies.

Parameters:
  • limit (int, optional) – The maximum number of policies to return.

  • offset (int, optional) – The offset for pagination.

Returns:

A list of dictionaries containing policy information (policy_uuid, policy_familiar_name).

Return type:

list

policy_show(eid: str)[source]

Show a specific policy.

Parameters:

policy_uuid (str) – The UUID of the policy to show.

Returns:

A dictionary containing the policy information.

Return type:

dict

policy_spec(policy_uuid: str) bytes[source]

Get the specification of a policy.

Parameters:

policy_uuid (str) – The UUID of the policy to get the specification for.

Returns:

A dictionary containing the policy specification.

Return type:

dict

relationship_create(subject_id: str, rel: str, object_id: str, comment: str | None = None)[source]

Create a new relationship.

Parameters:
  • subject_id (str) – The ID of the subject of the relationship.

  • rel (str) – The type of the relationship.

  • object_id (str) – The ID of the object of the relationship.

  • comment (str, optional) – A comment for the relationship.

Returns:

A dictionary containing the created relationship information.

Return type:

dict

relationship_delete(subject_id: str, rel: str, object_id: str)[source]

Delete a relationship.

Parameters:
  • subject_id (str) – The ID of the subject of the relationship.

  • rel (str) – The type of the relationship.

  • object_id (str) – The ID of the object of the relationship.

relationship_show(subject_id: str, rel: str, object_id: str)[source]

Show a specific relationship.

Parameters:
  • subject_id (str) – The ID of the subject of the relationship.

  • rel (str) – The type of the relationship.

  • object_id (str) – The ID of the object of the relationship.

Returns:

A dictionary containing the relationship information.

Return type:

dict

relationship_update(subject_id: str, rel: str, object_id: str, comment: str | None = None)[source]

Update the comment of a relationship.

Parameters:
  • subject_id (str) – The ID of the subject of the relationship.

  • rel (str) – The type of the relationship.

  • object_id (str) – The ID of the object of the relationship.

  • comment (str, optional) – A comment for the relationship.

Returns:

A dictionary containing the created relationship information.

Return type:

dict

relationships_fetch(subject_id: str, rel: str | None = None, object_id: str | None = None, /)[source]

Show relationships for a subject.

resource_lineage(resource_id: str, forward: bool) dict[source]

Get the backward lineage of a resource.

Parameters:
  • resource_id (str) – The ID of the resource to get the lineage for.

  • forward (bool) – If True, get the forward lineage; if False, get the backward lineage.

Returns:

A dictionary containing the lineage information.

Return type:

dict

roles_fetch(limit: int = None, offset: int = None)[source]

Fetch roles.

Parameters:
  • limit (int, optional) – The maximum number of roles to return.

  • offset (int, optional) – The offset for pagination.

Returns:

A list of dictionaries containing role information.

Return type:

list

task_job_input(task_id: str, signature: str) dict[source]

Get the input for a job in a task.

task_list(limit: int = None, offset: int = None, state: str = None)[source]

List tasks.

task_post_job_output(task_id: str, signature: str, output_spec: dict) dict[source]

Get the output for a job in a task.

task_show_jobs(task_id: str)[source]

Show the jobs associated with a task.

task_show_logs(task_id: str)[source]

Show the logs associated with a task.

task_signature(task_id: str) dict[source]

Get the signature of a task.

user_add_role(user_id: str, role: str)[source]

Add a role to a user.

Parameters:
  • user_id (str) – The ID of the user to whom the role will be added.

  • role (str) – The role to be added to the user.

Returns:

A dictionary containing the current user state.

Return type:

dict

user_add_roles(user_id: str, roles: list[str])[source]

Add multiple roles to a user.

Parameters:
  • user_id (str) – The ID of the user to whom the roles will be added.

  • roles (list[str]) – A list of roles to be added to the user.

Returns:

A dictionary containing the current user state.

Return type:

dict

user_create(**kwargs)[source]
user_delete(id)[source]
user_fetch(limit: int = None, offset: int = None)[source]
user_list(limit: int = None, offset: int = None)[source]
user_patch(id, **kwargs)[source]
user_purge(id)[source]
user_remove_role(user_id: str, role: str)[source]

Remove a role from a user.

Parameters:
  • user_id (str) – The ID of the user from whom the role will be removed.

  • role (str) – The role to be removed from the user.

Returns:

A dictionary containing the current user state.

Return type:

dict

user_set_roles(user_id: str, roles: list[str])[source]

Set roles for a user, replacing any existing roles.

Parameters:
  • user_id (str) – The ID of the user whose roles will be set.

  • roles (list[str]) – A list of roles to be set for the user.

Returns:

A dictionary containing the current user state.

Return type:

dict

user_show(id: str)[source]
user_update(id, **kwargs)[source]
class stelar.client.api_call.api_call_base(arg: APIContext)[source]

Bases: api_context

Access the STELAR API using a client or a proxy.

This is the base class for api_call, defining the generic methods for all types of entities.

dataset_create(**kwargs)
dataset_delete(id)
dataset_fetch(limit=None, offset=None)
dataset_list(limit=None, offset=None)
dataset_patch(id, **kwargs)
dataset_purge(id)
dataset_show(id)
dataset_update(id, **kwargs)
get_call(proxy_type, op, member_type=None)[source]
group_add_dataset(id, member_id, capacity=None)
group_add_group(id, member_id, capacity=None)
group_add_tool(id, member_id, capacity=None)
group_add_user(id, member_id, capacity=None)
group_add_workflow(id, member_id, capacity=None)
group_create(**kwargs)
group_delete(id)
group_fetch(limit=None, offset=None)
group_list(limit=None, offset=None)
group_list_members_dataset(id, capacity=None)
group_list_members_group(id, capacity=None)
group_list_members_tool(id, capacity=None)
group_list_members_user(id, capacity=None)
group_list_members_workflow(id, capacity=None)
group_patch(id, **kwargs)
group_purge(id)
group_remove_dataset(id, member_id)
group_remove_group(id, member_id)
group_remove_tool(id, member_id)
group_remove_user(id, member_id)
group_remove_workflow(id, member_id)
group_show(id)
group_update(id, **kwargs)
image_registry_token_create(**kwargs)
image_registry_token_delete(id)
image_registry_token_fetch(limit=None, offset=None)
image_registry_token_list(limit=None, offset=None)
image_registry_token_patch(id, **kwargs)
image_registry_token_purge(id)
image_registry_token_show(id)
image_registry_token_update(id, **kwargs)
license_create(**kwargs)
license_delete(id)
license_fetch(limit=None, offset=None)
license_list(limit=None, offset=None)
license_patch(id, **kwargs)
license_purge(id)
license_show(id)
license_update(id, **kwargs)
organization_add_dataset(id, member_id, capacity=None)
organization_add_group(id, member_id, capacity=None)
organization_add_tool(id, member_id, capacity=None)
organization_add_user(id, member_id, capacity=None)
organization_add_workflow(id, member_id, capacity=None)
organization_create(**kwargs)
organization_delete(id)
organization_fetch(limit=None, offset=None)
organization_list(limit=None, offset=None)
organization_list_members_dataset(id, capacity=None)
organization_list_members_group(id, capacity=None)
organization_list_members_tool(id, capacity=None)
organization_list_members_user(id, capacity=None)
organization_list_members_workflow(id, capacity=None)
organization_patch(id, **kwargs)
organization_purge(id)
organization_remove_dataset(id, member_id)
organization_remove_group(id, member_id)
organization_remove_tool(id, member_id)
organization_remove_user(id, member_id)
organization_remove_workflow(id, member_id)
organization_show(id)
organization_update(id, **kwargs)
policy_create(**kwargs)
policy_delete(id)
policy_fetch(limit=None, offset=None)
policy_list(limit=None, offset=None)
policy_patch(id, **kwargs)
policy_purge(id)
policy_show(id)
policy_update(id, **kwargs)
process_add_task(id, member_id, capacity=None)
process_create(**kwargs)
process_delete(id)
process_fetch(limit=None, offset=None)
process_list(limit=None, offset=None)
process_list_members_task(id, capacity=None)
process_patch(id, **kwargs)
process_purge(id)
process_remove_task(id, member_id)
process_show(id)
process_update(id, **kwargs)
request(method: str, endpoint: str, params: dict = None, *, json=None, **kwargs)[source]
resource_create(**kwargs)
resource_delete(id)
resource_fetch(limit=None, offset=None)
resource_list(limit=None, offset=None)
resource_patch(id, **kwargs)
resource_purge(id)
resource_show(id)
resource_update(id, **kwargs)
tag_create(**kwargs)
tag_delete(id)
tag_fetch(limit=None, offset=None)
tag_list(limit=None, offset=None)
tag_patch(id, **kwargs)
tag_purge(id)
tag_show(id)
tag_update(id, **kwargs)
task_create(**kwargs)
task_delete(id)
task_fetch(limit=None, offset=None)
task_list(limit=None, offset=None)
task_patch(id, **kwargs)
task_purge(id)
task_show(id)
task_update(id, **kwargs)
tool_create(**kwargs)
tool_delete(id)
tool_fetch(limit=None, offset=None)
tool_list(limit=None, offset=None)
tool_patch(id, **kwargs)
tool_purge(id)
tool_show(id)
tool_update(id, **kwargs)
user_create(**kwargs)
user_delete(id)
user_fetch(limit=None, offset=None)
user_list(limit=None, offset=None)
user_patch(id, **kwargs)
user_purge(id)
user_show(id)
user_update(id, **kwargs)
vocabulary_create(**kwargs)
vocabulary_delete(id)
vocabulary_fetch(limit=None, offset=None)
vocabulary_list(limit=None, offset=None)
vocabulary_patch(id, **kwargs)
vocabulary_purge(id)
vocabulary_show(id)
vocabulary_update(id, **kwargs)
workflow_create(**kwargs)
workflow_delete(id)
workflow_fetch(limit=None, offset=None)
workflow_list(limit=None, offset=None)
workflow_patch(id, **kwargs)
workflow_purge(id)
workflow_show(id)
workflow_update(id, **kwargs)
class stelar.client.api_call.api_context(arg: APIContext)[source]

Bases: object

class stelar.client.api_call.api_model(**fields)[source]

Bases: object

static from_value(value)[source]
get_method(op, mm: api_model = None)[source]
stelar.client.api_call.gcall(self, query_spec)
stelar.client.api_call.generate_add(model: api_model, mm: api_model)[source]
stelar.client.api_call.generate_create(model: api_model)[source]
stelar.client.api_call.generate_delete(model: api_model)[source]
stelar.client.api_call.generate_fetch(model: api_model)[source]
stelar.client.api_call.generate_list(model: api_model)[source]
stelar.client.api_call.generate_list_members(model: api_model, mm: api_model)[source]
stelar.client.api_call.generate_patch(model: api_model)[source]
stelar.client.api_call.generate_purge(model: api_model)[source]
stelar.client.api_call.generate_remove(model: api_model, mm: api_model)[source]
stelar.client.api_call.generate_show(model: api_model)[source]
stelar.client.api_call.generate_unimplemented(model: api_model, op, mm=None)[source]
stelar.client.api_call.generate_update(model: api_model)[source]

stelar.client.backdoor module

Implement an accessor for CKAN API that bypasses the STELAR API. This is useful for debugging and testing.

class stelar.client.backdoor.CKAN(context='apitest', client=None)[source]

Bases: object

A simple-minded back door to CKAN. It assumes that CKAN

is published by the ingress on path ‘/dc’.

Use as follows: First, ensure that there is a context in ~/.stelar containing the field ‘ckan_apitoken’. For example: [apitest] base_url=https://stelar.foo.com username=joe password=joesecret ckan_apitoken: 123415343416151235jgf1gh3412jk1ljh5g1l5g….

Assuming the context is called ‘apitest’ (as above), do

dc = CKAN(‘apitesst’) dc.site_read() # This is like ‘ping’ dc.help_show(name=’site_read’) # shows CKAN help dc.package_list() dc.package_show(id=’shakespeare_novels’)

dc.package_create(name=’just_a_test’, title=’Just a test’, owner_org=’stelar-klms’) dc.package_delete(id=’just_a_test’)

… etc. Use

check() bool[source]
class stelar.client.backdoor.api_call_DC(arg: Proxy | Client)[source]

Bases: api_context

Class that exposes the CKAN API for the Data Catalog.

api_call(proxy).foo(…) returns the ‘result’ of the CKAN API response on success, and raises a ProxyOperationError on failure.

api_call(client).foo(…) does the same.

get_call(proxy_type, op)[source]

stelar.client.base module

class stelar.client.base.BaseAPI(base_url, token_json, tls_verify=True)[source]

Bases: RegistryCatalog

Base class for all parts of the client API.

Its main responsibility is to support API calls to the STELAR server. It also contains logic to manage the proxies.

DELETE(*endp, **params)[source]

Send a DELETE request to the API.

Example

response = c.DELETE(“v2/dataset”, “my_dataset”)

Parameters:
  • *endp – Path components to the API endpoint.

  • **params – The query parameters to send.

Returns:

The response object from the API.

Return type:

requests.Response

GET(*endp, **params)[source]

Send a GET request to the API.

Examples

response = c.GET(“v2/datasets”) response = c.GET(“v2/dataset”, ‘my_dataset’)

Parameters:
  • *endp – Path components to the API endpoint.

  • **params – The query parameters to send.

Returns:

The response object from the API.

Return type:

requests.Response

PATCH(*endp, params={}, **json)[source]

Send a PATCH request to the API.

Example

response = c.PATCH(“v2/dataset”, “my_dataset”, author=”John Doe”)

Parameters:
  • *endp – Path components to the API endpoint.

  • params – (keyword-only) The query parameters to send.

  • **json – The JSON data to send.

Returns:

The response object from the API.

Return type:

requests.Response

POST(*endp, params={}, **json)[source]

Send a POST request to the API.

Example

response = c.POST(“v2/dataset”, name=”my_dataset”)

Parameters:
  • *endp – Path components to the API endpoint.

  • params – (keyword-only) The query parameters to send.

  • **json – The JSON data to send.

Returns:

The response object from the API.

Return type:

requests.Response

PUT(*endp, params={}, **json)[source]

Send a PUT request to the API.

Example

response = c.PUT(“v2/tag”, “my_tag”, display_name=”My Tag”, vocabulary_id=’my_vocabulary’)

Parameters:
  • *endp – Path components to the API endpoint.

  • params – (keyword-only) The query parameters to send.

  • **json – The JSON data to send.

Returns:

The response object from the API.

Return type:

requests.Response

property api
api_request(method, endpoint, *, params=None, json=None)[source]

Do an actual API call

Examples

response = api_request(“GET”, “v2/datasets”) response = api_request(“POST”, “v2/dataset”, json={“name”: “my_dataset”})

Parameters:
  • method (str) – The HTTP method (‘GET’, ‘POST’, ‘PUT’, ‘PATCH’, ‘DELETE’).

  • endpoint (str) – The API endpoint. It should be given as a relative path.

  • params (dict, optional) – URL query parameters.

  • json (dict, optional) – JSON data to be sent in the body.

property api_url

Return the base URL to the STELAR API

cursor_for(proxy_type: Type[ProxyClass] | str, **kwargs) ProxyCursor[ProxyClass][source]

Get a cursor for a given proxy type.

Parameters:
  • proxy_type – The type of the proxy. This can be provided as a string (the name of the proxy) or as the class itself.

  • **kwargs – Additional arguments to pass to the cursor.

Returns:

The cursor for the proxy type.

Return type:

ProxyCursor

Example

client.cursor_for(“Dataset”) client.cursor_for(Dataset)

property klms_info
listapi(search: str = None, show_verbs: bool = True) list[str][source]

Return a list of all available API endpoints.

if search is provided, it will filter the endpoints to only include those that contain the search term.

Parameters:
  • search (str, optional) – A search term to filter the endpoints.

  • show_verbs (bool) – If True, include HTTP verbs in the output.

Returns:

A list of API endpoints, optionally with HTTP verbs.

Return type:

list[str]

request(method, endpoint, params=None, data=None, headers=None, json=None)[source]

Sends a request to the STELAR API.

The main difference of this method with respect to api_request is that the endpoint is relative to the base URL, and it can include headers, as well as non-JSON data (e.g., form data).

For example:

response = c.request(“GET”, “api/v2/datasets”) response = c.request(“POST”, “api/v2/dataset”, json={“name”: “my_dataset”})

Parameters:
  • method (str) – The HTTP method (‘GET’, ‘POST’, ‘PUT’, ‘DELETE’).

  • endpoint (str) – The API endpoint (relative to api_url). Can include query parameters.

  • params (dict, optional) – URL query parameters.

  • data (dict, optional) – Form data to be sent in the body.

  • headers (dict, optional) – Additional request headers.

  • json (dict, optional) – JSON data to be sent in the body.

Returns:

The response object from the API.

Return type:

requests.Response

reset_tokens(token_json)[source]

Reset the primary and refresh tokens.

Parameters:

token_json – The token response for authentication

property token

Getter for the token property.

token_expired()[source]

Check if the token has expired.

Returns:

True if the token has expired, False otherwise.

Return type:

bool

class stelar.client.base.KLMSInfo(info: dict)[source]

Bases: object

stelar.client.catalog module

class stelar.client.catalog.CatalogAPI(*args, **kwargs)[source]

Bases: BaseAPI

CatalogAPI is a superclass of the STELAR Python Client. It implements data catalog handling methods that utilizes a subset of the available STELAR API Endpoints that are related to catalog management operations (Publishing, Searching etc.).

fetch_active_vocabularies()[source]

Return a list of dicts with the id and name of each tag vocabulary.

This function is usually called to update the vocabulary index inside the client, and is not very useful to end users.

stelar.client.client module

The Client class is the main STELAR API client object.

The Client class primarily holds the API URL and user credentials needed to access the API.

class stelar.client.client.Client(context: str = None, *, base_url: str = None, username=None, password=None, token_json: dict = None, tls_verify=True, config_file: PathLike = None)[source]

Bases: WorkflowsAPI, CatalogAPI, KnowledgeGraphAPI, AdminAPI, S3API

An SDK (client) for the STELAR API.

Operation of the STELAR client requires three pieces of information:
  1. The base URL of the STELAR installation.

  2. A username for the user.

  3. Access and refresh tokens for the user. These tokens need to be refreshed periodically.

The client can be initialized in four ways:
  1. By providing nothing. This is equivalent to specifying the context name “default”.

  2. By providing a context name, which is looked up in the config file (see below).

  3. By providing a base URL, username, and password. The client will then authenticate the user and retrieve the access and refresh tokens. Note that, the password is not stored in the client or anywhere else.

  4. By providing a base URL, username, password, and a token JSON dictionary containing the access token, refresh token, and their expiration times.

When options 3. or 4. above are used, when the tokens expire, the user must call either the method reauthenticate(passwd) providing the password, or calling method reset_tokens(token_json) with a new token JSON dictionary. Again, these tokens will eventually expire.

By contrast, when the client is initialized with a context name, the client automatically reacquires the tokens when they expire, since the context config file contains the password needed to re-authenticate the user.

By default the config file is located at $HOME/.stelar, but can be overridden by providing the ‘config_file’ keyword argument. The config file contains a collection of contexts, and is encoded in the INI format:

[default]
base_url=https://klms.example.com
username=joe
password=my!secret

[admin]
base_url=https://klms.example.com
username=admin
password=very!secret

The token_json dictionary is expected to have the following (indicative) structure:

{
“access_token”: “your_access_token”,
“refresh_token”: “your_refresh_token”,
“expires_in”: 600,
“refresh_expires_in”: 7200,
}
Parameters:
  • context (str) – load the specified context from $HOME/.stelar (or the config_file path). If this is None, the default context is used. If a config file is not found, the base_url, username and password can be provided as keywords.

  • base_url (str) – The base URL to the STELAR installation. This URL contains only the hostname. Optionally, it may contain a user name and password, as in https://joe:joespassword@klms.example.com/ The user name and password are only used if the keyword arguments ‘username’ and ‘password’ are None.

  • username (str) – The user name to connect to for this client.

  • password (str) – The password to authenticate with.

  • token_json (dict) – A dictionary containing the access token, refresh token, and their expiration times.

  • tls_verify (bool) – Verify the server TLS certificate. This setting takes precedence if given. If none, the default is to verify.

  • config_file (PathLike) – Path to the config file. If None, the default of “$HOME/.stelar” is

  • used.

property DC
classmethod authenticate(base_url, username, password, tls_verify=True) dict[source]

Authenticates the user and retrieves access and refresh tokens.

This method sends a POST request to the authentication endpoint using the provided username and password. Upon successful authentication, the method updates the token property and refreshes the token for all subAPI instances.

Parameters:
  • base_url (str) – The URL of the STELAR service

  • username (str) – The username of the user.

  • password (str) – The password of the user.

  • tls_verify (str) – Whether to verify the server TLS certificate.

Raises:

RuntimeError – If authentication fails due to incorrect credentials or server issues.

Returns:

A dict containing the access token, refresh token, token expiration times and the type of token (should be ‘Bearer’).

reauthenticate(password: str = None)[source]

Refresh the access token for this client.

This method attempts to refresh the access token using the refresh token. If the refresh token is not available, or if it is also stale, the method will attempt to re-authenticate the user.

Parameters:

password (str) – A password, which is used for username/password authentication. If not provided, the context mechanism is used.

Raises:

RuntimeError – If the refresh token is invalid or if re-authentication fails.

classmethod token_refresh(base_url: str, refresh_token: str, tls_verify: bool = True) dict[source]

Use the given refresh token to retrieve new access and refresh tokens.

Parameters:
  • base_url (str) – The URL of the STELAR service

  • refresh_token (str) – The refresh token to use.

  • tls_verify (bool) – Whether to verify the server TLS certificate.

Returns:

A dict containing the access token, refresh token, token expiration times and the type of token (should be ‘Bearer’).

Raises:

RuntimeError – If authentication fails due to incorrect credentials or server issues.

stelar.client.dataset module

class stelar.client.dataset.Dataset(registry: Registry, eid: str | UUID | None = None, entity=None)[source]

Bases: PackageProxy, LicensedProxy

A proxy of a STELAR dataset.

add_dataframe(df: DataFrame, s3path: str, format: str = None, **kwargs) Resource[source]

Add a DataFrame as a resource to the dataset.

Parameters:
  • df (pd.DataFrame) – The DataFrame to add.

  • s3path (str) – The S3 path to save the DataFrame.

  • format (str) – The format of the file. If not specified, an attempt will be done to infer it.

  • **kwargs – Additional keyword arguments to pass to the write_dataframe function

export_zenodo() dict[source]

Export the dataset to Zenodo.

This method will create and return a new Zenodo record for the dataset. The method returns the Zenodo record as a dictionary.

Returns:

The Zenodo record for the dataset.

Return type:

dict

proxy_schema = <stelar.client.proxy.schema.Schema object>
read_dataframe(format: str | None = None, **kwargs)[source]

Read the dataset as a DataFrame.

Note: the dataframe need not be stored in S3 Storage.

Parameters:
  • format (str) – The format of the file to read. If not specified, the format will be inferred from the file extension.

  • kwargs (dict) – Additional keyword arguments to pass to the read.

Returns:

The DataFrame read from the dataset.

Return type:

pd.DataFrame

spatial

The ‘spatial’ field

Type:

GeoJSON|None

title

The ‘title’ field

Type:

str|None

url

The ‘url’ field

Type:

str|None

version

The ‘version’ field length <= 100

Type:

str|None

class stelar.client.dataset.DatasetCursor(client)[source]

Bases: PackageCursor[Dataset]

publish_dataframe(df: DataFrame, s3path: str, format: str | None = None, *, write={}, **properties) Dataset[source]

Publish a DataFrame as a new dataset.

The dataframe will be stored at the given path in the format specified by the ‘format’ argument. If the format is not specified, an attempt will be done to infer it from the file extension of the s3path.

Additional arguments to the pandas write method (DataFrame.to_{format}) can be passed using the ‘write’ argument.

Parameters:
  • df (pd.DataFrame) – The DataFrame to publish.

  • s3path (str) – The S3 path to save the DataFrame.

  • format (str) – The format of the file. If not specified, an attempt will be done to infer it.

  • write (dict) – Keyword arguments to pass to the write_dataframe function

  • **properties – Properties of the new dataset.

publish_file(s3file: str, format: str | None = None, *, resource: dict | None = {}, **dataset_properties) Dataset[source]

Publish a new dataset in the catalog for a single file in Storage.

The main input to this call is a single file in Storage, identified by its S3 URL. By default, this call will create a new dataset in the catalog and a new resource, which will be initialized by provided properties and also by infering properties by analyzing the given S3 URL.

If the resource parameter is set explicitly to None, no resource will be created; instead, the dataset will be assigned the given S3 URL as its URL.

Parameters:
  • s3path (str) – The S3 path to the file.

  • format (str) – The format of the file. If not specified, an attempt will be done to infer it.

  • resource_properties (dict) – Properties of the new resource. If this is set explicitly to None, no resource will be created; instead, the dataset

  • **dataset_properties – Properties of the new dataset.

stelar.client.generic module

Facility for calling the STELAR API.

The functions in this file will be changed (together with this documentation) as the API implementation progresses.

class stelar.client.generic.GenericCursor(client: Client, proxy_type: Type[ProxyClass])[source]

Bases: ProxyCursor[ProxyClass], Registry[ProxyClass]

create(**prop) ProxyClass[source]

Create a new entity of this type.

fetch(*, limit: int, offset: int) Iterator[ProxyClass][source]

Fetch entities of this type.

fetch_list(*, limit: int, offset: int) list[str][source]

Lists entities of this type.

get(name_or_id: str | UUID, default: ProxyClass | None = None) ProxyClass[source]

Get an entity by name or ID.

class stelar.client.generic.GenericProxy(registry: Registry, eid: str | UUID | None = None, entity=None)[source]

Bases: Proxy

delete(purge=False)[source]

Delete the entity proxied by this proxy.

If the entity is purged then the deletion is permanent. After the purge deletion, the proxy is left in the ERROR state.

Otherwise, the deletion removes the entity from the active ones, but the entity can still be accessed. Searches will not return the entity.

TODO: Implement entity reclamation for non-purged entities!

id

The ID not null

Type:

UUID (read-only)

proxy_sync(entity=None)[source]

Sync the proxy with the entity in the API.

class stelar.client.generic.GenericProxyList(eid_list, client, proxy_type)[source]

Bases: ProxyList

property coll
resolve_proxy(item)[source]

This is the main routine that transforms elements of the list to proxies.

stelar.client.generic.generic_create(client: Client, proxy_type: Type[ProxyClass], **properties) ProxyClass[source]
stelar.client.generic.generic_delete(proxy: Proxy, purge=False)[source]
stelar.client.generic.generic_fetch(client: Client, proxy_type: Type[ProxyClass], *, limit: int, offset: int, **kwargs) Iterator[ProxyClass][source]
stelar.client.generic.generic_fetch_list(client: Client, proxy_type: Type[ProxyClass], *, limit: int, offset: int, **kwargs) list[str][source]
stelar.client.generic.generic_fetch_old(client: Client, proxy_type: Type[ProxyClass], *, limit: int, offset: int, **kwargs) Iterator[ProxyClass][source]
stelar.client.generic.generic_get(client: Client, proxy_type: Type[ProxyClass], name_or_id, default=None) ProxyClass[source]
stelar.client.generic.generic_proxy_sync(proxy: Proxy, entity, update_method='patch')[source]

Perform proxy_sync(entity) using the api_call class.

Parameters:
  • proxy (Proxy) – the proxy to sync

  • entity (Entity|None) – the entity to sync from

  • update_method – one of ‘update’ or ‘patch’

stelar.client.group module

class stelar.client.group.Group(registry: Registry, eid: str | UUID | None = None, entity=None)[source]

Bases: GroupBase

proxy_schema = <stelar.client.proxy.schema.Schema object>
class stelar.client.group.GroupBase(registry: Registry, eid: str | UUID | None = None, entity=None)[source]

Bases: NamedProxy

Proxy for a STELAR Data Catalog group and organization. This is an abstract class. The group subclass is defined later.

add(member: Proxy, capacity: str = 'member')[source]

Add a member to the group.

Parameters:
  • member – The member to add.

  • capacity – The capacity of the member.

approval_status

The ‘approval_status’ field

Type:

str|None

created

The ‘created’ field

Type:

datetime|None (read-only)

property datasets

Get the datasets of the group.

description

The ‘description’ field

Type:

str|None

get_members(proxy_type: type[Proxy], capacity: str | None = None) MemberList[source]

Get the members of the group.

Parameters:
  • proxy_type – The type of the members.

  • capacity – The capacity of the members.

Returns:

MemberList, a list of members.

property groups

Get the groups of the group.

image_url

The ‘image_url’ field

Type:

str|None

is_organization

The ‘is_organization’ field

Type:

bool|None (read-only)

remove(member: Proxy)[source]

Remove a member from the group.

Parameters:

member – The member to remove.

title

The ‘title’ field

Type:

str|None

property tools

Get the tools of the group.

property users

Get the users of the group.

property workflows

Get the workflows of the group.

class stelar.client.group.MemberList(client, proxy_type, members, capacities)[source]

Bases: ProxyVec

to_df(*additional, fields=None, simplify=True)[source]

Generate a pandas dataframe for the list of proxy entities.

The dataframe is generated by fetching and tabulating a subset of fields, for each entity in the list.

class stelar.client.group.Organization(registry: Registry, eid: str | UUID | None = None, entity=None)[source]

Bases: GroupBase

proxy_schema = <stelar.client.proxy.schema.Schema object>

stelar.client.knowgraph module

class stelar.client.knowgraph.KnowledgeGraphAPI(base_url, token_json, tls_verify=True)[source]

Bases: BaseAPI

stelar.client.license module

class stelar.client.license.License(registry: Registry, eid: str | UUID | None = None, entity=None)[source]

Bases: GenericProxy

description

The ‘description’ field

Type:

str|None

id

The ID not null

Type:

UUID (read-only)

image_url

The ‘image_url’ field

Type:

str|None

key

The name field, which is a unique string identifying the entity. not null 2 <= length <= 100

Type:

str (read-only)

metadata_created

The ‘metadata_created’ field

Type:

datetime|None (read-only)

metadata_modified

The ‘metadata_modified’ field

Type:

datetime|None (read-only)

open_data_approved

The ‘open_data_approved’ field not null

Type:

bool

osi_approved

The ‘osi_approved’ field not null

Type:

bool

proxy_schema = <stelar.client.proxy.schema.Schema object>
title

The ‘title’ field not null

Type:

str

url

The ‘url’ field

Type:

str|None

class stelar.client.license.LicenseCursor(client: Client)[source]

Bases: GenericCursor[License]

Cursor for Licenses.

class stelar.client.license.LicensedProxy(registry: Registry, eid: str | UUID | None = None, entity=None)[source]

Bases: Proxy

A proxy that has a license.

property license: License | None

Return the License object associated with this proxy, or none.

license_id

The ‘license_id’ field

Type:

str|None

stelar.client.lineage module

class stelar.client.lineage.ENode(id: 'UUID', type: 'str', lineage: "'Lineage'")[source]

Bases: object

property ent: Proxy

Return the proxy for this ENode.

id: UUID
incoming: list[ENode]
lineage: Lineage
outgoing: list[ENode]
type: str
class stelar.client.lineage.EResource(id: 'UUID', type: 'str', lineage: "'Lineage'", package_id: 'UUID | None' = None, url: 'str | None' = None, label: 'str' = '')[source]

Bases: ENode

label: str = ''
package_id: UUID | None = None
url: str | None = None
class stelar.client.lineage.ETask(id: 'UUID', type: 'str', lineage: "'Lineage'", label: 'str' = '', state: 'str' = 'unknown', image: 'str | None' = None, process_id: 'UUID | None' = None, start_date: 'datetime | None' = None, end_date: 'datetime | None' = None)[source]

Bases: ENode

end_date: datetime | None = None
image: str | None = None
label: str = ''
process_id: UUID | None = None
start_date: datetime | None = None
state: str = 'unknown'
class stelar.client.lineage.Lineage(client: Client, focus_id: UUID, data: dict, forward: bool = False)[source]

Bases: object

Represents a lineage graph between resources and tasks in the Stelar system.

A lineage is a collection of tasks and resources that share a common ancestry or descendant.

property focus: Resource

Return the focus resource of this lineage.

The focus is the resource that is at the center of the lineage graph.

stelar.client.model module

A module containing useful definitions related to STELAR API entities

exception stelar.client.model.DuplicateEntryError[source]

Bases: Exception

exception stelar.client.model.EntityNotFoundError[source]

Bases: Exception

exception stelar.client.model.MissingParametersError[source]

Bases: Exception

exception stelar.client.model.STELARUnknownError[source]

Bases: Exception

stelar.client.mutils module

Author: Petrou Dimitrios Organization: Athena Research Center Project Name: STELAR EU Project Info: https://stelar-project.eu/

stelar.client.mutils.is_s3url(url: str) bool[source]

Check if a given URL is an S3 URL.

Parameters:

url (str) – The URL to check.

Returns:

True if the URL is an S3 URL, False otherwise.

Return type:

bool

stelar.client.mutils.s3spec_to_dict(objspec: str | tuple[str, str] | Object) dict[str, str][source]

Converts an S3 object specification to a dictionary with bucket and object keys.

The main use case for this function is to call client.s3 methods quickly:

client.s3.get_object(**s3spec_to_dict("s3://bucket/object"))
Parameters:
  • objspec (S3ObjSpec) – A URL (string), tuple of two strings,

  • object. (or minio.datatypes.Object instance representing an S3)

Returns:

A dictionary with keys “bucket_name” and “object_name”.

Return type:

dict[str, str]

stelar.client.mutils.s3spec_to_pair(objspec: str | tuple[str, str] | Object) tuple[str, str][source]

Converts an S3 object specification to a pair of bucket and object name.

Parameters:
  • objspec (S3ObjSpec) – A URL (string), tuple of two strings,

  • object. (or minio.datatypes.Object instance representing an S3)

Returns:

A pair of strings, representing the bucket and object name.

Return type:

tuple[str, str]

stelar.client.mutils.s3spec_to_url(objspec: str | tuple[str, str] | Object) str[source]

Converts an S3 object specification to a URL string.

Parameters:
  • objspec (S3ObjSpec) – A URL (string), tuple of two strings,

  • object. (or minio.datatypes.Object instance representing an S3)

Returns:

A URL string representing the S3 object.

Return type:

str

stelar.client.named module

class stelar.client.named.NamedProxy(registry: Registry, eid: str | UUID | None = None, entity=None)[source]

Bases: GenericProxy, ExtrasProxy

Proxies for entities with a name which is unique.

Named proxies include those implemented in CKAN as packages or groups. Other entities may have a name atrribute, but it is not unique.

extras

The field holding extras (additional fields) for this entity. This field should not be accessed directly, instead its contents are available as normal attributes.

name

The name field, which is a unique string identifying the entity. not null 2 <= length <= 100

Type:

str (read-only)

state

The ‘state’ field not null

Type:

OneOf[‘active’, ‘deleted’] (read-only)

type

The ‘type’ field

Type:

str|None (read-only)

stelar.client.package module

Declare utilities for package-derived types of entities.

These will be: - datasets - workflows - workflow processes - tools

class stelar.client.package.PackageCursor(client, proxy_type)[source]

Bases: GenericCursor[PackageProxy]

A cursor for package-based entities (datasets, tools, workflows etc).

This cursor provides package-specific methods for searching and filtering the entities, based on CKAN’s Solr backend.

property default_organization

Return the default organization.

This is a cached property, used in the initialization of the organization field at PackageProxy creation.

search(*, q: str | None = None, bbox: list[float] | None = None, fq: list[str] = [], fl: list[str] = None, sort: str = None, limit: int | None = None, offset: int | None = None, facet: dict[str, Any] | None = None)[source]

Search for package-based entities (datasets, tools, workflows etc).

This is the main function for searching the data catalog for packages. Many other functions are implemented on top of this one.

Parameters:
  • q – The query string.

  • bbox – A list of four floats representing the bounding box of a spatial query.

  • fq – A list of filter queries. These are not used to obtain the score of the results, but instead just to filter the results. They are quite efficient.

  • fl – A list of fields to return. If None, a proper entity is returned. Note that some fields are special (not actually attribute fields), e.g., the score field.

  • sort – The fields to sort by. Sorting can be ascending or descending.

  • limit – The maximum number of results to return.

  • offset – The offset to start from.

  • facet – A dictionary of facet field spec (facet attributes and limits).

Returns:

  • count: The number of results found (not the number of results returned).

  • results: A list of results.

  • facets: A dictionary of facets.

Return type:

An answer which contains the following fields

with_tag(tagarg: Tag | str, *, limit: int | None = None, offset: int | None = None)[source]

Return a list of entities ids which have the given tag

Parameters:
  • tagarg – A Tag (proxy) or tagspec (a string)

  • limit – The maximum number of results to return.

  • offset – The offset to start from.

Returns:

A proxy list of entity ids

class stelar.client.package.PackageProxy(registry: Registry, eid: str | UUID | None = None, entity=None)[source]

Bases: NamedProxy, TaggableProxy

add_relationship(rel: Rel | str, obj: PackageProxy | UUID, comment: str | None = None)[source]

Add a relationship with this package as subject.

Parameters:
  • rel – The relationship type to add.

  • obj – The object to relate to, either a PackageProxy or UUID.

  • comment – An optional comment for the relationship.

Returns:

add_resource(**properties)[source]

Add a new resource with the given properties.

Example: new_rsrc = d.add_resource(name=”Profile”, url=”s3://datasets/a.json”,

format=”json”, mimetype=”application/json”)

Parameters:

**properties – The arguments to pass. See ‘Resource’ for details.

author

The ‘author’ field

Type:

str|None (read-only)

author_email

The ‘author_email’ field

Type:

str|None (read-only)

creator

creator_user_id

Type:

UUID|None (read-only)

Type:

The ‘creator’ field JSON field

groups

The ‘groups’ field not null

Type:

List[Group] (read-only)

maintainer

The ‘maintainer’ field

Type:

str|None

maintainer_email

The ‘maintainer_email’ field

Type:

str|None

metadata_created

The ‘metadata_created’ field

Type:

datetime|None (read-only)

metadata_modified

The ‘metadata_modified’ field

Type:

datetime|None (read-only)

notes

The ‘notes’ field

Type:

str|None

organization

owner_org

Type:

Organization

Type:

The ‘organization’ field not null JSON field

private

The ‘private’ field not null

Type:

bool

relationships

The ‘relationships’ field

Type:

Any|None (read-only)

resources

The ‘resources’ field not null

Type:

List[Resource] (read-only)

stelar.client.pdutils module

Utilities related to the Pandas library.

class stelar.client.pdutils.StelarDataFrameAccessor(df: DataFrame)[source]

Bases: object

write_dataset(client: Client, path: str, format=None, **kwargs)[source]

Write a DataFrame to a file.

This function writes a DataFrame to a file.

Parameters:
  • client (Client) – The client to use to write the file.

  • path (str) – The path to the file to write.

  • format (str, optional) – The format of the file to write. If not specified, the format will be inferred from the file extension.

  • kwargs (dict) – Additional keyword arguments to pass to the write

class stelar.client.pdutils.StelarSeriesAccessor(ds: Series)[source]

Bases: object

getattr(name, default=<NA>)[source]

Retrieve an attribute from all objects in a series.

This is particularly useful when the series contains proxy objects.

to_proxy_vec(client: Client, proxy_type: Type[ProxyClass]) ProxyList[source]

Convert a series of UUIDs to a proxy vector.

All items in the series are expected to be UUIDs. In particular, None, NA and missing values are not allowed.

stelar.client.pdutils.get_pandas_storage_options(client: Client)[source]

Get the storage options for a pandas read/write operation.

Pandas supports access to files stored in S3, but it requires the credentials to be passed as a dictionary. This function returns the dictionary with the credentials from the client.

stelar.client.pdutils.infer_format(path: str, hint: str = None) str | None[source]

Infer the format of a file from its extension, or a hint.

stelar.client.pdutils.read_dataframe(client: Client, path: str, format=None, **kwargs) pd.DataFrame[source]

Read a DataFrame from a file.

This function reads a DataFrame from a file and returns it.

Parameters:
  • client (Client) – The client to use to read the file.

  • path (str) – The path to the file to read. This must be an “s3” URL.

  • format (str, optional) – The format of the file to read. If not specified, the format will be inferred from the file extension.

  • kwargs (dict) – Additional keyword arguments to pass to the read”

stelar.client.pdutils.write_dataframe(client: Client, df: pd.DataFrame, path: str, format=None, **kwargs)[source]

Write a DataFrame to a file.

This function writes a DataFrame to a file.

Parameters:
  • client (Client) – The client to use to write the file.

  • df (pd.DataFrame) – The DataFrame to write.

  • path (str) – The path to the file to write.

  • format (str, optional) – The format of the file to write. If not specified, the format will be inferred from the file extension.

  • kwargs (dict) – Additional keyword arguments to pass to the write

stelar.client.policy module

class stelar.client.policy.Policy(registry: Registry, eid: str | UUID | None = None, entity=None)[source]

Bases: GenericProxy

A proxy for a STELAR policy.

active

Whether the policy is active or not. not null

Type:

bool (read-only)

created_at

The ‘created_at’ field not null

Type:

datetime (read-only)

creator

user_id

Type:

str (read-only)

Type:

The user who created the policy. not null JSON field

id

policy_uuid

Type:

UUID (read-only)

Type:

The ID not null JSON field

policy_name

policy_familiar_name

Type:

str

Type:

The name of the policy to be applied. not null JSON field

proxy_schema = <stelar.client.proxy.schema.Schema object>
property spec

A property that returns the policy content as a byte array.

class stelar.client.policy.PolicyCursor(client)[source]

Bases: GenericCursor

A cursor for iterating over policies.

property active
create(policy_yaml: bytes) Policy[source]

Create a new policy.

Parameters:
  • spec (bytes) – The policy specification as a byte array.

  • **kwargs – Additional keyword arguments for the policy.

Returns:

The created policy.

Return type:

Policy

stelar.client.process module

class stelar.client.process.ExecStateField(*args, **kwargs)[source]

Bases: EnumeratedField

VALUES = ['running', 'succeeded', 'failed']
class stelar.client.process.Process(registry: Registry, eid: str | UUID | None = None, entity=None)[source]

Bases: PackageProxy

Proxy object for workflow processes (executions).

creator

The ‘creator’ field

Type:

str|None (read-only)

end_date

The ‘end_date’ field

Type:

datetime|None

exec_state

The ‘exec_state’ field

Type:

OneOf[‘running’, ‘succeeded’, ‘failed’]|None (read-only)

proxy_schema = <stelar.client.proxy.schema.Schema object>
run(task_spec: TaskSpec, secrets=None) Task[source]

Create a new Task in this process

start_date

The ‘start_date’ field

Type:

datetime|None (read-only)

tasks

The ‘tasks’ field not null

Type:

List[Task] (read-only)

terminate(new_state: str = 'succeeded')[source]

Terminate the process execution.

This call transitions the exec_state of the process to the given state. The only meaningful values are those validated with the ExecStateField (namely, ‘running’, ‘succeeded’, ‘failed’).

Note, that the process must be ‘running’ for this call to have any effect.

Parameters:

new_state – The new state to transition to.

title

The ‘title’ field

Type:

str|None

url

The ‘url’ field

Type:

str|None

version

The ‘version’ field length <= 100

Type:

str|None

workflow

The ‘workflow’ field

Type:

Workflow|None

class stelar.client.process.ProcessCursor(client)[source]

Bases: PackageCursor[Process]

stelar.client.relationship module

class stelar.client.relationship.Rel(value)[source]

Bases: Enum

Enum for relationship types.

CHILD_OF = 'child_of'
DEPENDENCY_OF = 'dependency_of'
DEPENDS_ON = 'depends_on'
DERIVES_FROM = 'derives_from'
HAS_DERIVATION = 'has_derivation'
LINKED_FROM = 'linked_from'
PARENT_OF = 'parent_of'
is_canonical() bool[source]

Return True if the relationship is forward, False if it is backward.

peer() Rel[source]

Return the peer relationship type.

class stelar.client.relationship.RelProxy(subj: PackageProxy)[source]

Bases: object

A proxy for a set of relationships.

add(rel: Rel | str, obj: PackageProxy | UUID, comment: str | None = None) Relationship[source]

Add a relationship to the subject.

property child_of: Relationships
property dependency_of: Relationships
property depends_on: Relationships
property derives_from: Relationships
get(rel: Rel | str, obj: PackageProxy | UUID) Relationship[source]
property has_derivation: Relationships
property linked_from: Relationships
property parent_of: Relationships
remove(rel: Rel | str, obj: PackageProxy | UUID) None[source]

Remove a relationship from the subject.

property subject_id: UUID

Return the ID of the subject.

class stelar.client.relationship.Relationship(client: Client, reldata: Dict[str, Any])[source]

Bases: object

canonical() Relationship[source]

Return the canonical version of the relationship.

delete() None[source]

Delete the relationship.

exists() bool[source]

Check if the relationship exists in the database.

from_dict(data: Dict[str, Any]) None[source]

Update the relationship from a dictionary.

classmethod from_triple(subject: PackageProxy, rel: Rel, object: PackageProxy, comment: str | None = None) Relationship[source]
matches(subj: MatchExpr, rel: Rel | str | None, obj: MatchExpr) bool[source]

Check if the relationship matches the given subject, relationship type, and object.

Matching is semantic, i.e., a PARENT_OF will match a CHILD_OF relationship if the subject and object are reversed.

A match expression can be - A proxy object - A UUID - A string matching the name of the package entity - A proxy type (Dataset, Process, etc.) matching the type - None (to ignore that part of the match)

Parameters:
  • subj – The subject to match against, either a PackageProxy or UUID.

  • rel – The relationship type to match against, if specified.

  • obj – The object to match against, either a PackageProxy or UUID.

Returns:

True if the relationship matches the given subject and optional relationship type,

False otherwise.

Return type:

bool

property object: PackageProxy

Return a proxy to the object of the relationship.

object_data() Dict[str, Any][source]

Return a dictionary with the object’s data.

peer() Relationship[source]

Return the peer relationship.

set_comment(new_comment: str) None[source]

Set a new comment for the relationship.

property subject: PackageProxy

Return a proxy to the subject of the relationship.

subject_data() Dict[str, Any][source]

Return a dictionary with the subject’s data.

to_dict() Dict[str, Any][source]

Return a dictionary representation of the relationship.

class stelar.client.relationship.Relationships(client: Client, relationships: Iterable[Relationship] = [])[source]

Bases: set

A set of relationships.

delete() None[source]

Delete all relationships in the set.

entities() set[PackageProxy][source]

Return a set of entities in the relationships.

Entities are either subjects or objects of some relationship.

classmethod from_api(client: Client, reldata: Iterable[Dict[str, Any]]) Relationships[source]

Create a Relationships from API data.

matching(subj: MatchExpr, rel: Rel | str | None, obj: MatchExpr) Relationships[source]

Return the relationships matching a pattern.

This method filters the relationships in the set based on the provided subject, rel and object. If any of these parameters are None, they are ignored in the matching. Note that matching is done semantically, i.e., a PARENT_OF matches a CHILD_OF, reversing the subject and object.

For this, the matches method of the Relationship class is used.

Parameters:
  • subj – The subject to match against, either a PackageProxy or UUID.

  • rel – The relationship type to match against, if specified.

  • obj – The object to match against, either a PackageProxy or UUID.

Returns:

A new set of relationships that match the criteria.

Return type:

Relationships

objects(ptype: type[PackageProxy] | None = None) set[PackageProxy][source]

Return a set of the objects in the relationships.

This call is similar to entities(), but only returns the objects of the relationships, optionally filtered by type. Note that the

Parameters:

ptype – If specified, only return objects of this type.

Returns:

A set of the objects in the relationships.

stelar.client.relationship.entity_data_matches(edata: Dict[str, Any], match: MatchExpr) bool[source]

Check if the entity data matches the given match expression.

A match expression can be: - A proxy object - A UUID - A string matching the name of the package entity - A proxy type (Dataset, Process, etc.) matching the type - None (to ignore that part of the match)

Parameters:
  • edata – The entity data to check against.

  • match – The match expression to check.

Returns:

True if the entity data matches the expression, False otherwise.

Return type:

bool

stelar.client.reprstyle module

Generation of rich (e.g., html) representations for proxies.

Code used here follows the ipython rich display protocol, which is described in the IPython documentation.

It is also useful in the context of Jupyter notebooks, where the representation of objects can be customized to provide a richer experience to the user.

stelar.client.reprstyle.dataset_to_html(obj: Dataset) str[source]

Provide an HTML representation of the Dataset instance for Jupyter display, with enhanced styles, watermark, and consistent formatting.

stelar.client.reprstyle.resource_to_html(obj: Resource) str[source]

Return an HTML representation of a resource.

Provide an HTML representation of the Resource instance for Jupyter display, with enhanced styles, watermark, and consistent formatting.

stelar.client.resource module

class stelar.client.resource.ExtrasResourceProperty(**kwargs)[source]

Bases: ExtrasProperty

The handling of extras is different for Resource entities.

convert_entity_to_proxy(proxy: Proxy, entity: Any, **kwargs)[source]

Update proxy dict to represent this property from the entity

convert_proxy_to_entity(proxy: Proxy, entity: dict, **kwargs)[source]

Update entity dict to represent this property from the proxy. The changes flag is true when the proxy_attr is actually the Proxy.proxy_changes dict.

convert_to_create(proxy_type, create_props: dict, entity_props: dict, **kwargs)[source]

Convert a value to be used for entity creation.

Parameters:
  • client (Client) – The client used for creation.

  • proxy_type (ProxyClass) – The entity type being created.

  • create_props – The object passed to the create client call

  • entity_props – The entity object given to the create API call.

class stelar.client.resource.PackageField(ref_property: Reference, ref_typename: str, **kwargs)[source]

Bases: RefField

A field validator for package references.

property proxy_type

Return the proxy type for the package reference.

class stelar.client.resource.PackageRef[source]

Bases: Reference

A polymprphic reference to a package entity, used in Resource.

ENTITIES = ('Dataset', 'Process', 'Tool', 'Workflow')
VALIDATOR_CLASS

alias of PackageField

property proxy_types

Return the proxy types that this reference can point to.

registry_for(obj) Any[source]

Return the registry for the package reference, given owner.

class stelar.client.resource.Resource(registry: Registry, eid: str | UUID | None = None, entity=None)[source]

Bases: GenericProxy

A proxy for a STELAR resource with metadata and additional details.

cache_last_updated

The ‘cache_last_updated’ field

Type:

datetime|None

cache_url

The ‘cache_url’ field

Type:

str|None

created

The ‘created’ field

Type:

datetime|None

dataset

package_id

Type:

Dataset (read-only)

Type:

The ‘dataset’ field not null JSON field

description

The ‘description’ field

Type:

str|None

format

The ‘format’ field

Type:

str|None

hash

The ‘hash’ field

Type:

str|None

id

The ID not null

Type:

UUID (read-only)

last_modified

The ‘last_modified’ field

Type:

datetime|None

lineage(forward=False) Lineage[source]

Get the lineage of this resource.

The lineage is a directed graph of resources and tasks that are reachable from this resource. Arcs in the graph correspond to resources being inputs or outputs of tasks. The lineage is used to track the flow of data and tasks in the STELAR system.

The lineage can be either forward (from this resource to its descendants) or backward (from this resource to its ancestors).

Parameters:

forward (bool) – If True, get the forward lineage; otherwise, get the backward lineage.

Returns:

A Lineage object containing the lineage information.

Return type:

Lineage

metadata_modified

The ‘metadata_modified’ field

Type:

datetime|None (read-only)

mimetype

The ‘mimetype’ field

Type:

str|None

mimetype_inner

The ‘mimetype_inner’ field

Type:

str|None

name

The ‘name’ field

Type:

str|None

open(mode='rb', **kwargs)[source]

Open the resource for reading or writing.

Parameters:

mode (str) – The mode in which to open the resource. This can be one of the following: ‘r’, ‘rb’, ‘w’, ‘wb’, ‘a’, ‘ab’.

Returns:

A file-like object that can be used to read or write data.

Return type:

file-like

position

The ‘position’ field

Type:

int|None (read-only)

proxy_schema = <stelar.client.proxy.schema.Schema object>
proxy_sync(entity=None)[source]

Sync the proxy with the entity in the API.

read_dataframe(format=None, **kwargs)[source]

Read a DataFrame from the resource.

Parameters:
  • format (str) – The format of the file to read. If not specified, the format will be inferred from the file extension.

  • kwargs (dict) – Additional keyword arguments to pass to the read.

Returns:

The DataFrame read from the resource.

Return type:

pd.DataFrame

resource_type

The ‘resource_type’ field

Type:

str|None

size

The ‘size’ field

Type:

int|None

state

The ‘state’ field

Type:

str|None (read-only)

url

The ‘url’ field

Type:

str|None

url_type

The ‘url_type’ field

Type:

str|None

class stelar.client.resource.ResourceCursor(api)[source]

Bases: GenericCursor

A cursor for a collection of STELAR resources.

fetch(**kwargs)[source]

Fetch entities of this type.

fetch_list(**kwargs)[source]

Lists entities of this type.

for_object(s3obj_spec: S3ObjSpec) ProxyVec[source]

Return resources for a given S3 object specification.

Parameters:

s3obj_spec (S3ObjSpec) – The S3 object specification.

Returns:

A vector of resources for the given S3 object

Return type:

ProxyVec

search(*, query: list[str] | None = [], order_by: str = None, limit: int | None = None, offset: int | None = None)[source]

Search for resources.

This is the main function for searching the data catalog for resources. Other functions are implemented on top of this one.

A resource query is a conunction of query terms of the form <field>:<match>. The query terms are combined with AND. The match is a string with optional wildcards.

Parameters:
  • query – A list of query strings. Each query string is of the form “<field>:<text>”.

  • order_by – A field to order by. Only a single field is allowed and only ascending order is supported.

  • limit – The maximum number of results to return.

  • offset – The offset to start from.

Returns:

  • count: The number of results found (not the number of results returned).

  • results: A list of dicts, each corresponding to a resource entity.

Return type:

An answer dict which contains the following fields

search_url(path: str) ProxyVec[source]

Return resources whose url matches the given string.

Parameters:

path (str) – The partial URL to search for.

Returns:

A vector of resources with matching URLs.

Return type:

ProxyVec

stelar.client.s3 module

class stelar.client.s3.S3API(*args, **kwargs)[source]

Bases: BaseAPI

property s3: Minio
s3_access_data() dict[source]

Return a dict with options for accessing the S3 API.

s3fs() S3FileSystem[source]

Return a file-system handler for the data lake.

This method returns an instance of the s3fs.S3FileSystem class that can be used to interact with the data lake.

Please see <https://github.com/fsspec/s3fs/> for more information.

s3fs_open(path: str, mode: str = 'rb', **kwargs)[source]

Open a file in the data lake.

This method returns a file-like object that can be used to read or write data from the data lake.

Parameters:
  • path (str) – The path to the file in the data lake.

  • mode (str) – The mode in which to open the file. This can be one of the following: ‘r’, ‘rb’, ‘w’, ‘wb’, ‘a’, ‘ab’.

  • kwargs (dict) – Additional keyword arguments to pass to the file system.

Returns:

A file-like object that can be used to read or write data.

Return type:

file-like

stelar.client.spatial module

class stelar.client.spatial.GeoJSON(*args, **kwargs)[source]

Bases: AnyField

A field for GeoJSON data.

convert_to_entity(value, **kwargs)[source]
convert_to_proxy(value, **kwargs)[source]
default_value()[source]
repr_type()[source]
to_geojson(value)[source]

stelar.client.task_spec module

Basic support for tasks in the client.

class stelar.client.task_spec.TaskSpec(tool: ToolSpec = None, *, image: ImageSpec = None, name: str = None)[source]

Bases: object

A task spec is used to create tasks.

Contrary to other entities, Task creation is more complicated than simply providing values for some scalar attributes. Tasks, once created are not really editable; therefore, all task fields must be specified at task creation time.

This class helps by collecting arguments needed to initialize a new Task.

d(alias: str, dset: Dataset | UUID | str | None = None, **dspec) TaskSpec[source]

Add a dataset alias in the task spec.

An alias stands for either an existing dataset or for the spec of a future dataset.

Dataset aliases can be useful in specifying input and output arguments to a task.

Parameters:
  • alias (str) – the dataset alias name

  • dset (Dataset|UUID|str|None) – specify an existing dataset for this alias

  • dspec (dict) – the spec for a future dictionary.

classmethod from_json(json_spec: dict) TaskSpec[source]

Create a TaskSpec from a JSON specification.

Parameters:

json_spec (dict) – the JSON specification for the task spec.

i(**input_specs)[source]
is_external() bool[source]

Check if this task spec is local (i.e., not using a remote tool).

o(**ospec) TaskSpec[source]
p(**params) TaskSpec[source]
process_inspec(inspec) list[str][source]
process_inspec_entry(inspec: str | UUID | Resource | list[str | UUID | Resource]) Generator[str][source]
process_outspec(outspec: str | dict)[source]
spec() dict[source]

Return the task spec as a dictionary.

Returns:

the task spec as a dictionary.

Return type:

dict

stelar.client.tasks module

Basic support for tasks in the client.

class stelar.client.tasks.Task(registry: Registry, eid: str | UUID | None = None, entity=None)[source]

Bases: GenericProxy

abort(message: str = None)[source]

Abort this task.

This method sets the task’s execution state to ‘failed’ and updates the messages property with the provided message.

creator

The ‘creator’ field

Type:

str|None (read-only)

done

The ‘done’ field

Type:

Any|None (read-only)

end_date

The ‘end_date’ field

Type:

datetime|None (read-only)

exec_state

The ‘exec_state’ field

Type:

str|None (read-only)

exit_job(*, metrics={}, output={}, message='The task is finished', status='succeeded', signature=None)[source]

Post the job output for this external task.

The job output contains the outputs and metrics of the task, the final message and a task status.

Parameters:
  • metrics (dict) – A dictionary of metrics to post.

  • output (dict) – A dictionary of outputs to post.

  • message (str) – A message to post with the job output.

  • status (str) – The status of the task, e.g., “succeeded” or “failed”.

  • signature (str, optional) – The signature of the task. If not provided, the signature will be fetched.

Raises:

ValueError – If the task is not external or if the POST request fails.

fail(message: str, *, metrics={}, output={})[source]

Mark this external task as failed with a message.

This method sets the task’s execution state to ‘failed’ and updates the messages property with the provided message.

id

The ID not null

Type:

UUID (read-only)

image

The ‘image’ field

Type:

str|None (read-only, deletable)

inputs

The ‘inputs’ field not null

Type:

Dict[<class ‘str’>,list[str]] (read-only, deletable)

is_external

The ‘is_external’ field

Type:

Any|None (read-only)

property job_input: dict

Return the job input for this local task.

The job input is a dictionary that contains the inputs and parameters of the task, formatted for use in a job execution context.

jobs()[source]

Return a dictionary with info about Kubernetes jobs for this task.

logs()[source]

Return the logs for this task.

messages

The ‘messages’ field

Type:

str|None (read-only, deletable)

metrics

The ‘metrics’ field not null

Type:

Dict[<class ‘str’>,<class ‘str’>] (read-only, deletable)

outputs

The ‘outputs’ field not null

Type:

Dict[<class ‘str’>,<class ‘dict’>] (read-only, deletable)

parameters

The ‘parameters’ field not null

Type:

Dict[<class ‘str’>,<class ‘str’>] (read-only, deletable)

printlog(*, file=None, flush=False)[source]
process

process_id

Type:

Process (read-only)

Type:

The ‘process’ field not null JSON field

proxy_schema = <stelar.client.proxy.schema.Schema object>
runtime

The ‘runtime’ field

Type:

Any|None (read-only)

property signature: str

Fetch the signature for this task.

The signature is a unique identifier for the task, which allows calling methods job_input() and exit_job() to implement an external task, even from a connection that is not authenticated.

start_date

The ‘start_date’ field

Type:

datetime|None (read-only)

sync_state()[source]
tags

The ‘tags’ field not null

Type:

Dict[<class ‘str’>,<class ‘str’>] (read-only, deletable)

tool

The ‘tool’ field

Type:

str|None (read-only, deletable)

wait(timeout: float = 5.0, polling_interval: float = 1.0)[source]

Wait for the task to finish.

Parameters:
  • timeout (float) – The maximum time to wait in seconds. Defaults to 5.0.

  • polling_interval (float) – The interval between checks in seconds. Defaults to 1.0.

class stelar.client.tasks.TaskCursor(api)[source]

Bases: GenericCursor

A cursor for a collection of STELAR tasks.

create(process_id: UUID | str, task_spec: TaskSpec, secrets=None) Task[source]

Create a new Task using the provided TaskSpec.

Parameters:
  • process_id (UUID) – The ID of the process to which the task belongs.

  • task_spec (TaskSpec) – The specification for the task to create.

  • secrets (dict, optional) – Secrets to pass to the task.

Returns:

The created task.

Return type:

Task

created(*, limit: int = 100, offset: int = 0) list[Task][source]

Fetch a list of tasks in the ‘created’ state.

Parameters:
  • limit (int) – The maximum number of tasks to fetch. Defaults to 100.

  • offset (int) – The offset for pagination. Defaults to 0.

Returns:

A list of Task objects in the ‘created’ state.

Return type:

list[Task]

failed(*, limit: int = 100, offset: int = 0) list[Task][source]

Fetch a list of tasks in the ‘failed’ state.

Parameters:
  • limit (int) – The maximum number of tasks to fetch. Defaults to 100.

  • offset (int) – The offset for pagination. Defaults to 0.

Returns:

A list of Task objects in the ‘failed’ state.

Return type:

list[Task]

fetch(**kwargs)[source]

Fetch entities of this type.

fetch_list(*, state='created', limit: int = 100, offset: int = 0) list[Task][source]

Fetch a list of tasks in a specific state.

Parameters:
  • state (str) – The state of the tasks to fetch. Defaults to ‘running’.

  • **kwargs – Additional keyword arguments to pass to the API call.

Returns:

A list of Task objects in the specified state.

Return type:

list[Task]

running(*, limit: int = 100, offset: int = 0) list[Task][source]

Fetch a list of tasks in the ‘running’ state.

Parameters:
  • limit (int) – The maximum number of tasks to fetch. Defaults to 100.

  • offset (int) – The offset for pagination. Defaults to 0.

Returns:

A list of Task objects in the ‘running’ state.

Return type:

list[Task]

succeeded(*, limit: int = 100, offset: int = 0) list[Task][source]

Fetch a list of tasks in the ‘succeeded’ state.

Parameters:
  • limit (int) – The maximum number of tasks to fetch. Defaults to 100.

  • offset (int) – The offset for pagination. Defaults to 0.

Returns:

A list of Task objects in the ‘succeeded’ state.

Return type:

list[Task]

stelar.client.tool module

class stelar.client.tool.Image(is_manifest_list: bool, last_modified: datetime, manifest_digest: str, tool: Tool, name: str, reversion: bool, size: int, start_ts: datetime)[source]

Bases: object

A container image used by a tool.

Images are just information objects, they are not proxies.

property id

Return a unique identifier for this image.

is_manifest_list: bool
last_modified: datetime
manifest_digest: str
name: str
reversion: bool
size: int
start_ts: datetime
tool: Tool
class stelar.client.tool.ImageRegistryToken(registry: Registry, eid: str | UUID | None = None, entity=None)[source]

Bases: GenericProxy

A token representing an image used by a tool.

DATEFORMAT = '%a, %d %b %Y %H:%M:%S %z'
created

The ‘created’ field

Type:

datetime|None (read-only)

expiration

The ‘expiration’ field

Type:

datetime|None (read-only)

id

uuid

Type:

UUID (read-only)

Type:

The ID not null JSON field

last_accessed

The ‘last_accessed’ field

Type:

datetime|None (read-only)

proxy_schema = <stelar.client.proxy.schema.Schema object>
title

The ‘title’ field not null

Type:

str (read-only)

token

token_code

Type:

str (read-only)

Type:

The ‘token’ field not null JSON field

class stelar.client.tool.ImageRegistryTokenCursor(client)[source]

Bases: GenericCursor[ImageRegistryToken]

A cursor for iterating over image registry tokens.

create(title: str, expiration: datetime | None = None) ImageRegistryToken[source]

Create a new image registry token.

class stelar.client.tool.ProfilesField(**kwargs)[source]

Bases: AnyField

A field for storing tool profiles as a dictionary.

convert_to_proxy(value: Any, **kwargs) frozendict[source]
to_frozendict(value: dict[str, ToolProfile | dict], **kwargs) tuple[frozendict, bool][source]

Convert a dictionary of ToolProfile objects to a frozendict.

class stelar.client.tool.Tool(registry: Registry, eid: str | UUID | None = None, entity=None)[source]

Bases: PackageProxy, LicensedProxy

category

The ‘category’ field

Type:

OneOf[‘discovery’, ‘interlinking’, ‘annotation’, ‘other’]|None

delete_profile(name: str) None[source]

Delete the tool profile with the given name.

get_image(name: str | None = None, default=None) Image | None[source]

Return the image of the given name, or the default image

for this tool, if any.

get_profile(name='default', default=None) ToolProfile | None[source]

Return the tool profile for the given name.

git_repository

The ‘git_repository’ field

Type:

str|None

images

The ‘images’ field

Type:

Any|None (read-only)

inputs

The ‘inputs’ field not null

Type:

Dict[<class ‘str’>,<class ‘str’>]

outputs

The ‘outputs’ field not null

Type:

Dict[<class ‘str’>,<class ‘str’>]

parameters

The ‘parameters’ field not null

Type:

Dict[<class ‘str’>,<class ‘str’>]

profiles

The ‘profiles’ field not null

Type:

Any

programming_language

The ‘programming_language’ field

Type:

str|None

proxy_schema = <stelar.client.proxy.schema.Schema object>
repository

The ‘repository’ field not null

Type:

str (read-only)

set_profile(name: str, profile: ToolProfile | dict | None = None, **pargs) None[source]
task_spec(profile_or_image=None)[source]

Return a new TaskSpec initialized for this tool.

Args
profile_or_image: Either a profile name or an image name.

If a profile name is given, the image from that profile will be used. If an image name is given, it will be used directly.

update_profile(name: str, **pargs) None[source]

Update the tool profile with the given name.

version

The ‘version’ field length <= 100

Type:

str|None

class stelar.client.tool.ToolCategoryField(*args, **kwargs)[source]

Bases: EnumeratedField

VALUES = ['discovery', 'interlinking', 'annotation', 'other']
class stelar.client.tool.ToolCursor(client)[source]

Bases: PackageCursor[Tool]

class stelar.client.tool.ToolProfile(image: str | None = None, description: str | None = None, image_pull_policy: str | None = None, image_pull_secrets: list[str] | None = None, cpu_request: str | None = None, cpu_limit: str | None = None, memory_request: str | None = None, memory_limit: str | None = None, backoff_limit: int | None = None, restart_policy: str | None = None, ttl_seconds_after_finished: int | None = None)[source]

Bases: object

An object specifying options for executing images of a tool.

backoff_limit: int | None = None
cpu_limit: str | None = None
cpu_request: str | None = None
description: str | None = None
image: str | None = None

The image to use for this tool, if specified.

image_pull_policy: str | None = None
image_pull_secrets: list[str] | None = None
memory_limit: str | None = None
memory_request: str | None = None
restart_policy: str | None = None
to_dict() dict[str, Any][source]

Convert the tool profile to a dictionary, omit None values.

ttl_seconds_after_finished: int | None = None
static validate(attr_name: str, value: Any)[source]

Validate a single attribute of the tool profile.

static validate_backoff_limit(backoff_limit: int | None) None[source]
static validate_cpu_limit(cpu_limit: str | None) None[source]
static validate_cpu_request(cpu_request: str | None) None[source]
static validate_image(image) None[source]
static validate_image_pull_policy(policy: str | None) None[source]
static validate_image_pull_secrets(secrets: list[str] | None) None[source]
static validate_memory_limit(memory_limit: str | None) None[source]
static validate_memory_request(memory_request: str | None) None[source]
static validate_restart_policy(restart_policy: str | None) None[source]
static validate_ttl_seconds_after_finished(ttl_seconds: int | None) None[source]

stelar.client.user module

class stelar.client.user.User(registry: Registry, eid: str | UUID | None = None, entity=None)[source]

Bases: GenericProxy

active

The ‘active’ field

Type:

bool|None

add_role(role: str)[source]

Add a role to the user.

Parameters:

role (str) – The role to add.

append_roles(roles: list[str])[source]

Append multiple roles to the user.

Parameters:

roles (list[str]) – The roles to append.

email

The ‘email’ field

Type:

str|None

email_verified

The ‘email_verified’ field

Type:

bool|None

first_name

The ‘first_name’ field

Type:

str|None

fullname

The ‘fullname’ field

Type:

str|None (read-only)

id

The ID not null

Type:

UUID (read-only)

joined_date

The ‘joined_date’ field

Type:

datetime|None (read-only)

last_name

The ‘last_name’ field

Type:

str|None

proxy_schema = <stelar.client.proxy.schema.Schema object>
remove_role(role: str)[source]

Remove a role from the user.

Parameters:

role (str) – The role to remove.

roles

The ‘roles’ field

Type:

Any|None (read-only)

set_roles(roles: list[str])[source]

Set the user’s roles to a new list.

Parameters:

roles (list[str]) – The new list of roles.

username

The ‘username’ field

Type:

str|None (read-only)

class stelar.client.user.UserCursor(client)[source]

Bases: GenericCursor[User]

create(**kwargs) User[source]

Create a new user.

Parameters:

**kwargs – The user attributes to set.

Returns:

The created user.

Return type:

User

property current_user: User

The current user of the client.

Returns:

A dictionary containing the user’s information.

Return type:

dict

fetch(*, limit: int, offset: int) Iterator[User][source]

Fetch entities of this type.

fetch_list(*, limit: int, offset: int) list[str][source]

Lists entities of this type.

roles() list[str][source]

Fetch the list of roles available in the system.

Returns:

A list of role names.

Return type:

list[str]

stelar.client.utils module

stelar.client.utils.client_for(obj: Any) Client[source]

Return the client for a proxy object.

stelar.client.utils.convert_proxy_id_to_str(value: ~stelar.client.proxy.proxy.Proxy | ~uuid.UUID | str, proxy_type: ~typing.Type = <class 'stelar.client.proxy.proxy.Proxy'>, *, nullable: bool = True) str | None[source]

Convert a UUID or Proxy to a string representation.

stelar.client.vocab module

class stelar.client.vocab.Tag(registry: Registry, eid: str | UUID | None = None, entity=None)[source]

Bases: GenericProxy

A proxy for vocaublary tags.

There is not much interesting functionality, since tags are not updatable. However, this proxy class allows for creation and deletion of vocabulary tags.

Note that free tags (those without a vocabulary) in the Data Catalog are managed by the underlying CKAN implementation automatically (as they appear in tag fields for datasets, groups, organizations, etc.)

get_tagged_datasets() ProxyList[Dataset][source]

Retrieve a number of datasets tagged with this tag.

Note that there is an upper limit to the number of datasets (currently, 1000). For a more flexible access, the dataset search facility (Client.datasets.with_tag()) can be used.

However, this call is convenient for ‘rare’ tags.

id

The ID not null

Type:

UUID (read-only)

name

The name field, which is a unique string identifying the entity. not null 2 <= length <= 100

Type:

str (read-only)

proxy_schema = <stelar.client.proxy.schema.Schema object>
tagspec

The ‘tagspec’ field

Type:

Any|None (read-only)

vocabulary

vocabulary_id

Type:

Vocabulary (read-only)

Type:

The ‘vocabulary’ field not null JSON field

class stelar.client.vocab.TagCursor(client: Client)[source]

Bases: GenericCursor[Tag]

Tag cursors are a bit different, since they need to cater to free tags as well as vocabulary tags, and be fast about searching tags.

The cursor fetches only retrieve free tags. However, there are other facilities that allow for the retrieval of all types of tags, as well as search operations using them.

class stelar.client.vocab.Vocabulary(registry: Registry, eid: str | UUID | None = None, entity=None)[source]

Bases: GenericProxy

Vocabulary proxy provides manipulation of tag vocabularies.

add_tags(taglist: list[str])[source]

Add tags to this vocabulary

Parameters:

taglist (list[str]) – the list of tags to add.

id

The ID not null

Type:

UUID (read-only)

name

The name field, which is a unique string identifying the entity. not null 2 <= length <= 100

Type:

str (read-only)

classmethod new(regspec: Registry | RegistryCatalog, *, name: str, tags: list[str] = [], autosync=True) Vocabulary[source]

Create a new vocabulary.

Parameters:
  • name (str) – the name of the vocabulary.

  • tags (list[str]) – the list of tags to add to the vocabulary.

  • autosync (bool) – this is actually ignored.

Returns:

the newly created vocabulary.

Return type:

Vocabulary

proxy_schema = <stelar.client.proxy.schema.Schema object>
proxy_sync(entity=None)[source]

Sync the proxy with the entity in the API.

tag_map

The ‘tag_map’ field

Type:

Any|None (read-only)

property tagnames: list[str]

The list of tag names.

tags

The ‘tags’ field not null

Type:

List[Tag] (read-only)

property tagspecs: TagSpecList

The tagspecs of all tags in this vocabulary

class stelar.client.vocab.VocabularyCursor(client)[source]

Bases: GenericCursor[Vocabulary]

Implement CKAN cursor functionalities for Vocabulary.

N.B. Currently, this class is here as a placeholder and may eventually be removed.

stelar.client.wfapi module

class stelar.client.wfapi.WorkflowsAPI(*args, **kwargs)[source]

Bases: BaseAPI

stelar.client.workflows module

class stelar.client.workflows.Workflow(registry: Registry, eid: str | UUID | None = None, entity=None)[source]

Bases: PackageProxy, LicensedProxy

executor

The ‘executor’ field

Type:

str|None

proxy_schema = <stelar.client.proxy.schema.Schema object>
repository

The ‘repository’ field

Type:

str|None

title

The ‘title’ field

Type:

str|None

version

The ‘version’ field length <= 100

Type:

str|None

Module contents