Name | django-fast-treenode JSON |
Version |
3.2.4
JSON |
| download |
home_page | https://django-fast-treenode.readthedocs.io/ |
Summary | Treenode Framework for supporting tree (hierarchical) data structure in Django projects |
upload_time | 2025-07-10 13:29:04 |
maintainer | None |
docs_url | None |
author | Timur Kady |
requires_python | >=3.9 |
license | MIT License
Copyright (c) 2020-2025 Timur Kady
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
|
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
Django
msgpack
openpyxl
pyyaml
PyJWT
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Treenode Framework
**A hybrid open-source framework for working with trees in Django**
[](https://github.com/TimurKady/django-fast-treenode/actions/workflows/test.yaml)
[](https://django-fast-treenode.readthedocs.io/)
[](https://pypi.org/project/django-fast-Treenode/)
[](https://djangopackages.org/packages/p/django-fast-treenode/)
[](https://github.com/sponsors/TimurKady)
## About The Treenode Framework
### Overview
**Treenode Framework** is an advanced tree management system for Django applications.It is designed to handle large-scale, deeply nested, and highly dynamic tree structures while maintaining excellent performance, data integrity, and ease of use.
Unlike traditional solutions, **Treenode Framework** is built for serious real-world applications where trees may consist of:
- Number nodes to 50-100 thousands nodes,
- Nesting depths to 1,000 levels,
- Complex mutation patterns (bulk moves, merges, splits),
- Real-time data access via API.
Its core philosophy: **maximum scalability, minimum complexity**.
### Key Features
#### Common operations
The `django-fast-Treenode` package supports all the basic operations needed to work with tree structures:
- Extracting **ancestors** (queryset, list, pks, count);
- Extracting **children** (queryset, list, pks, count);
- Extracting **descendants** (queryset, list, pks, count);
- Extracting a **family**: ancestors, the node itself and its descendants (queryset, list, pks, count);
- Enumerating all the nodes (queryset, dicts);
- **Adding** a new node at a **certain position** on the tree;
- Automatic **sorting of node order** by the value of the specified field;
- **Deleting** an node;
- **Pruning**: Removing a whole section of a tree;
- **Grafting**: Adding a whole section to a tree;
- Finding the **root** for any node;
- Finding the **lowest common ancestor** of two nodes;
- Finding the **shortest path** between two nodes.
Due to its high performance and ability to support deep nesting and large tree sizes, the `django-fast-treeode` package can be used for any tasks that involve the use of tree-like data, with virtually no restrictions.
### Where Massive Trees Really Matter?
**Treenode Framework** is designed to handle not only toy examples, but also real trees with strict requirements for the number of nodes and their nesting.
Typical applications include:
- **Digital Twin Systems** for industrial asset management (plants, machinery, vehicles), where full structural decomposition is critical for maintenance planning and cost optimization.
- **Decision Support Systems** in medicine, law, and insurance, where large and dynamic decision trees drive critical reasoning processes.
- **AI Planning Engines** based on hierarchical task networks, allowing intelligent agents to decompose and execute complex strategies.
- **Biological and Genetic Research**, where large phylogenetic trees model evolutionary relationships or genetic hierarchies.
In all these domains, scalable and fast tree management is not a luxury — it's a necessity.
### Why Treenode Framework?
At the moment, django-fast-treeenode is, if not the best, then one of the best packages for working with tree data under Djangjo.
- **High performance**: [tests show](docs/about.md#benchmark-tests) that on trees of 5k-10k nodes with a nesting depth of 500-600 levels, **Treenode Framework** (`django-fast-Treenode`) shows **performance 4-7 times better** than the main popular packages.
- **Flexible API**: today contains the widest set of methods for working with a tree in comparison with other packages.
- **Convenient administration**: the admin panel interface was developed taking into account the experience of using other packages. It provides convenience and intuitiveness with ease of programming.
- **Scalability**: **Treenode Framework** suitable for solving simple problems such as menus, directories, parsing arithmetic expressions, as well as complex problems such as program optimization, image layout, multi-step decision making problems, or machine learning..
- **Lightweight**: All functionality is implemented within the package without heavyweight dependencies such as `djangorestframework` or `django-import-export`.
- **Optional JWT authentication**: enable token-based protection for the API with a single setting.
All this makes **Treenode Framework** a prime candidate for your needs.
## Quick Start
To get started quickly, you need to follow these steps:
- Simply install the package via `pip`:
```sh
pip install django-fast-Treenode
```
- Once installed, add `'treenode'` to your `INSTALLED_APPS` in **settings.py**:
```python {title="settings.py"}
INSTALLED_APPS = [
...
'treenode',
...
]
```
- Open **models.py** and create your own tree class:
```
from Treenode.models import TreenodeModel
class MyTree(TreenodeModel):
name = models.CharField(max_length=255)
display_field = "name"
```
- Open **admin.py** and create a model for the admin panel
```
from django.contrib import admin
from Treenode.admin import TreenodeModelAdmin
from .models import MyTree
@admin.register(MyTree)
class MyTreeAdmin(TreenodeModelAdmin):
list_display = ("name",)
search_fields = ("name",)
```
- Then, apply migrations:
```sh
python manage.py makemigrations
python manage.py migrate
```
- Run server
```sh
python manage.py runserver
```
Everything is ready, enjoy 🎉!
## Documentation
Full documentation is available at **[ReadTheDocs](https://django-fast-Treenode.readthedocs.io/)**.
Quick access links:
* [Installation, configuration and fine tuning](https://django-fast-Treenode.readthedocs.io/installation/)
* [Model Inheritance and Extensions](https://django-fast-Treenode.readthedocs.io/models/)
* [Working with Admin Classes](https://django-fast-Treenode.readthedocs.io/admin/)
* [API Reference](https://django-fast-Treenode.readthedocs.io/api/)
* [Import & Export](https://django-fast-Treenode.readthedocs.io/import_export/)
* [Caching and working with cache](https://django-fast-Treenode.readthedocs.io/cache/)
* [Migration and upgrade guide](https://django-fast-Treenode.readthedocs.io/migration/)
Your wishes, objections, comments are welcome.
## License
Released under [MIT License](https://github.com/TimurKady/django-fast-Treenode/blob/main/LICENSE).
## Credits
Thanks to everyone who contributed to the development and testing of this package, as well as the Django community for their inspiration and support.
Special thanks to [Fabio Caccamo](https://github.com/fabiocaccamo) for the idea behind creating a fast Django application for handling hierarchies.
Also special thanks to everyone who supports the project with their [sponsorship donations](https://github.com/sponsors/TimurKady).
Raw data
{
"_id": null,
"home_page": "https://django-fast-treenode.readthedocs.io/",
"name": "django-fast-treenode",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Timur Kady",
"author_email": "Timur Kady <timurkady@yandex.com>",
"download_url": "https://files.pythonhosted.org/packages/e6/42/5b878aa96669dde0c001a9b94e092f889504a6198b2304af0c0ab945ca8b/django_fast_treenode-3.2.4.tar.gz",
"platform": null,
"description": "# Treenode Framework\r\n**A hybrid open-source framework for working with trees in Django**\r\n\r\n[](https://github.com/TimurKady/django-fast-treenode/actions/workflows/test.yaml)\r\n[](https://django-fast-treenode.readthedocs.io/)\r\n[](https://pypi.org/project/django-fast-Treenode/)\r\n[](https://djangopackages.org/packages/p/django-fast-treenode/)\r\n[](https://github.com/sponsors/TimurKady)\r\n\r\n## About The Treenode Framework\r\n### Overview\r\n\r\n**Treenode Framework** is an advanced tree management system for Django applications.It is designed to handle large-scale, deeply nested, and highly dynamic tree structures while maintaining excellent performance, data integrity, and ease of use.\r\n\r\nUnlike traditional solutions, **Treenode Framework** is built for serious real-world applications where trees may consist of:\r\n\r\n- Number nodes to 50-100 thousands nodes,\r\n- Nesting depths to 1,000 levels,\r\n- Complex mutation patterns (bulk moves, merges, splits),\r\n- Real-time data access via API.\r\n\r\nIts core philosophy: **maximum scalability, minimum complexity**.\r\n\r\n### Key Features\r\n#### Common operations\r\nThe `django-fast-Treenode` package supports all the basic operations needed to work with tree structures:\r\n\r\n- Extracting **ancestors** (queryset, list, pks, count);\r\n- Extracting **children** (queryset, list, pks, count);\r\n- Extracting **descendants** (queryset, list, pks, count);\r\n- Extracting a **family**: ancestors, the node itself and its descendants (queryset, list, pks, count);\r\n- Enumerating all the nodes (queryset, dicts);\r\n- **Adding** a new node at a **certain position** on the tree;\r\n- Automatic **sorting of node order** by the value of the specified field;\r\n- **Deleting** an node;\r\n- **Pruning**: Removing a whole section of a tree;\r\n- **Grafting**: Adding a whole section to a tree;\r\n- Finding the **root** for any node;\r\n- Finding the **lowest common ancestor** of two nodes;\r\n- Finding the **shortest path** between two nodes.\r\n\r\nDue to its high performance and ability to support deep nesting and large tree sizes, the `django-fast-treeode` package can be used for any tasks that involve the use of tree-like data, with virtually no restrictions.\r\n\r\n### Where Massive Trees Really Matter?\r\n\r\n**Treenode Framework** is designed to handle not only toy examples, but also real trees with strict requirements for the number of nodes and their nesting.\r\n\r\nTypical applications include:\r\n\r\n- **Digital Twin Systems** for industrial asset management (plants, machinery, vehicles), where full structural decomposition is critical for maintenance planning and cost optimization.\r\n- **Decision Support Systems** in medicine, law, and insurance, where large and dynamic decision trees drive critical reasoning processes.\r\n- **AI Planning Engines** based on hierarchical task networks, allowing intelligent agents to decompose and execute complex strategies.\r\n- **Biological and Genetic Research**, where large phylogenetic trees model evolutionary relationships or genetic hierarchies.\r\n\r\nIn all these domains, scalable and fast tree management is not a luxury \u2014 it's a necessity.\r\n\r\n### Why Treenode Framework?\r\nAt the moment, django-fast-treeenode is, if not the best, then one of the best packages for working with tree data under Djangjo.\r\n\r\n- **High performance**: [tests show](docs/about.md#benchmark-tests) that on trees of 5k-10k nodes with a nesting depth of 500-600 levels, **Treenode Framework** (`django-fast-Treenode`) shows **performance 4-7 times better** than the main popular packages.\r\n- **Flexible API**: today contains the widest set of methods for working with a tree in comparison with other packages.\r\n- **Convenient administration**: the admin panel interface was developed taking into account the experience of using other packages. It provides convenience and intuitiveness with ease of programming.\r\n- **Scalability**: **Treenode Framework** suitable for solving simple problems such as menus, directories, parsing arithmetic expressions, as well as complex problems such as program optimization, image layout, multi-step decision making problems, or machine learning..\r\n- **Lightweight**: All functionality is implemented within the package without heavyweight dependencies such as `djangorestframework` or `django-import-export`.\r\n- **Optional JWT authentication**: enable token-based protection for the API with a single setting.\r\n\r\nAll this makes **Treenode Framework** a prime candidate for your needs.\r\n\r\n## Quick Start\r\nTo get started quickly, you need to follow these steps:\r\n\r\n- Simply install the package via `pip`:\r\n ```sh\r\n pip install django-fast-Treenode\r\n ```\r\n- Once installed, add `'treenode'` to your `INSTALLED_APPS` in **settings.py**:\r\n ```python {title=\"settings.py\"}\r\n INSTALLED_APPS = [\r\n ...\r\n 'treenode',\r\n ...\r\n ]\r\n ```\r\n\r\n- Open **models.py** and create your own tree class:\r\n ```\r\n from Treenode.models import TreenodeModel\r\n\r\n class MyTree(TreenodeModel):\r\n name = models.CharField(max_length=255)\r\n display_field = \"name\"\r\n ```\r\n\r\n- Open **admin.py** and create a model for the admin panel\r\n ```\r\n from django.contrib import admin\r\n from Treenode.admin import TreenodeModelAdmin\r\n from .models import MyTree\r\n\r\n @admin.register(MyTree)\r\n class MyTreeAdmin(TreenodeModelAdmin):\r\n list_display = (\"name\",)\r\n search_fields = (\"name\",)\r\n ```\r\n\r\n- Then, apply migrations:\r\n ```sh\r\n python manage.py makemigrations\r\n python manage.py migrate\r\n ```\r\n\r\n- Run server\r\n ```sh\r\n python manage.py runserver\r\n ```\r\nEverything is ready, enjoy \ud83c\udf89!\r\n\r\n## Documentation\r\nFull documentation is available at **[ReadTheDocs](https://django-fast-Treenode.readthedocs.io/)**.\r\n\r\nQuick access links:\r\n* [Installation, configuration and fine tuning](https://django-fast-Treenode.readthedocs.io/installation/)\r\n* [Model Inheritance and Extensions](https://django-fast-Treenode.readthedocs.io/models/)\r\n* [Working with Admin Classes](https://django-fast-Treenode.readthedocs.io/admin/)\r\n* [API Reference](https://django-fast-Treenode.readthedocs.io/api/)\r\n* [Import & Export](https://django-fast-Treenode.readthedocs.io/import_export/)\r\n* [Caching and working with cache](https://django-fast-Treenode.readthedocs.io/cache/)\r\n* [Migration and upgrade guide](https://django-fast-Treenode.readthedocs.io/migration/)\r\n\r\nYour wishes, objections, comments are welcome.\r\n\r\n## License\r\nReleased under [MIT License](https://github.com/TimurKady/django-fast-Treenode/blob/main/LICENSE).\r\n\r\n## Credits\r\nThanks to everyone who contributed to the development and testing of this package, as well as the Django community for their inspiration and support. \r\n\r\nSpecial thanks to [Fabio Caccamo](https://github.com/fabiocaccamo) for the idea behind creating a fast Django application for handling hierarchies.\r\n\r\nAlso special thanks to everyone who supports the project with their [sponsorship donations](https://github.com/sponsors/TimurKady).\r\n",
"bugtrack_url": null,
"license": "MIT License\r\n \r\n Copyright (c) 2020-2025 Timur Kady\r\n \r\n Permission is hereby granted, free of charge, to any person obtaining a copy\r\n of this software and associated documentation files (the \"Software\"), to deal\r\n in the Software without restriction, including without limitation the rights\r\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n copies of the Software, and to permit persons to whom the Software is\r\n furnished to do so, subject to the following conditions:\r\n \r\n The above copyright notice and this permission notice shall be included in all\r\n copies or substantial portions of the Software.\r\n \r\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n SOFTWARE.\r\n \r\n ",
"summary": "Treenode Framework for supporting tree (hierarchical) data structure in Django projects",
"version": "3.2.4",
"project_urls": {
"Documentation": "https://django-fast-treenode.readthedocs.io/",
"Homepage": "https://github.com/TimurKady/django-fast-treenode",
"Issues": "https://github.com/TimurKady/django-fast-treenode/issues",
"Source": "https://github.com/TimurKady/django-fast-treenode"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "6f597ddf6895d12ef441d7c29cec0927f3f927efb672e617157ab2f1781e1728",
"md5": "d7de6ba3121876fd8b69df83fde4c58e",
"sha256": "8cf619d79955479961f9332bdf5b92f9277214c4e86e3dbf7943073209378574"
},
"downloads": -1,
"filename": "django_fast_treenode-3.2.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d7de6ba3121876fd8b69df83fde4c58e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 288923,
"upload_time": "2025-07-10T13:29:03",
"upload_time_iso_8601": "2025-07-10T13:29:03.371799Z",
"url": "https://files.pythonhosted.org/packages/6f/59/7ddf6895d12ef441d7c29cec0927f3f927efb672e617157ab2f1781e1728/django_fast_treenode-3.2.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e6425b878aa96669dde0c001a9b94e092f889504a6198b2304af0c0ab945ca8b",
"md5": "be941b2ec3fb8435046069b3c6c21438",
"sha256": "dfab7e08a2597969ae14463f741ecd96a2138afa600357cb9ae78db74ed26173"
},
"downloads": -1,
"filename": "django_fast_treenode-3.2.4.tar.gz",
"has_sig": false,
"md5_digest": "be941b2ec3fb8435046069b3c6c21438",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 335448,
"upload_time": "2025-07-10T13:29:04",
"upload_time_iso_8601": "2025-07-10T13:29:04.985830Z",
"url": "https://files.pythonhosted.org/packages/e6/42/5b878aa96669dde0c001a9b94e092f889504a6198b2304af0c0ab945ca8b/django_fast_treenode-3.2.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-10 13:29:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "TimurKady",
"github_project": "django-fast-treenode",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "Django",
"specs": [
[
">=",
"3.2"
]
]
},
{
"name": "msgpack",
"specs": [
[
">=",
"1.0.0"
]
]
},
{
"name": "openpyxl",
"specs": [
[
">=",
"3.0.0"
]
]
},
{
"name": "pyyaml",
"specs": [
[
">=",
"5.1"
]
]
},
{
"name": "PyJWT",
"specs": [
[
">=",
"2.0"
]
]
}
],
"lcname": "django-fast-treenode"
}