{"id":23132579,"url":"https://github.com/bigroy/pather","last_synced_at":"2025-08-17T08:32:35.771Z","repository":{"id":74874250,"uuid":"41511982","full_name":"BigRoy/pather","owner":"BigRoy","description":"Manage file system structure using patterns. Parse, format and list your paths.","archived":false,"fork":false,"pushed_at":"2018-12-19T09:36:17.000Z","size":18,"stargazers_count":43,"open_issues_count":4,"forks_count":7,"subscribers_count":9,"default_branch":"master","last_synced_at":"2023-10-20T18:14:24.011Z","etag":null,"topics":["filepaths","parse","query","templates"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BigRoy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-08-27T21:20:51.000Z","updated_at":"2023-10-20T18:14:24.340Z","dependencies_parsed_at":"2023-07-19T03:30:49.124Z","dependency_job_id":null,"html_url":"https://github.com/BigRoy/pather","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BigRoy%2Fpather","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BigRoy%2Fpather/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BigRoy%2Fpather/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BigRoy%2Fpather/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BigRoy","download_url":"https://codeload.github.com/BigRoy/pather/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230106153,"owners_count":18174009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["filepaths","parse","query","templates"],"created_at":"2024-12-17T11:19:10.562Z","updated_at":"2024-12-17T11:19:11.167Z","avatar_url":"https://github.com/BigRoy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pather\n\nManage file system structure using patterns. \nParse, format and list your paths.\n\n### Search you file structure\n\nNeed to look up a specific dataset in your file structure? Easy and fast.\n\n```python\nimport pather\npather.ls('project/assets/{item}/{task}/published/{family}')\n# ['project/assets/john/modeling/published/model',\n#  'project/assets/john/modeling/published/review',\n#  'project/assets/mike/rigging/published/rig',\n#  'project/assets/mike/modeling/published/model']\n```\n\nHave your pattern defined and want to perform a subquery. Let's do it!\n\n```python\nimport pather\npather.ls('project/assets/{item}/{task}/published/{family}', include={'item': 'mike'})\n# ['project/assets/mike/rigging/published/rig',\n#  'project/assets/mike/modeling/published/model']\n```\n\n### Format your paths\n\nHave some information about your file, but don't know where it should go?\n\nWell, it's good you planned ahead when you started the project with a pipeline.\n\nLet's pick up the pattern you laid out for the team.\n\n```python\nimport pather\npattern = '{project}/art/{episode}/{character}/{application}\ndata = {'project': \"foobar\",\n        'episode': \"s01e01\",\n        'character': \"john_doe\",\n        'application': \"photoshop\"}\n\npather.format(pattern, data)\n# \"foobar/art/s01e01/john_doe/photoshop\"\n```\n\n### Parse the data from a path\n\nSo you've found yourself in a location in the project and want to grab the information about where you are. \n\nParse it.\n\n```python\nimport pather\npath = 'stuntman_production/art/s08e15/crazy_horse/maya'\npattern = '{project}/art/{episode}/{character}/{application}\n\ndata = pather.parse(pattern, parse)\n# {'project': \"stuntman_production\",\n#  'episode': \"s08e15\",\n#  'character': \"crazy_horse\",\n#  'application': \"maya\"}\n```\n\n### Get your freak on\n\nWant to spice it up? \n\nSo you want to find all other versions of the model that you're currently using.\n\n```python\ncurrent_file = 'thedeal/assets/ben/modeling/published/model/ben_default/v01/'\npattern = '{project}/assets/{item}/{task}/published/{family}/{instance}/{version}/'\n\ndata = pather.parse(pattern, current_file)\ndata.pop('version')\n\nall_versions = pather.ls(pattern, include=data)\n# ['thedeal/assets/ben/modeling/published/model/ben_default/v01/',\n#  'thedeal/assets/ben/modeling/published/model/ben_default/v02/',\n#  'thedeal/assets/ben/modeling/published/model/ben_default/v03/']\n```\n\nOr find all published content among all tasks with the same version number?\n```python\ncurrent_file = 'thedeal/assets/ben/modeling/published/model/ben_default/v01/'\npattern = '{project}/assets/{item}/{task}/published/{family}/{instance}/{version}/'\n\ndata = pather.parse(pattern, current_file)\n# Remove the keys that we don't want to filter on.\ndata.pop('task')\ndata.pop('family')\n\nfiles = pather.ls(pattern, include=data)\n# ['thedeal/assets/ben/modeling/published/model/ben_default/v01/',\n#  'thedeal/assets/ben/rigging/published/rig/ben_default/v01/',\n#  'thedeal/assets/ben/lookdev/published/shaders/ben_default/v01/']\n```\n\n---\n\nManaging files is ~~that~~ *dead easy*.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigroy%2Fpather","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbigroy%2Fpather","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigroy%2Fpather/lists"}