LittleTree is a library that provides a tree data structure to python,
which is both fast and flexible.
It can be used to represent file systems, taxonomies and much more.
## Features ##
- Intuitive basic creation and modification of trees.
- Efficient implementation of common tree operations and traversals.
Works on trees that are 10 000 layers deep.
- Extensible. Subclass from `BaseNode` if you need more freedom.
- Can be imported / exported to many different formats (nested dict, rows, relations, graphviz, mermaid, newick, networkx).
- Purely written in Python.
## Limitations ##
- Each node has at most one parent. (It's a tree not a graph!)
- Nodes cannot be their own ancestor.
## Installing ##
- Use [pip](https://pip.pypa.io/en/stable/getting-started/) to install littletree:
```sh
$ pip install --upgrade littletree
```
## Usage ##
A tree can be used in a similar way as a `dict`:
```python
from littletree import Node
tree = Node(identifier="World")
tree["Asia"] = Node()
tree["Africa"] = Node()
tree["America"] = Node()
tree["Europe"] = Node()
# Print tree to console
tree.show()
# Show tree as an image
tree.to_image().show()
```
The resulting tree is printed like this:
```
World
├─ Asia
├─ Africa
├─ America
└─ Europe
```
If [Pillow](https://pypi.org/project/pillow/) and [graphviz](https://graphviz.org/) are installed,
it will also display the following image:
![world](images/world.png)
See [tutorial](https://github.com/lverweijen/littletree/blob/main/tutorial.md) for more information.
See further:
[Pypi](https://pypi.org/project/littletree/) |
[Github](https://github.com/lverweijen/littletree) |
[Issues](https://github.com/lverweijen/littletree/issues)
Raw data
{
"_id": null,
"home_page": null,
"name": "littletree",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "tree, datastructure, hierarchy, taxonomy, newick, graphviz, mermaid",
"author": null,
"author_email": "lverweijen <lauwerund@gmail.com>",
"download_url": null,
"platform": null,
"description": "LittleTree is a library that provides a tree data structure to python,\r\nwhich is both fast and flexible.\r\nIt can be used to represent file systems, taxonomies and much more.\r\n\r\n## Features ##\r\n\r\n- Intuitive basic creation and modification of trees.\r\n- Efficient implementation of common tree operations and traversals.\r\n Works on trees that are 10 000 layers deep.\r\n- Extensible. Subclass from `BaseNode` if you need more freedom.\r\n- Can be imported / exported to many different formats (nested dict, rows, relations, graphviz, mermaid, newick, networkx).\r\n- Purely written in Python.\r\n\r\n## Limitations ##\r\n- Each node has at most one parent. (It's a tree not a graph!)\r\n- Nodes cannot be their own ancestor.\r\n\r\n## Installing ##\r\n\r\n- Use [pip](https://pip.pypa.io/en/stable/getting-started/) to install littletree:\r\n\r\n```sh\r\n$ pip install --upgrade littletree\r\n```\r\n## Usage ##\r\n\r\nA tree can be used in a similar way as a `dict`:\r\n\r\n```python\r\nfrom littletree import Node\r\n\r\ntree = Node(identifier=\"World\")\r\ntree[\"Asia\"] = Node()\r\ntree[\"Africa\"] = Node()\r\ntree[\"America\"] = Node()\r\ntree[\"Europe\"] = Node()\r\n\r\n# Print tree to console\r\ntree.show()\r\n\r\n# Show tree as an image\r\ntree.to_image().show()\r\n```\r\n\r\nThe resulting tree is printed like this:\r\n\r\n```\r\nWorld\r\n\u251c\u2500 Asia\r\n\u251c\u2500 Africa\r\n\u251c\u2500 America\r\n\u2514\u2500 Europe\r\n```\r\n\r\nIf [Pillow](https://pypi.org/project/pillow/) and [graphviz](https://graphviz.org/) are installed,\r\nit will also display the following image:\r\n\r\n![world](images/world.png)\r\n\r\nSee [tutorial](https://github.com/lverweijen/littletree/blob/main/tutorial.md) for more information.\r\n\r\nSee further:\r\n[Pypi](https://pypi.org/project/littletree/) |\r\n[Github](https://github.com/lverweijen/littletree) |\r\n[Issues](https://github.com/lverweijen/littletree/issues)\r\n\r\n",
"bugtrack_url": null,
"license": "Apache License 2.0",
"summary": "Tree library",
"version": "0.8.3",
"project_urls": {
"Changelog": "https://github.com/lverweijen/littletree/blob/main/changes.md",
"Documentation": "https://github.com/lverweijen/littletree/blob/main/tutorial.md",
"Homepage": "https://github.com/lverweijen/littletree",
"Issues": "https://github.com/lverweijen/littletree/issues",
"Repository": "https://github.com/lverweijen/littletree"
},
"split_keywords": [
"tree",
" datastructure",
" hierarchy",
" taxonomy",
" newick",
" graphviz",
" mermaid"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "68471c0601369ecdcb42d2dea0f035b17f5b500fce52dc1fc376de3a5619d222",
"md5": "058375741dc1ffec09b609e27c649c4a",
"sha256": "58d47268b072ff83788b778928ea6cb2e68925f1cccd1a6315913802b37f401a"
},
"downloads": -1,
"filename": "littletree-0.8.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "058375741dc1ffec09b609e27c649c4a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 24101,
"upload_time": "2024-12-10T12:01:03",
"upload_time_iso_8601": "2024-12-10T12:01:03.603703Z",
"url": "https://files.pythonhosted.org/packages/68/47/1c0601369ecdcb42d2dea0f035b17f5b500fce52dc1fc376de3a5619d222/littletree-0.8.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-10 12:01:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "lverweijen",
"github_project": "littletree",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "littletree"
}