{"id":1492,"library":"giturlparse","title":"Git URL Parse","description":"giturlparse is a Python module designed for parsing and rewriting Git repository URLs. It extracts components like host, owner, repository name, and platform from various Git URL formats (HTTPS, SSH, Git protocol). The current version is 0.14.0, with a release cadence that is active but not rigidly frequent, focusing on feature additions and bug fixes as needed.","status":"active","version":"0.14.0","language":"en","source_language":"en","source_url":"https://github.com/nephila/giturlparse","tags":["git","url","parser","scm","repository","github","gitlab","bitbucket"],"install":[{"cmd":"pip install giturlparse","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"parse","correct":"from giturlparse import parse"},{"note":"The class returned by the 'parse' function, useful for type hinting.","symbol":"GitUrlParsed","correct":"from giturlparse import GitUrlParsed"}],"quickstart":{"code":"from giturlparse import parse\n\n# Example 1: GitHub SSH URL\nurl_ssh = parse('git@github.com:nephila/giturlparse.git')\nprint(f\"SSH URL: {url_ssh.url}\")\nprint(f\"Owner: {url_ssh.owner}, Name: {url_ssh.name}, Platform: {url_ssh.platform}\")\n\n# Example 2: GitLab HTTPS URL with username:token\nurl_https = parse('https://user:token@gitlab.com/group/repo.git')\nprint(f\"HTTPS URL: {url_https.url}\")\nprint(f\"Owner: {url_https.owner}, Name: {url_https.name}, Resource: {url_https.resource}\")\n\n# Example 3: Rewriting a URL (feature from v0.14.0)\nparsed_url = parse('git@github.com:oldowner/oldrepo.git')\nrewritten_url = parsed_url.rewrite(owner='newowner', name='newrepo')\nprint(f\"Rewritten URL (SSH): {rewritten_url.format('ssh')}\")\nprint(f\"Rewritten URL (HTTPS): {rewritten_url.format('https')}\")","lang":"python","description":"This quickstart demonstrates parsing different Git URL formats and accessing their components. It also shows how to use the rewrite feature introduced in version 0.14.0 to modify repository details and generate new URLs."},"warnings":[{"fix":"Upgrade to Python 3.8+ for versions 0.10.0 and newer, or pin giturlparse to `<0.10.0` if Python 2 is required.","message":"Python 2 support was dropped in version 0.10.0. Installations targeting Python 2 must use versions prior to 0.10.0.","severity":"breaking","affected_versions":"<0.10.0 (for Python 2 users)"},{"fix":"Always use the latest available version of `giturlparse` (currently 0.14.0) to ensure the most robust and accurate parsing of various Git URL formats, including those with specific platform nuances or authentication details.","message":"The parser logic, especially for non-GitHub platforms (like Bitbucket, GitLab) and URLs containing authentication (username:access_token), has evolved and been refined across multiple versions. Older versions may fail to parse or incorrectly parse newer or specific valid Git URL patterns.","severity":"gotcha","affected_versions":"<0.13.0 (for Bitbucket, general parsing), <0.12.0 (for GitLab, user:token)"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}