Low-level API

This API is built on top of Git and Git-LFS.

HTTP clients for Renku platform.

class renku.api.LocalClient(path=<function default_path>, renku_home='.renku', parent=None, use_external_storage=True, datadir='data', config_dir='/home/docs/.renku', config_name='renku.ini', lock=None)[source]

A low-level client for communicating with a local Renku repository.

Example:
>>> import renku
>>> client = renku.LocalClient('.')

Datasets

Client for handling datasets.

class renku.api.datasets.DatasetsApiMixin(datadir='data')[source]

Client for handling datasets.

DATASETS = 'datasets'

Directory for storing dataset metadata in Renku.

add_data_to_dataset(dataset, urls, git=False, force=False, **kwargs)[source]

Import the data into the data directory.

datadir = None

Define a name of the folder for storing datasets.

dataset_path(name)[source]

Get dataset path from name.

datasets

Return mapping from path to dataset.

datasets_from_commit(commit=None)[source]

Return datasets defined in a commit.

get_dataset(path, commit=None)[source]

Return a dataset from a given path.

get_relative_url(url)[source]

Determine if the repo url should be relative.

load_dataset(name=None)[source]

Load dataset reference file.

renku_datasets_path

Return a Path instance of Renku dataset metadata folder.

with_dataset(name=None)[source]

Yield an editable metadata object for a dataset.

renku.api.datasets.check_for_git_repo(url)[source]

Check if a url points to a git repository.

Repository

Client for handling a local repository.

class renku.api.repository.PathMixin(path=<function default_path>)[source]

Define a default path attribute.

class renku.api.repository.RepositoryApiMixin(renku_home='.renku', parent=None)[source]

Client for handling a local repository.

LOCK_SUFFIX = '.lock'

Default suffix for Renku lock file.

METADATA = 'metadata.yml'

Default name of Renku config file.

WORKFLOW = 'workflow'

Directory for storing workflow in Renku.

cwl_prefix[source]

Return a CWL prefix.

find_previous_commit(paths, revision='HEAD')[source]

Return a previous commit for a given path.

init_repository(name=None, force=False)[source]

Initialize a local Renku repository.

is_cwl(path)[source]

Check if the path is a valid CWL file.

lock

Create a Renku config lock.

parent = None

Store a pointer to the parent repository.

process_commit(commit=None, path=None)[source]

Build an Activity instance.

Parameters:
  • commit – Commit to process. (default: HEAD)
  • path – Process a specific CWL file.
project[source]

Return FOAF/PROV representation of the project.

renku_home = None

Define a name of the Renku folder (default: .renku).

renku_metadata_path

Return a Path instance of Renku metadata file.

renku_path = None

Store a Path instance of the Renku folder.

resolve_in_submodules(commit, path)[source]

Resolve filename in submodules.

subclients(parent_commit)[source]

Return mapping from submodule to client.

submodules[source]

Return list of submodules it belongs to.

with_metadata(read_only=False)[source]

Yield an editable metadata object.

with_workflow_storage()[source]

Yield a workflow storage.

workflow_names[source]

Return index of workflow names.

workflow_path

Return a Path instance of the workflow folder.

renku.api.repository.default_path()[source]

Return default repository path.

Git Internals

Wrap Git client.

class renku.api._git.GitCore[source]

Wrap Git client.

candidate_paths

Return all paths in the index and untracked files.

commit(author_date=None, commit_only=None, allow_empty=True)[source]

Automatic commit.

dirty_paths

Get paths of dirty files in the repository.

ensure_clean(ignore_std_streams=False)[source]

Make sure the repository is clean.

ensure_unstaged(path)[source]

Ensure that path is not part of git staged files.

ensure_untracked(path)[source]

Ensure that path is not part of git untracked files.

find_attr(*paths)[source]

Return map with path and its attributes.

find_ignored_paths(*paths)[source]

Return ignored paths matching .gitignore file.

modified_paths

Return paths of modified files.

remove_unmodified(paths, autocommit=True)[source]

Remove unmodified paths and return their names.

repo = None

Store an instance of the Git repository.

transaction(clean=True, up_to_date=False, commit=True, commit_only=None, ignore_std_streams=False, allow_empty=True)[source]

Perform Git checks and operations.

worktree(path=None, branch_name=None, commit=None, merge_args=('--ff-only', ))[source]

Create new worktree.

Git utilities.

class renku.models._git.GitURL(href, pathname=None, protocol='ssh', hostname='localhost', username=None, password=None, port=None, owner=None, name=None, regex=None)[source]

Parser for common Git URLs.

image

Return image name.

classmethod parse(href)[source]

Derive basic informations.

class renku.models._git.Range(start, stop)[source]

Represent parsed Git revision as an interval.

classmethod rev_parse(git, revision)[source]

Parse revision string.

renku.models._git.filter_repo_name(repo_name)[source]

Remove the .git extension from the repo name.