{"id":26072761,"url":"https://github.com/crosstyan/zig-fetch-py","last_synced_at":"2025-08-27T17:03:20.452Z","repository":{"id":281164309,"uuid":"944414114","full_name":"crosstyan/zig-fetch-py","owner":"crosstyan","description":"zig fetch in python","archived":false,"fork":false,"pushed_at":"2025-03-19T03:45:04.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-19T04:29:00.901Z","etag":null,"topics":["zig"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crosstyan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-03-07T09:57:43.000Z","updated_at":"2025-03-19T03:45:09.000Z","dependencies_parsed_at":"2025-03-07T10:44:40.390Z","dependency_job_id":null,"html_url":"https://github.com/crosstyan/zig-fetch-py","commit_stats":null,"previous_names":["crosstyan/zig-fetch-py"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/crosstyan/zig-fetch-py","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crosstyan%2Fzig-fetch-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crosstyan%2Fzig-fetch-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crosstyan%2Fzig-fetch-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crosstyan%2Fzig-fetch-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crosstyan","download_url":"https://codeload.github.com/crosstyan/zig-fetch-py/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crosstyan%2Fzig-fetch-py/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268883495,"owners_count":24323147,"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","status":"online","status_checked_at":"2025-08-05T02:00:12.334Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["zig"],"created_at":"2025-03-09T00:42:55.211Z","updated_at":"2025-08-05T11:05:14.185Z","avatar_url":"https://github.com/crosstyan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zig-fetch-py\n\nA Python utility for working with Zig package manager files and Zig Object Notation (ZON).\n\n## Features\n\n- Parse ZON files into Python dictionaries\n- Convert ZON files to JSON\n- Download and extract dependencies from ZON files\n- Recursively download nested dependencies\n- Scan directories for `build.zig.zon` files\n\n## Installation\n\n### Using uv (recommended)\n\n[uv](https://github.com/astral-sh/uv) is a fast Python package installer and resolver.\n\n```bash\n# Install uv if you don't have it\ncurl -sSf https://astral.sh/uv/install.sh | bash\n\n# Clone the repository\ngit clone https://github.com/yourusername/zig-fetch-py.git\ncd zig-fetch-py\n\n# Create and activate a virtual environment\nuv venv\nsource .venv/bin/activate  # On Windows: .venv\\Scripts\\activate\n\n# Install the package in development mode\nuv pip install -e .\n\n# Install development dependencies\nuv pip install -e \".[dev]\"\n```\n\n### Using pip\n\n```bash\n# Clone the repository\ngit clone https://github.com/yourusername/zig-fetch-py.git\ncd zig-fetch-py\n\n# Create a virtual environment\npython -m venv .venv\nsource .venv/bin/activate  # On Windows: .venv\\Scripts\\activate\n\n# Install the package in development mode\npip install -e .\n\n# Install development dependencies\npip install -e \".[dev]\"\n```\n\n## Usage\n\n### Command Line Interface\n\nThe package provides a command-line interface with the following commands:\n\n#### Download Dependencies\n\nDownload dependencies from a ZON file or directory:\n\n```bash\n# Download dependencies from a single ZON file\nzig-fetch download examples/test.zon\n\n# Download dependencies from a directory (finds all build.zig.zon files)\nzig-fetch download lib/\n\n# Download dependencies recursively (finds dependencies of dependencies)\nzig-fetch -v download examples/test.zon --recursive\n\n# Combine directory scanning with recursive downloading\nzig-fetch -v download lib/ --recursive\n```\n\nOptions:\n- `--recursive`, `-r`: Recursively process dependencies of dependencies\n- `--verbose`, `-v`: Enable verbose logging (on the parent command)\n\nThis will download all dependencies to `~/.cache/zig/p` and extract them to directories named after their hash values.\n\n#### Convert ZON to JSON\n\nConvert a ZON file to JSON:\n\n```bash\nuv run zig-fetch convert examples/test.zon\n```\n\nOptions:\n- `--indent N`, `-i N`: Set the indentation level for the JSON output (default: 2)\n- `--output PATH`, `-o PATH`: Output file (default: stdout)\n- `--empty-tuple-as-dict`: Parse empty tuples (`.{}`) as empty dictionaries (`{}`) instead of empty lists (`[]`)\n- `--verbose`, `-v`: Enable verbose logging\n\n### Python API\n\nYou can also use the package as a Python library:\n\n```python\nfrom zig_fetch_py.parser import parse_zon_file, zon_to_json\nfrom zig_fetch_py.downloader import process_dependencies\n\n# Parse a ZON file\nzon_data = parse_zon_file(\"examples/test.zon\")\n\n# Convert ZON to JSON\njson_str = zon_to_json(zon_content, indent=2)\n\n# Download dependencies\ndependencies = process_dependencies(\"examples/test.zon\")\n```\n\n## ZON Parser Options\n\nThe ZON parser supports the following options:\n\n- `empty_tuple_as_dict`: If True, empty tuples (`.{}`) will be parsed as empty dictionaries (`{}`) instead of empty lists (`[]`)\n\n## Trivia\n\nCursor (powered by Claude 3.7) help me do almost all of the heavy lifting. I\ncan't even write a proper parser by my own.\n\nThe motivation of it is this issue ([add http/socks5 proxy support for package manager](https://github.com/ziglang/zig/issues/15048)).\nUntil proper proxy support is added to zig, I'll maintain this repo. (The Zon parser might be useful for other projects though)\n\n## License\n\n```\n            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE\n                    Version 2, December 2004\n\n Copyright (C) 2024 \u003ccrosstyan@outlook.com\u003e\n\n Everyone is permitted to copy and distribute verbatim or modified\n copies of this license document, and changing it is allowed as long\n as the name is changed.\n\n            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. You just DO WHAT THE FUCK YOU WANT TO.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrosstyan%2Fzig-fetch-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrosstyan%2Fzig-fetch-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrosstyan%2Fzig-fetch-py/lists"}