The repo:, github:, gitlab:, gitea:, svn+https:, svn+http: and sourceforge: schemes
Needs uripath: pip install "repopath[uri]".
repopath.uri
The repo:, github:, gitlab:, gitea:, svn+https:, svn+http: and
sourceforge: schemes of uripath: RepoURIPath, GitHubURIPath,
GitLabURIPath and GiteaURIPath, URI paths that delegate to a GitHubPath,
a GitLabPath or a GiteaPath;
SVNURIPath and SourceForgeURIPath, which delegate to an SVNPath and a
SourceForgePath.
Importing this module needs uripath: pip install "repopath[uri]". uripath
loads it by itself, through the uripath.schemes entry points, the first time
a path of one of the schemes is used.
GitHubURIPath(*args, **kwargs)
Bases: RepoURIPath
github: scheme (github://[TOKEN@]host/owner/repo/path?ref=REF):
read-only access to a GitHub repository tree via the REST contents API,
done by a GitHubPath. host defaults to github.com (API at
api.github.com); any other host is GitHub Enterprise (API at
https://{host}/api/v3). The kind is fixed whatever the host. See
RepoURIPath for the token and the ref.
Source code in src/repopath/uri.py
83 84 85 86 87 | |
instance
property
The host (and port) of the service, in the case a URL spells it.
kind
property
The name of the kind of repository this path reads ("github",
"gitlab", "gitea").
ref
property
The branch, tag or commit of the ?ref= query, or None.
repo
property
The name of the repository.
repo_owner
property
The owner of the repository: the first segment (the group path of a
GitLab project in a subgroup, ended by /-/).
repo_path
property
The path inside the repository, with no leading or trailing /.
GitLabURIPath(*args, **kwargs)
Bases: RepoURIPath
gitlab: scheme (gitlab://[TOKEN@]host[:port]/owner/repo/path?ref=REF):
read-only access to a GitLab project's repository tree via the REST API
v4, done by a GitLabPath. A project in a subgroup is addressed with
GitLab's own /-/ separator, as in its web URLs:
gitlab://host/group/subgroup/project/-/path/in/repo; without the
separator the first two segments are owner and repository. host defaults
to gitlab.com; a self-hosted instance is just a different host (and
port), always at https://{host}/api/v4. See RepoURIPath for the token
and the ref.
Source code in src/repopath/uri.py
83 84 85 86 87 | |
instance
property
The host (and port) of the service, in the case a URL spells it.
kind
property
The name of the kind of repository this path reads ("github",
"gitlab", "gitea").
ref
property
The branch, tag or commit of the ?ref= query, or None.
repo
property
The name of the repository.
repo_owner
property
The owner of the repository: the first segment (the group path of a
GitLab project in a subgroup, ended by /-/).
repo_path
property
The path inside the repository, with no leading or trailing /.
GiteaURIPath(*args, **kwargs)
Bases: RepoURIPath
gitea: scheme (gitea://[TOKEN@]host[:port]/owner/repo/path?ref=REF):
read-only access to a repository on Gitea or Forgejo (Codeberg runs
Forgejo) via the REST API under /api/v1, done by a GiteaPath. host
defaults to codeberg.org; a self-hosted server is just a different host
(and port), always at https://{host}/api/v1. The kind is fixed whatever
the host. See RepoURIPath for the token and the ref.
Source code in src/repopath/uri.py
83 84 85 86 87 | |
instance
property
The host (and port) of the service, in the case a URL spells it.
kind
property
The name of the kind of repository this path reads ("github",
"gitlab", "gitea").
ref
property
The branch, tag or commit of the ?ref= query, or None.
repo
property
The name of the repository.
repo_owner
property
The owner of the repository: the first segment (the group path of a
GitLab project in a subgroup, ended by /-/).
repo_path
property
The path inside the repository, with no leading or trailing /.
RepoURIPath(*args, **kwargs)
Bases: DelegatingURIPath
repo: scheme (repo://instance/owner/repo/path?ref=REF): read-only
access to a repository on a hosting service, done by the path of its kind
(a GitHubPath, a GitLabPath or a GiteaPath) on the backend of this
path. The kind is detected from the host: github.com, gitlab.com (and
www.) and codeberg.org; any other host is a ValueError that names
github://host/..., gitlab://host/... and gitea://host/..., which pin
the kind on any host. ref (branch, tag or
commit) is optional and carried in the ?ref= query; without one the
service's default branch is read.
Auth: a bearer token given as the user slot of the URI,
repo://TOKEN@host/..., or as its password slot,
repo://x-access-token:TOKEN@host/... (the oauth2:TOKEN of GitLab
too); the backend keyword wins if both are given. Because the user slot
can be the secret, str(), repr(), as_posix() and as_uri(sanitize=True),
and so every message of an exception, drop the WHOLE userinfo for these
schemes; as_uri() still round-trips it. The tree is read-only.
Source code in src/repopath/uri.py
83 84 85 86 87 | |
backend
instance-attribute
instance
property
The host (and port) of the service, in the case a URL spells it.
kind
property
The name of the kind of repository this path reads ("github",
"gitlab", "gitea").
ref
property
The branch, tag or commit of the ?ref= query, or None.
repo
property
The name of the repository.
repo_owner
property
The owner of the repository: the first segment (the group path of a
GitLab project in a subgroup, ended by /-/).
repo_path
property
The path inside the repository, with no leading or trailing /.
as_posix()
Source code in src/repopath/uri.py
117 118 119 120 | |
is_local()
Whether the tree is on this machine: never. The host of the URI is a hosting service and is not resolved.
Source code in src/repopath/uri.py
126 127 128 129 | |
SVNURIPath(*args, **kwargs)
Bases: _SubversionURIPath
svn+https: and svn+http: schemes
(svn+https://[USER:PASSWORD@]host[:port]/path/to/root/names?ref=REV):
read-only access to a Subversion repository served over HTTP by
mod_dav_svn, done by an SVNPath. The URL after svn+ is the URL of
the path, anywhere in the repository: with ?ref= the repository root is
found from the server's OPTIONS reply. A user and password in the URI are
sent as Authorization: Basic, unless backend= is given. The tree is
read-only. (svn: is the scheme of svnserve and is not this one.)
Source code in src/repopath/uri.py
297 298 299 300 301 | |
kind
property
The name of the kind of repository this path reads: "svn".
ref
property
The revision of the ?ref= query, as text, or None for the head.
SourceForgeURIPath(*args, **kwargs)
Bases: _SubversionURIPath
sourceforge: scheme (sourceforge://PROJECT/names?mount=code&ref=REV):
read-only access to the Subversion tool of a SourceForge project, done by a
SourceForgePath. The host slot is the project; ?mount= is the tool's
mount point (code by default), ?ref= a revision and ?instance= the
host of another site. The URI holds no user, password or port: the reads
are anonymous.
Source code in src/repopath/uri.py
297 298 299 300 301 | |
kind
property
The name of the kind of repository this path reads: "sourceforge".
mount
property
The mount point of the tool (code unless ?mount= says another).
project
property
The project, the host slot of the URI.
ref
property
The revision of the ?ref= query, as text, or None for the head.