{"id":28742016,"url":"https://github.com/jdevera/python-clitree","last_synced_at":"2026-03-11T12:19:42.617Z","repository":{"id":299228827,"uuid":"1002402510","full_name":"jdevera/python-clitree","owner":"jdevera","description":"A Python library to draw tree structures like the CLI utility `tree` does.","archived":false,"fork":false,"pushed_at":"2025-06-15T22:40:19.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-12T13:41:43.424Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jdevera.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-15T11:58:13.000Z","updated_at":"2025-06-15T13:13:59.000Z","dependencies_parsed_at":"2025-06-15T13:39:25.822Z","dependency_job_id":"fffb959a-71a1-4ce0-8252-e6cebf899a9e","html_url":"https://github.com/jdevera/python-clitree","commit_stats":null,"previous_names":["jdevera/python-clitree"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jdevera/python-clitree","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdevera%2Fpython-clitree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdevera%2Fpython-clitree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdevera%2Fpython-clitree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdevera%2Fpython-clitree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jdevera","download_url":"https://codeload.github.com/jdevera/python-clitree/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdevera%2Fpython-clitree/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30380936,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T06:09:32.197Z","status":"ssl_error","status_checked_at":"2026-03-11T06:09:17.086Z","response_time":84,"last_error":"SSL_read: 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":[],"created_at":"2025-06-16T08:13:50.069Z","updated_at":"2026-03-11T12:19:42.593Z","avatar_url":"https://github.com/jdevera.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CliTree\n\n[![PyPI version](https://badge.fury.io/py/clitree.svg)](https://badge.fury.io/py/clitree)\n[![Python Version](https://img.shields.io/badge/python-3.10-blue.svg)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![CI/CD](https://github.com/jdevera/python-clitree/actions/workflows/ci.yml/badge.svg)](https://github.com/jdevera/python-clitree/actions/workflows/ci.yml)\n[![Ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)\n\n`clitree` is a library to draw tree structures like the CLI utility `tree` does.\n\nInstall it with:\n\n```bash\npip install clitree\n```\n\nExample usage:\n\n```python\n\u003e\u003e\u003e from clitree import tree\n\u003e\u003e\u003e \n\u003e\u003e\u003e data = {\n...     \"name\": \"root\",\n...     \"children\": [\n...         {\"name\": \"docs\", \"children\": [\n...             {\"name\": \"api.md\", \"children\": []},\n...             {\"name\": \"guide.md\", \"children\": []}\n...         ]},\n...         {\"name\": \"src\", \"children\": [\n...             {\"name\": \"main.py\", \"children\": []},\n...             {\"name\": \"utils\", \"children\": [\n...                 {\"name\": \"helpers.py\", \"children\": []},\n...                 {\"name\": \"config.py\", \"children\": []}\n...             ]}\n...         ]},\n...         {\"name\": \"tests\", \"children\": []}\n...     ]\n... }\n\u003e\u003e\u003e \n\u003e\u003e\u003e print(tree(data))\nroot\n├── docs\n│   ├── api.md\n│   └── guide.md\n├── src\n│   ├── main.py\n│   └── utils\n│       ├── helpers.py\n│       └── config.py\n└── tests\n\n```\n\n### Parameters\n\n- `name`: How to extract the name of a node. Can be:\n  - A string key (uses `node.get(name)` or `getattr(node, name)`)\n  - A callable that returns a string\n- `children`: How to obtain the children of a node. Can be:\n  - A string key (uses `node.get(children)` or `getattr(node, children)`)\n  - A callable that returns an iterable of nodes (including generators)\n  - Returns `None` or empty iterable for leaf nodes\n\n### Node Structure\n\nWhen using string keys for `name` and `children`, nodes are typically:\n- Dictionaries with a `get` method, or\n- Objects with attributes accessible via `getattr`\n\nHowever, since `name` and `children` can be callables, nodes can be of any type, as the callables are responsible for extracting the required information.\n\nRequirements:\n- The name must resolve to a string value\n- Children must be iterable or None\n\n### Error Handling\n\n- `ValueError`: Raised when a node's name resolves to None\n- `TypeError`: Raised when children are not iterable","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdevera%2Fpython-clitree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjdevera%2Fpython-clitree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdevera%2Fpython-clitree/lists"}