Skip to content

Commit bad700c

Browse files
committed
2 parents 3b9841a + 0a29306 commit bad700c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2135
-869
lines changed

CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
# Changelog
22

3-
## 0.8.1 (unreleased)
3+
## 0.9.1 (unreleased)
44

5+
## 0.9.0 (2024-09-12)
6+
7+
- Add `Tree.build_random_tree()` (experimental).
8+
- Add `GenericNodeData` as wrapper for `dict` data.
59
- Fixed #7 Tree.from_dict failing to recreate an arbitrary object tree with a mapper.
610

711
## 0.8.0 (2024-03-29)
812

913
- BREAKING: Drop Python 3.7 support (EoL 2023-06-27).
1014
- `Tree.save()` accepts a `compression` argument that will enable compression.
1115
`Tree.load()` can detect if the input file has a compression header and will
12-
decompress automatically.
13-
- New traversal methods `LEVEL_ORDER`, `LEVEL_ORDER_RTL`, `ZIGZAG`, `ZIGZAG_RTL`.
1416
decompress transparently.
17+
- New traversal methods `LEVEL_ORDER`, `LEVEL_ORDER_RTL`, `ZIGZAG`, `ZIGZAG_RTL`.
1518
- New compact connector styles `'lines32c'`, `'round43c'`, ...
1619
- Save as mermaid flow diagram.
1720

Pipfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ name = "pypi"
55

66
[dev-packages]
77
black = { version = "~=24.3", extras = ["jupyter"] }
8+
# coverage = "*"
9+
fabulist="*"
810
isort = "*"
9-
# pylint = "*"
10-
# TODO: remove this line:
11-
# pytest-html = "!=3.2.0" # wait for https://github.com/pytest-dev/pytest-html/pull/583
1211
pytest = "*"
1312
pytest-cov = "*"
1413
PyYAML = "*"
@@ -22,14 +21,13 @@ tox = "*"
2221
twine = "*"
2322
wheel = "*"
2423
yabs = "*"
25-
nutree = {path = ".",editable = true}
2624
ipykernel = "*"
2725
notebook = "*"
26+
nutree = {path = ".",editable = true}
2827

2928
[packages]
3029

3130
[requires]
3231
python_version = "3.12"
3332

3433
[pipenv]
35-
# allow_prereleases = true

Pipfile.lock

Lines changed: 796 additions & 771 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Nodes can be plain strings or objects <br>
2323
(De)Serialize to (compressed) JSON <br>
2424
Save as Mermaid flow diagram <br>
2525
Different traversal methods <br>
26+
Generate random trees <br>
2627
Fully type annotated <br>
2728
Convert to RDF graph <br>
2829
Typed child nodes <br>

docs/sphinx/conf.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119

120120
# General information about the project.
121121
project = u'nutree'
122-
copyright = u'2021-2023, <a href="https://wwwendt.de">Martin Wendt</a>'
122+
copyright = u'2021-2024, <a href="https://wwwendt.de">Martin Wendt</a>'
123123
author = u'Martin Wendt'
124124

125125
# The version info for the project you're documenting, acts as replacement for
@@ -130,19 +130,25 @@
130130
#version = '1.0'
131131
# The full version, including alpha/beta/rc tags.
132132
#release = '1.0'
133-
import pkg_resources
133+
import importlib
134134

135135
try:
136-
release = pkg_resources.get_distribution('nutree').version
137-
# print( "release", release)
138-
del pkg_resources
139-
except pkg_resources.DistributionNotFound:
140-
print('To build the documentation, The distribution information')
141-
print('Has to be available. Either install the package into your')
136+
# release = pkg_resources.get_distribution("nutree").version
137+
release = importlib.metadata.version("nutree")
138+
except importlib.metadata.PackageNotFoundError:
139+
print("To build the documentation, The distribution information")
140+
print("has to be available. Either install the package into your")
142141
print('development environment or run "setup.py develop" to setup the')
143-
print('metadata. A virtualenv is recommended!')
142+
print("metadata. A virtualenv is recommended!")
143+
144+
print(f"sys.path: {sys.path}")
145+
print(f"package_root: {package_root}")
146+
for fn in os.listdir(package_root):
147+
print("-", fn)
144148
sys.exit(1)
145149

150+
del importlib.metadata
151+
146152
version = '.'.join(release.split('.')[:2])
147153

148154
# The language for content autogenerated by Sphinx. Refer to documentation

docs/sphinx/index.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ nutree
2828

2929
$ pip install nutree
3030

31-
**Note:** Run ``pip install nutree[graph]`` instead, in order to install
32-
additional graph support.
31+
**Note:** Run ``pip install "nutree[graph]"`` or ``pip install "nutree[all]"``
32+
instead, in order to install additional graph support.
3333

3434
::
3535

@@ -96,8 +96,9 @@ Nutree Facts
9696
* :ref:`(De)Serialize to (compressed) JSON <serialize>`
9797
* :ref:`Save as Mermaid flow diagram <save-mermaid>`
9898
* :ref:`Different traversal methods <traversal>`
99-
* :ref:`Fully type annotated <api-reference>`
99+
* :ref:`Generate random trees <randomize>`
100100
* :ref:`Convert to RDF graph <save-rdf>`
101+
* :ref:`Fully type annotated <api-reference>`
101102
* :ref:`Typed child nodes <typed-tree>`
102103
* :ref:`Pretty print <pretty-print>`
103104
* :ref:`Navigation <navigate>`

docs/sphinx/installation.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Installation is straightforward::
55

66
$ pip install nutree
77

8-
**Note:** Run ``pip install nutree[graph]`` instead, in order to install
9-
additional graph support.
8+
**Note:** Run ``pip install "nutree[graph]"`` or ``pip install "nutree[all]"``
9+
instead, in order to install additional graph support.
1010

1111
Installing `nutree` and its dependencies into a 'sandbox' will help to keep
1212
your system Python clean, but requires to activate the virtual environment::

docs/sphinx/reference_guide.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@ Reference Guide
55
Class Overview
66
==============
77

8+
Nutree Classes
9+
--------------
10+
811
.. inheritance-diagram:: nutree.tree nutree.node nutree.typed_tree nutree.common
912
:parts: 2
1013
:private-bases:
11-
:caption: nutree classes
14+
15+
Random Tree Generator
16+
---------------------
17+
18+
.. inheritance-diagram:: nutree.tree_generator
19+
:parts: 2
1220

1321

1422
.. API

docs/sphinx/rg_modules.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,12 @@ nutree.common module
4242
:show-inheritance:
4343
:inherited-members:
4444

45+
nutree.tree_generator module
46+
----------------------------
47+
48+
.. automodule:: nutree.tree_generator
49+
:members:
50+
:undoc-members:
51+
:show-inheritance:
52+
:inherited-members:
53+

docs/sphinx/ug_basics.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ Basics
44

55
.. py:currentmodule:: nutree
66
7+
.. admonition:: TL;DR
8+
9+
Nutree is a Python library for managing hierarchical data structures.
10+
It stores arbitrary data objects in nodes and provides methods for
11+
navigation, searching, and iteration.
12+
713

814
Adding Nodes
915
------------
@@ -35,8 +41,8 @@ Nodes are usually created by adding a new data instance to a parent::
3541

3642
.. seealso::
3743

38-
See :doc:`ug_objects` for details on how to manage arbitrary objects instead
39-
of plain strings.
44+
See :doc:`ug_objects` for details on how to manage arbitrary objects, dicts,
45+
etc. instead of plain strings.
4046

4147

4248
Info and Navigation

0 commit comments

Comments
 (0)