Git URL Parser - libvcs.url.git¶
Detect, parse, and change git URLs using libvcs’s URL parser for git(1). It builds on top of the
VCS-friendly URL parser framework.
Detect, parse, and validate git URLs.
Detect:
GitURL.is_valid()Parse:
compare to
urllib.parse.ParseResultCompatibility focused:
GitURL: Will work withgit(1)as well aspip(1)style URLsOutput
git(1)URL:GitURL.to_url()
Strict
git(1)compatibility:GitBaseURL.Output
git(1)URL:GitBaseURL.to_url()
Core regular expressions. These are patterns understood by
git(1)See also: https://git-scm.com/docs/git-clone#URLS
AWS CodeCommit-style git URLs.
Examples of CodeCommit-style git URLs (via AWS):
codecommit://MyDemoRepo codecommit://`CodeCommitProfile`@MyDemoRepo codecommit::ap-northeast-1://MyDemoRepo
Notes
pip-style git URLs.
Examples of PIP-style git URLs (via pip.pypa.io):
MyProject @ git+ssh://git.example.com/MyProject MyProject @ git+file:///home/user/projects/MyProject MyProject @ git+https://git.example.com/MyProject
Refs (via pip.pypa.io):
MyProject @ git+https://git.example.com/MyProject.git@master MyProject @ git+https://git.example.com/MyProject.git@v1.0 MyProject @ git+https://git.example.com/MyProject.git@da39a3ee5e6b4b0d3255bfef95601890afd80709 MyProject @ git+https://git.example.com/MyProject.git@refs/pull/123/head
Notes
NPM-style git URLs.
Git URL pattern (from docs.npmjs.com):
<protocol>://[<user>[:<password>]@]<hostname>[:<port>][:][/]<path>[#<commit-ish> | #semver:<semver>]
Examples of NPM-style git URLs (from docs.npmjs.com):
ssh://git@github.com:npm/cli.git#v1.0.27 git+ssh://git@github.com:npm/cli#semver:^5.0 git+https://isaacs@github.com/npm/cli.git git://github.com/npm/cli.git#v1.0.27
Notes
-
class libvcs.url.git.GitBaseURL¶class libvcs.url.git.GitBaseURL¶
Bases:
URLProtocol,SkipDefaultFieldsReprMixinGit repository location. Parses URLs on initialization.
Examples
>>> GitBaseURL(url='https://github.com/vcs-python/libvcs.git') GitBaseURL(url=https://github.com/vcs-python/libvcs.git, scheme=https, hostname=github.com, path=vcs-python/libvcs, suffix=.git, rule=core-git-https)
>>> myrepo = GitBaseURL(url='https://github.com/myproject/myrepo.git')
>>> myrepo.hostname 'github.com'
>>> myrepo.path 'myproject/myrepo'
>>> GitBaseURL(url='[email protected]:vcs-python/libvcs.git') GitBaseURL([email protected]:vcs-python/libvcs.git, user=git, hostname=github.com, path=vcs-python/libvcs, suffix=.git, rule=core-git-scp)
Compatibility checking:
GitBaseURL.is_valid()URLs compatible with
git(1):GitBaseURL.to_url()
-
class libvcs.url.git.GitAWSCodeCommitURL¶class libvcs.url.git.GitAWSCodeCommitURL¶
Bases:
GitBaseURL,URLProtocol,SkipDefaultFieldsReprMixinSupports AWS CodeCommit git URLs.
-
class libvcs.url.git.GitPipURL¶class libvcs.url.git.GitPipURL¶
Bases:
GitBaseURL,URLProtocol,SkipDefaultFieldsReprMixinSupports pip git URLs.
-
class libvcs.url.git.GitURL¶class libvcs.url.git.GitURL¶
Bases:
GitAWSCodeCommitURL,GitPipURL,GitBaseURL,URLProtocol,SkipDefaultFieldsReprMixinBatteries included URL Parser. Supports git(1) and pip URLs.
Ancestors (MRO) This URL parser inherits methods and attributes from the following parsers: