repoproviders#

Module: binderhub.repoproviders#

Classes for Repo providers.

Subclass the base class, RepoProvider, to support different version control services and providers.

Note

When adding a new repo provider, add it to the allowed values for repo providers in event-schemas/launch.json.

RepoProvider#

class binderhub.repoproviders.RepoProvider(**kwargs: Any)#

Base class for a repo provider

allowed_specs c.RepoProvider.allowed_specs = List()#

List of specs to allow building.

Should be a list of regexes (not regex objects) that match specs which should be allowed.

A spec is allowed if: 1. it matches allowed_specs and does not match banned_specs or 2. allowed_specs is unspecified and the spec does not match banned_specs.

banned_specs c.RepoProvider.banned_specs = List()#

List of specs to blacklist building.

Should be a list of regexes (not regex objects) that match specs which should be blacklisted

A spec is allowed if: 1. it matches allowed_specs and does not match banned_specs or 2. allowed_specs is unspecified and the spec does not match banned_specs.

get_build_slug()#

Return a unique build slug

get_repo_url()#

Return the git clone-able repo URL

async get_resolved_ref_url()#

Return the URL of repository at this commit in history

async get_resolved_spec()#

Return the spec with resolved ref.

git_credentials c.RepoProvider.git_credentials = Unicode('')#

Credentials (if any) to pass to git when cloning.

has_higher_quota()#

Return true if the given spec has a higher quota

high_quota_specs c.RepoProvider.high_quota_specs = List()#

List of specs to assign a higher quota limit.

Should be a list of regexes (not regex objects) that match specs which should have a higher quota

is_banned()#

Return true if the given spec has been banned or explicitly not allowed.

name Unicode('')#

Descriptive human readable name of this repo provider.

repo_config(settings)#

Return configuration for this repository.

spec Unicode('')#

The spec for this builder to parse

spec_config c.RepoProvider.spec_config = List()#

List of dictionaries that define per-repository configuration.

Each item in the list is a dictionary with two keys:

patternstring

defines a regex pattern (not a regex object) that matches specs.

configdict

a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern

GitHubRepoProvider#

class binderhub.repoproviders.GitHubRepoProvider(**kwargs: Any)#

Repo provider for the GitHub service

access_token c.GitHubRepoProvider.access_token = Unicode('')#

GitHub access token for authentication with the GitHub API

Loaded from GITHUB_ACCESS_TOKEN env by default.

allowed_specs c.GitHubRepoProvider.allowed_specs = List()#

List of specs to allow building.

Should be a list of regexes (not regex objects) that match specs which should be allowed.

A spec is allowed if: 1. it matches allowed_specs and does not match banned_specs or 2. allowed_specs is unspecified and the spec does not match banned_specs.

api_base_path c.GitHubRepoProvider.api_base_path = Unicode('https://api.{hostname}')#

The base path of the GitHub API

Only necessary if not github.com, e.g. GitHub Enterprise.

Can use {hostname} for substitution, e.g. ‘https://{hostname}/api/v3’

banned_specs c.GitHubRepoProvider.banned_specs = List()#

List of specs to blacklist building.

Should be a list of regexes (not regex objects) that match specs which should be blacklisted

A spec is allowed if: 1. it matches allowed_specs and does not match banned_specs or 2. allowed_specs is unspecified and the spec does not match banned_specs.

client_id c.GitHubRepoProvider.client_id = Unicode('')#

GitHub client id for authentication with the GitHub API

For use with client_secret. Loaded from GITHUB_CLIENT_ID env by default.

client_secret c.GitHubRepoProvider.client_secret = Unicode('')#

GitHub client secret for authentication with the GitHub API

For use with client_id. Loaded from GITHUB_CLIENT_SECRET env by default.

get_build_slug()#

Return a unique build slug

get_repo_url()#

Return the git clone-able repo URL

async get_resolved_ref_url()#

Return the URL of repository at this commit in history

async get_resolved_spec()#

Return the spec with resolved ref.

git_credentials c.GitHubRepoProvider.git_credentials = Unicode('')#

