Registry / devops / git-url-parse

git-url-parse

JSON →
library1.2.2pypypi✓ verified 84d ago

git-url-parse is a Python library designed for robustly parsing Git repository URLs, extracting components such as the host, owner, repository name, and protocol. It supports various Git URL formats including HTTP/S, SSH, and Git protocol. The current version is 1.2.2. While the project repository shows active maintenance with commits, official PyPI releases occur infrequently.

pip install git-url-parse
INSTALL
IMPORT
SIG · GIT-URL-PARSE
G
git-url-parse
devopspythonv1.2.2
Install
2.1s avg
Import
Disk
20MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.2.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.8MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.1s · import 0.000s · 19MB
20MB installed
● package 20MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parse
from giturlparse import parse
from git_url_parse import GitUrlParse
parser
from giturlparse import parser
pbr
from giturlparse import pbr

This quickstart demonstrates how to parse a common HTTPS Git URL and access its extracted components using the GitUrlParse class.

from git_url_parse import GitUrlParse # Example 1: HTTPS URL url = "https://github.com/retr0h/git-url-parse.git" parsed_url = GitUrlParse().parse(url) print(f"Host: {parsed_url.host}") print(f"Owner: {parsed_url.owner}") print(f"Repo: {parsed_url.repo}") print(f"Protocol: {parsed_url.protocol}") print(f"Name: {parsed_url.name}") print(f"Token: {parsed_url.token}") # Empty for public URLs
Debug
Known issues
breakingThe v1.0.0 release introduced a significant breaking change, transitioning the API to a class-based approach. Older code that relied on direct function calls from the module root will no longer work.
fix
Migrate your parsing logic to use the `GitUrlParse().parse()` method. Consult the official documentation for the new API.
affects: <1.0.0
gotchaThe PyPI package name uses hyphens (`git-url-parse`), but the Python module name uses underscores (`git_url_parse`). Attempting to import with hyphens will result in a ModuleNotFoundError.
fix
Always use `from git_url_parse import GitUrlParse` for importing.
affects: All versions
gotchaThe main parsing method, `parse()`, must be called on an instance of the `GitUrlParse` class. Directly calling `git_url_parse.parse()` (as a module-level function) will raise an `AttributeError`.
fix
Instantiate the class first: `parsed_url = GitUrlParse().parse(url)`.
affects: All versions >=1.0.0
gotchaWhile the GitHub repository for git-url-parse is actively maintained with recent commits, the official PyPI package (v1.2.2) has not been updated since September 2022. This means recent bug fixes or minor features in the `main` branch may not be available via `pip install`.
fix
For the very latest features or unreleased bug fixes, consider installing directly from the GitHub repository: `pip install git+https://github.com/retr0h/git-url-parse.git`.
affects: 1.2.2 and later (for newer features/fixes)
Upgrade
Version history
1.2.2latest on PyPI · released Mar 23, 2019
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
git-url-parse — pip install git-url-parse · libregistry