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)

Base class for a repo provider

config 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

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

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

config 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

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:

pattern : string
defines a regex pattern (not a regex object) that matches specs.
config : dict
a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern
config 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

get_build_slug()

Return a unique build slug

get_repo_url()

Return the git clone-able repo URL

get_resolved_ref_url()

Return the URL of repository at this commit in history

get_resolved_spec()

Return the spec with resolved ref.

config 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

config 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

repo_config(settings)

Return configuration for this repository.

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:

pattern : string
defines a regex pattern (not a regex object) that matches specs.
config : dict
a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern

GitHubRepoProvider

class binderhub.repoproviders.GitHubRepoProvider(*args, **kwargs)

Repo provider for the GitHub service

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

GitHub access token for authentication with the GitHub API

Loaded from GITHUB_ACCESS_TOKEN env by default.

config 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’

config 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

config 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.

config 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.

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

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

config 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

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

The GitHub hostname to use

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

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:

pattern : string
defines a regex pattern (not a regex object) that matches specs.
config : dict
a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern
config c.GitHubRepoProvider.access_token = Unicode('')

GitHub access token for authentication with the GitHub API

Loaded from GITHUB_ACCESS_TOKEN env by default.

config 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’

config 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.

config 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

get_resolved_ref_url()

Return the URL of repository at this commit in history

get_resolved_spec()

Return the spec with resolved ref.

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

The GitHub hostname to use

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

GitLabRepoProvider

class binderhub.repoproviders.GitLabRepoProvider(*args, **kwargs)

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/master

config 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.

config 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

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

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

config 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

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

The host of the GitLab instance

For personal GitLab servers.

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

GitLab private token for authentication with the GitLab API

Loaded from GITLAB_PRIVATE_TOKEN env by default.

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:

pattern : string
defines a regex pattern (not a regex object) that matches specs.
config : dict
a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern
config 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.

get_build_slug()

Return a unique build slug

get_repo_url()

Return the git clone-able repo URL

get_resolved_ref_url()

Return the URL of repository at this commit in history

get_resolved_spec()

Return the spec with resolved ref.

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

The host of the GitLab instance

For personal GitLab servers.

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

GitLab private token for authentication with the GitLab API

Loaded from GITLAB_PRIVATE_TOKEN env by default.

GistRepoProvider

class binderhub.repoproviders.GistRepoProvider(*args, **kwargs)

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
  • master

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

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

GitHub access token for authentication with the GitHub API

Loaded from GITHUB_ACCESS_TOKEN env by default.

config c.GistRepoProvider.allow_secret_gist = Bool(False)

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

config 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’

config 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

config 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.

config 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.

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

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

config 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

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:

pattern : string
defines a regex pattern (not a regex object) that matches specs.
config : dict
a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern
config c.GistRepoProvider.allow_secret_gist = Bool(False)

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

get_build_slug()

Return a unique build slug

get_repo_url()

Return the git clone-able repo URL

get_resolved_ref_url()

Return the URL of repository at this commit in history

get_resolved_spec()

Return the spec with resolved ref.

ZenodoProvider

class binderhub.repoproviders.ZenodoProvider(**kwargs)

Provide contents of a Zenodo record

Users must provide a spec consisting of the Zenodo DOI.

config 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

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

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

config 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

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:

pattern : string
defines a regex pattern (not a regex object) that matches specs.
config : dict
a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern
get_build_slug()

Return a unique build slug

get_repo_url()

Return the git clone-able repo URL

get_resolved_ref_url()

Return the URL of repository at this commit in history

get_resolved_spec()

Return the spec with resolved ref.

FigshareProvider

class binderhub.repoproviders.FigshareProvider(**kwargs)

Provide contents of a Figshare article

Users must provide a spec consisting of the Figshare DOI.

config 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

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

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

config 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

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:

pattern : string
defines a regex pattern (not a regex object) that matches specs.
config : dict
a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern
get_build_slug()

Return a unique build slug

get_repo_url()

Return the git clone-able repo URL

get_resolved_ref_url()

Return the URL of repository at this commit in history

get_resolved_spec()

Return the spec with resolved ref.

DataverseProvider

class binderhub.repoproviders.DataverseProvider(**kwargs)
config 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

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

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

config 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

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:

pattern : string
defines a regex pattern (not a regex object) that matches specs.
config : dict
a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern
get_build_slug()

Return a unique build slug

get_repo_url()

Return the git clone-able repo URL

get_resolved_ref_url()

Return the URL of repository at this commit in history

get_resolved_spec()

Return the spec with resolved ref.

GitRepoProvider

class binderhub.repoproviders.GitRepoProvider(*args, **kwargs)

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%2Fjupyterhub%2Fzero-to-jupyterhub-k8s/master https%3A%2F%2Fgithub.com%2Fjupyterhub%2Fzero-to-jupyterhub-k8s/f7f3ff6d1bf708bdc12e5f10e18b2a90a4795603

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.

config 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

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

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

config 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

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:

pattern : string
defines a regex pattern (not a regex object) that matches specs.
config : dict
a dictionary of “config_name: config_value” pairs that will be applied to any repository that matches pattern
get_build_slug()

Return a unique build slug

get_repo_url()

Return the git clone-able repo URL

get_resolved_ref_url()

Return the URL of repository at this commit in history

get_resolved_spec()

Return the spec with resolved ref.