Credentials (if any) to pass to git when cloning.

high_quota_specs c.GitHubRepoProvider.high_quota_specs = List()#

List of specs to assign a higher quota limit.

Should be a list of regexes (not regex objects) that match specs which should have a higher quota

hostname c.GitHubRepoProvider.hostname = Unicode('github.com')#

The GitHub hostname to use

Only necessary if not github.com, e.g. GitHub Enterprise.

spec_config c.GitHubRepoProvider.spec_config = List()#

List of dictionaries that define per-repository configuration.

Each item in the list is a dictionary with two keys:

patternstring

defines a regex pattern (not a regex object) that matches specs.

configdict

a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern

GitLabRepoProvider#

class binderhub.repoproviders.GitLabRepoProvider(**kwargs: Any)#

GitLab provider.

GitLab allows nested namespaces (eg. root/project/component/repo) thus we need to urlescape the namespace of this repo. Users must provide a spec that matches the following form.

<url-escaped-namespace>/<unresolved_ref>

eg: group%2Fproject%2Frepo/main

access_token c.GitLabRepoProvider.access_token = Unicode('')#

GitLab OAuth2 access token for authentication with the GitLab API

For use with client_secret. Loaded from GITLAB_ACCESS_TOKEN env by default.

allowed_specs c.GitLabRepoProvider.allowed_specs = List()#

List of specs to allow building.

Should be a list of regexes (not regex objects) that match specs which should be allowed.

A spec is allowed if: 1. it matches allowed_specs and does not match banned_specs or 2. allowed_specs is unspecified and the spec does not match banned_specs.

auth Dict()#

Auth parameters for the GitLab API access

Populated from access_token, private_token

banned_specs c.GitLabRepoProvider.banned_specs = List()#

List of specs to blacklist building.

Should be a list of regexes (not regex objects) that match specs which should be blacklisted

A spec is allowed if: 1. it matches allowed_specs and does not match banned_specs or 2. allowed_specs is unspecified and the spec does not match banned_specs.

get_build_slug()#

Return a unique build slug

get_repo_url()#

Return the git clone-able repo URL

async get_resolved_ref_url()#

Return the URL of repository at this commit in history

async get_resolved_spec()#

Return the spec with resolved ref.

git_credentials c.GitLabRepoProvider.git_credentials = Unicode('')#

Credentials (if any) to pass to git when cloning.

high_quota_specs c.GitLabRepoProvider.high_quota_specs = List()#

List of specs to assign a higher quota limit.

Should be a list of regexes (not regex objects) that match specs which should have a higher quota

hostname c.GitLabRepoProvider.hostname = Unicode('gitlab.com')#

The host of the GitLab instance

For personal GitLab servers.

private_token c.GitLabRepoProvider.private_token = Unicode('')#

GitLab private token for authentication with the GitLab API

Loaded from GITLAB_PRIVATE_TOKEN env by default.

spec_config c.GitLabRepoProvider.spec_config = List()#

List of dictionaries that define per-repository configuration.

Each item in the list is a dictionary with two keys:

patternstring

defines a regex pattern (not a regex object) that matches specs.

configdict

a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern

GistRepoProvider#

class binderhub.repoproviders.GistRepoProvider(**kwargs: Any)#

GitHub gist provider.

Users must provide a spec that matches the following form (similar to github)

