{"id":34059942,"url":"https://github.com/yushiyangk/gpath","last_synced_at":"2026-04-08T12:02:26.600Z","repository":{"id":157002569,"uuid":"630700874","full_name":"yushiyangk/GPath","owner":"yushiyangk","description":"Generalised abstract file path","archived":false,"fork":false,"pushed_at":"2025-01-27T17:14:55.000Z","size":1171,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-16T01:12:08.768Z","etag":null,"topics":["cross-platform","filepath","filesystem","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yushiyangk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-21T00:48:33.000Z","updated_at":"2025-10-24T19:19:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"023389b9-07af-457f-81d5-b4d84622c30f","html_url":"https://github.com/yushiyangk/GPath","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/yushiyangk/GPath","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yushiyangk%2FGPath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yushiyangk%2FGPath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yushiyangk%2FGPath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yushiyangk%2FGPath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yushiyangk","download_url":"https://codeload.github.com/yushiyangk/GPath/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yushiyangk%2FGPath/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31554110,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T10:21:54.569Z","status":"ssl_error","status_checked_at":"2026-04-08T10:21:38.171Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cross-platform","filepath","filesystem","python"],"created_at":"2025-12-14T04:02:40.328Z","updated_at":"2026-04-08T12:02:26.539Z","avatar_url":"https://github.com/yushiyangk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GPath\n\n**GPath** is a Python package that provides a robust, generalised abstract file path that allows path manipulations independent from the local environment, maximising cross-platform compatibility.\n\n[![](https://img.shields.io/badge/PyPI--inactive?style=social\u0026logo=pypi)](https://pypi.org/project/generic-path/) [![](https://img.shields.io/badge/GitHub--inactive?style=social\u0026logo=github)](https://github.com/yushiyangk/GPath) [![](https://img.shields.io/badge/Documentation--inactive?style=social\u0026logo=readthedocs)](https://gpath.gnayihs.uy/)\n\n## Install\n\n```\npip install generic-path\n```\n\n## Basic examples\n\nImport GPath:\n```python\nfrom gpath import GPath\n```\n\nCreate a GPath object and manipulate it:\n```python\ng = GPath(\"/usr/bin\")\n\ncommon = GPath.find_common(g, \"/usr/local/bin\")  # GPath(\"/usr\")\nrelpath = g.relpath_from(\"/usr/local/bin\")       # GPath(\"../../bin\")\njoined = GPath.join(\"/usr/local/bin\", relpath)   # GPath(\"/usr/bin\")\nassert g == joined\n```\n\nFor function arguments, strings or `os.PathLike` objects can be used interchangeably with GPaths.\n\nBinary operations are also supported:\n```python\ng1 = GPath(\"C:/Windows/System32\")\ng2 = GPath(\"../SysWOW64/drivers\")\n\nadded = g1 + g2      # GPath(\"C:/Windows/SysWOW64/drivers\")\nsubtracted = g1 - 1  # GPath(\"C:/Windows\")\n\n# Shift the imaginary current working directory in relative paths\nshifted_right = g2 \u003e\u003e 1  # GPath(\"../../SysWOW64/drivers\")\nshifted_left = g2 \u003c\u003c 1   # GPath(\"SysWOW64/drivers\")\n```\n\nThe `GPath.partition()` method is useful when dealing with paths from various different sources:\n```python\npartitions = GPath.partition(\"/usr/bin\", \"/usr/local/bin\", \"../../doc\", \"C:/Windows\", \"C:/Program Files\")\n\nassert partitions == {\n\tGPath(\"/usr\")      : [GPath(\"bin\"), GPath(\"local/bin\")],\n\tGPath(\"../../doc\") : [GPath(\"\")],\n\tGPath(\"C:/\")       : [GPath(\"Windows\"), GPath(\"Program Files\")],\n}\n```\n\n## Issues\n\nFound a bug? Please [report an issue](https://github.com/yushiyangk/GPath/issues), or, better yet, [contribute a bugfix](https://github.com/yushiyangk/GPath/pulls).\n\n## Compatibility\n\nThe default `GPath()` interface supports the vast majority of valid file paths on Windows, Linux and macOS (and other POSIX-like operating systems), with some limited caveats.\n\n### Linux, macOS and POSIX\n\nIf using `GPath()`,\n- any backslashes `\\` (after parsing escape sequences) in the path will be treated as path separators\n- if the second character of the path is a colon \u003ccode\u003e\u003cvar\u003ex\u003c/var\u003e:\u003c/code\u003e, the first character \u003cvar\u003e`x`\u003c/var\u003e will be treated as a drive letter\n\nThese issues can be avoided by using `GPath.from_posix()` instead. This will cause all `\\` and `:` to be treated as normal characters in file names.\n\n### Windows\n\n- trailing dots `.` and spaces ` ` will not be stripped\n- reserved MS-DOS device names (such as AUX, CLOCK$, COM0 through COM9, CON, LPT0 through LPT9, NUL, PRN) will be treated as normal file names\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyushiyangk%2Fgpath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyushiyangk%2Fgpath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyushiyangk%2Fgpath/lists"}