A simple router / treelib for python.
pip install simpleroute
Note: as simpleroute uses two dictionaries internally rather than an OOP-based node system,
Traverse replaces the standard "Node" class present in most other tree libraries.
from simpleroute import BaseRouter, Router, Traverse
router = BaseRouter([]) # list of paths sep by /
path, kwargs = router.match("SOME_STR_HERE") #match wildcards, eg /etc/1 to /etc/:num
router = Router({}) # dict of paths:datavals sep by /
path, kwargs, data = router.match("SOME_STR_HERE") #match wildcards, eg /etc/1 to /etc/:num
traverse = Traverse.go(router, path="SOME_PATH_HERE") #returns an object of Traverse, optional path to go
#use get_child, get_children, get_parent, get_data, get_path, get_sub to manipulate the object