[https://gist.github.com/]<username>/<gist-id>[/<ref>]

The ref is optional, valid values are
  • a full sha1 of a ref in the history

  • HEAD for the latest ref (also allow ‘master’, ‘main’ as aliases for HEAD)

If HEAD or no ref is specified the latest revision will be used.

access_token c.GistRepoProvider.access_token = Unicode('')#

GitHub access token for authentication with the GitHub API

Loaded from GITHUB_ACCESS_TOKEN env by default.

allow_secret_gist c.GistRepoProvider.allow_secret_gist = Bool(False)#

Flag for allowing usages of secret Gists. The default behavior is to disallow secret gists.

allowed_specs c.GistRepoProvider.allowed_specs = List()#

List of specs to allow building.

Should be a list of regexes (not regex objects) that match specs which should be allowed.

A spec is allowed if: 1. it matches allowed_specs and does not match banned_specs or 2. allowed_specs is unspecified and the spec does not match banned_specs.

api_base_path c.GistRepoProvider.api_base_path = Unicode('https://api.{hostname}')#

The base path of the GitHub API

Only necessary if not github.com, e.g. GitHub Enterprise.

Can use {hostname} for substitution, e.g. ‘https://{hostname}/api/v3’

banned_specs c.GistRepoProvider.banned_specs = List()#

List of specs to blacklist building.

Should be a list of regexes (not regex objects) that match specs which should be blacklisted

A spec is allowed if: 1. it matches allowed_specs and does not match banned_specs or 2. allowed_specs is unspecified and the spec does not match banned_specs.

client_id c.GistRepoProvider.client_id = Unicode('')#

GitHub client id for authentication with the GitHub API

For use with client_secret. Loaded from GITHUB_CLIENT_ID env by default.

client_secret c.GistRepoProvider.client_secret = Unicode('')#

GitHub client secret for authentication with the GitHub API

For use with client_id. Loaded from GITHUB_CLIENT_SECRET env by default.

get_build_slug()#

Return a unique build slug

get_repo_url()#

Return the git clone-able repo URL

async get_resolved_ref_url()#

Return the URL of repository at this commit in history

async get_resolved_spec()#

Return the spec with resolved ref.

git_credentials c.GistRepoProvider.git_credentials = Unicode('')#

Credentials (if any) to pass to git when cloning.

high_quota_specs c.GistRepoProvider.high_quota_specs = List()#

List of specs to assign a higher quota limit.

Should be a list of regexes (not regex objects) that match specs which should have a higher quota

spec_config c.GistRepoProvider.spec_config = List()#

List of dictionaries that define per-repository configuration.

Each item in the list is a dictionary with two keys:

patternstring

defines a regex pattern (not a regex object) that matches specs.

configdict

a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern

ZenodoProvider#

class binderhub.repoproviders.ZenodoProvider(**kwargs: Any)#

Provide contents of a Zenodo record

Users must provide a spec consisting of the Zenodo DOI.

allowed_specs c.ZenodoProvider.allowed_specs = List()#

List of specs to allow building.

Should be a list of regexes (not regex objects) that match specs which should be allowed.

A spec is allowed if: 1. it matches allowed_specs and does not match banned_specs or 2. allowed_specs is unspecified and the spec does not match banned_specs.

banned_specs c.ZenodoProvider.banned_specs = List()#

List of specs to blacklist building.

Should be a list of regexes (not regex objects) that match specs which should be blacklisted

A spec is allowed if: 1. it matches allowed_specs and does not match banned_specs or 2. allowed_specs is unspecified and the spec does not match banned_specs.

get_build_slug()#

Return a unique build slug

get_repo_url()#

Return the git clone-able repo URL

async get_resolved_ref_url()#

Return the URL of repository at this commit in history

async get_resolved_spec()#

Return the spec with resolved ref.

git_credentials c.ZenodoProvider.git_credentials = Unicode('')#

Credentials (if any) to pass to git when cloning.

high_quota_specs c.ZenodoProvider.high_quota_specs = List()#

List of specs to assign a higher quota limit.

Should be a list of regexes (not regex objects) that match specs which should have a higher quota

spec_config c.ZenodoProvider.spec_config = List()#

List of dictionaries that define per-repository configuration.

Each item in the list is a dictionary with two keys:

patternstring

defines a regex pattern (not a regex object) that matches specs.

configdict

a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern

FigshareProvider#

class binderhub.repoproviders.FigshareProvider(**kwargs: Any)#

Provide contents of a Figshare article

Users must provide a spec consisting of the Figshare DOI.

allowed_specs c.FigshareProvider.allowed_specs = List()#

List of specs to allow building.

Should be a list of regexes (not regex objects) that match specs which should be allowed.

A spec is allowed if: 1. it matches allowed_specs and does not match banned_specs or 2. allowed_specs is unspecified and the spec does not match banned_specs.

banned_specs c.FigshareProvider.banned_specs = List()#

List of specs to blacklist building.

Should be a list of regexes (not regex objects) that match specs which should be blacklisted

A spec is allowed if: 1. it matches allowed_specs and does not match banned_specs or 2. allowed_specs is unspecified and the spec does not match banned_specs.

get_build_slug()#

Return a unique build slug

get_repo_url()#

Return the git clone-able repo URL

async get_resolved_ref_url()#

Return the URL of repository at this commit in history

async get_resolved_spec()#

Return the spec with resolved ref.

git_credentials c.FigshareProvider.git_credentials = Unicode('')#

Credentials (if any) to pass to git when cloning.

high_quota_specs c.FigshareProvider.high_quota_specs = List()#

List of specs to assign a higher quota limit.

Should be a list of regexes (not regex objects) that match specs which should have a higher quota

spec_config c.FigshareProvider.spec_config = List()#

List of dictionaries that define per-repository configuration.

Each item in the list is a dictionary with two keys:

patternstring

defines a regex pattern (not a regex object) that matches specs.

configdict

a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern

HydroshareProvider#

class binderhub.repoproviders.HydroshareProvider(**kwargs: Any)#

Provide contents of a Hydroshare resource Users must provide a spec consisting of the Hydroshare resource id.

allowed_specs c.HydroshareProvider.allowed_specs = List()#

List of specs to allow building.

Should be a list of regexes (not regex objects) that match specs which should be allowed.

A spec is allowed if: 1. it matches allowed_specs and does not match banned_specs or 2. allowed_specs is unspecified and the spec does not match banned_specs.

banned_specs c.HydroshareProvider.banned_specs = List()#

List of specs to blacklist building.

Should be a list of regexes (not regex objects) that match specs which should be blacklisted

A spec is allowed if: 1. it matches allowed_specs and does not match banned_specs or 2. allowed_specs is unspecified and the spec does not match banned_specs.

get_build_slug()#

Return a unique build slug

get_repo_url()#

Return the git clone-able repo URL

async get_resolved_ref_url()#

Return the URL of repository at this commit in history

async get_resolved_spec()#

Return the spec with resolved ref.

git_credentials c.HydroshareProvider.git_credentials = Unicode('')#

Credentials (if any) to pass to git when cloning.

high_quota_specs c.HydroshareProvider.high_quota_specs = List()#

List of specs to assign a higher quota limit.

Should be a list of regexes (not regex objects) that match specs which should have a higher quota

spec_config c.HydroshareProvider.spec_config = List()#

List of dictionaries that define per-repository configuration.

Each item in the list is a dictionary with two keys:

patternstring

defines a regex pattern (not a regex object) that matches specs.

configdict

a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern

DataverseProvider#

class binderhub.repoproviders.DataverseProvider(**kwargs: Any)#
allowed_specs c.DataverseProvider.allowed_specs = List()#

List of specs to allow building.

Should be a list of regexes (not regex objects) that match specs which should be allowed.

A spec is allowed if: 1. it matches allowed_specs and does not match banned_specs or 2. allowed_specs is unspecified and the spec does not match banned_specs.

banned_specs c.DataverseProvider.banned_specs = List()#

List of specs to blacklist building.

Should be a list of regexes (not regex objects) that match specs which should be blacklisted

A spec is allowed if: 1. it matches allowed_specs and does not match banned_specs or 2. allowed_specs is unspecified and the spec does not match banned_specs.

get_build_slug()#

Return a unique build slug

get_repo_url()#

Return the git clone-able repo URL

async get_resolved_ref_url()#

Return the URL of repository at this commit in history

async get_resolved_spec()#

Return the spec with resolved ref.

git_credentials c.DataverseProvider.git_credentials = Unicode('')#

Credentials (if any) to pass to git when cloning.

high_quota_specs c.DataverseProvider.high_quota_specs = List()#

List of specs to assign a higher quota limit.

Should be a list of regexes (not regex objects) that match specs which should have a higher quota

spec_config c.DataverseProvider.spec_config = List()#

List of dictionaries that define per-repository configuration.

Each item in the list is a dictionary with two keys:

patternstring

defines a regex pattern (not a regex object) that matches specs.

configdict

a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern

CKANProvider#

class binderhub.repoproviders.CKANProvider(**kwargs: Any)#

Provide contents of a CKAN dataset Users must provide a spec consisting of the CKAN dataset URL.

allowed_specs c.CKANProvider.allowed_specs = List()#

List of specs to allow building.

Should be a list of regexes (not regex objects) that match specs which should be allowed.

A spec is allowed if: 1. it matches allowed_specs and does not match banned_specs or 2. allowed_specs is unspecified and the spec does not match banned_specs.

banned_specs c.CKANProvider.banned_specs = List()#

List of specs to blacklist building.

Should be a list of regexes (not regex objects) that match specs which should be blacklisted

A spec is allowed if: 1. it matches allowed_specs and does not match banned_specs or 2. allowed_specs is unspecified and the spec does not match banned_specs.

get_build_slug()#

Return a unique build slug

get_repo_url()#

Return the git clone-able repo URL

async get_resolved_ref_url()#

Return the URL of repository at this commit in history

async get_resolved_spec()#

Return the spec with resolved ref.

git_credentials c.CKANProvider.git_credentials = Unicode('')#

Credentials (if any) to pass to git when cloning.

high_quota_specs c.CKANProvider.high_quota_specs = List()#

List of specs to assign a higher quota limit.

Should be a list of regexes (not regex objects) that match specs which should have a higher quota

spec_config c.CKANProvider.spec_config = List()#

List of dictionaries that define per-repository configuration.

Each item in the list is a dictionary with two keys:

patternstring

defines a regex pattern (not a regex object) that matches specs.

configdict

a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern

GitRepoProvider#

class binderhub.repoproviders.GitRepoProvider(**kwargs: Any)#

Bare bones git repo provider.

Users must provide a spec of the following form.

<url-escaped-namespace>/<unresolved_ref> <url-escaped-namespace>/<resolved_ref>

eg: https%3A%2F%2Fgithub.com%2Fbinder-examples%2Fconda/main https%3A%2F%2Fgithub.com%2Fbinder-examples%2Fconda/034931911e853252322f2309f1246a4f1076fd7d

This provider is typically used if you are deploying binderhub yourself and you require access to repositories that are not in one of the supported providers.

allowed_protocols c.GitRepoProvider.allowed_protocols = Set()#

Specify allowed git protocols. Default: http[s], git, ssh.

allowed_specs c.GitRepoProvider.allowed_specs = List()#

List of specs to allow building.

Should be a list of regexes (not regex objects) that match specs which should be allowed.

A spec is allowed if: 1. it matches allowed_specs and does not match banned_specs or 2. allowed_specs is unspecified and the spec does not match banned_specs.

banned_specs c.GitRepoProvider.banned_specs = List()#

List of specs to blacklist building.

Should be a list of regexes (not regex objects) that match specs which should be blacklisted

A spec is allowed if: 1. it matches allowed_specs and does not match banned_specs or 2. allowed_specs is unspecified and the spec does not match banned_specs.

get_build_slug()#

Return a unique build slug

get_repo_url()#

Return the git clone-able repo URL

async get_resolved_ref_url()#

Return the URL of repository at this commit in history

async get_resolved_spec()#

Return the spec with resolved ref.

git_credentials c.GitRepoProvider.git_credentials = Unicode('')#

Credentials (if any) to pass to git when cloning.

high_quota_specs c.GitRepoProvider.high_quota_specs = List()#

List of specs to assign a higher quota limit.

Should be a list of regexes (not regex objects) that match specs which should have a higher quota

spec_config c.GitRepoProvider.spec_config = List()#

List of dictionaries that define per-repository configuration.

Each item in the list is a dictionary with two keys:

patternstring

defines a regex pattern (not a regex object) that matches specs.

configdict

a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern