{"id":8195,"library":"git-url-parse","title":"Git URL Parse","description":"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.","status":"active","version":"1.2.2","language":"en","source_language":"en","source_url":"https://github.com/retr0h/git-url-parse","tags":["git","url","parser","repository","devops"],"install":[{"cmd":"pip install git-url-parse","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"The primary parsing functionality is accessed via an instance of the GitUrlParse class.","wrong":"import git_url_parse","symbol":"GitUrlParse","correct":"from git_url_parse import GitUrlParse"}],"quickstart":{"code":"from git_url_parse import GitUrlParse\n\n# Example 1: HTTPS URL\nurl = \"https://github.com/retr0h/git-url-parse.git\"\nparsed_url = GitUrlParse().parse(url)\n\nprint(f\"Host: {parsed_url.host}\")\nprint(f\"Owner: {parsed_url.owner}\")\nprint(f\"Repo: {parsed_url.repo}\")\nprint(f\"Protocol: {parsed_url.protocol}\")\nprint(f\"Name: {parsed_url.name}\")\nprint(f\"Token: {parsed_url.token}\") # Empty for public URLs\n","lang":"python","description":"This quickstart demonstrates how to parse a common HTTPS Git URL and access its extracted components using the GitUrlParse class."},"warnings":[{"fix":"Migrate your parsing logic to use the `GitUrlParse().parse()` method. Consult the official documentation for the new API.","message":"The 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.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Always use `from git_url_parse import GitUrlParse` for importing.","message":"The 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Instantiate the class first: `parsed_url = GitUrlParse().parse(url)`.","message":"The 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`.","severity":"gotcha","affected_versions":"All versions >=1.0.0"},{"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`.","message":"While 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`.","severity":"gotcha","affected_versions":"1.2.2 and later (for newer features/fixes)"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"The correct import statement is `from git_url_parse import GitUrlParse`.","cause":"The package was installed as `git-url-parse`, but an incorrect module name (e.g., `giturlparse` or `git-url-parse`) was used in the import statement.","error":"ModuleNotFoundError: No module named 'giturlparse'"},{"fix":"First, import the class: `from git_url_parse import GitUrlParse`. Then, create an instance and call the method: `parsed_url = GitUrlParse().parse(url)`.","cause":"The `parse` method is part of the `GitUrlParse` class, not a top-level function in the `git_url_parse` module. You are trying to call it without instantiating the class.","error":"AttributeError: module 'git_url_parse' has no attribute 'parse'"}]}