Skip to main content

spaday-trees

Trees, by Pierre, for spaday

Build Status codecov License PyPI

Overview

spaday-trees wraps Pierre's imperative FileTree in a <spaday-tree> custom element and exposes it as the Python Tree component. The first release supports reactive path replacement, selected paths, search, Git status, and path-based selection-change / search-change events.

Interactive example

This app filters the tree as you type. The button changes its selected path through spaday's reactive store; selecting and expanding nodes in the tree remains client-side.

from spaday import SetField, element
from spaday.backends.starlette import serve
from spaday_trees import Tree

paths = [
    "README.md",
    "pyproject.toml",
    "src/app.py",
    "src/components/tree.py",
    "tests/test_app.py",
]

tree = (
    Tree(paths=paths)
    .bind("search", "query")
    .bind("selected_paths", "selected")
    .style(height="22rem")
)

page = (
    element("main")
    .style(max_width="42rem", margin="2rem auto", font_family="system-ui")
    .child(element("h1").text("Project files"))
    .child(
        element("input", type="search", placeholder="Filter files…")
        .bind("value", "query", mode="two-way")
        .style(width="100%", padding="0.6rem", margin_bottom="0.75rem")
    )
    .child(element("button").text("Select README").on("click", SetField("selected", ["README.md"])))
    .child(tree)
)

app = serve(page, packages=["trees"], store={"query": "", "selected": []})

Save this as app.py, then run pip install spaday-trees starlette uvicorn and uvicorn app:app. Open http://127.0.0.1:8000.

Installing this project registers the trees entry point with spaday. The equivalent explicit forms are packages=[spaday_trees.package] and packages=["spaday_trees:package"].

The integration pins @pierre/trees 1.0.0-beta.5. Rename, drag-and-drop persistence, custom composition renderers, and SSR/hydration are intentionally deferred while its beta API settles.

[!NOTE] This library was generated using copier from the Base Python Project Template repository.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spaday_trees-0.1.0.tar.gz (355.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spaday_trees-0.1.0-py3-none-any.whl (326.3 kB view details)

Uploaded Python 3

File details

Details for the file spaday_trees-0.1.0.tar.gz.

File metadata

  • Download URL: spaday_trees-0.1.0.tar.gz
  • Upload date:
  • Size: 355.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for spaday_trees-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d568f2c1a7d34b05df132b3482d4b314877db94f495471ea4a27599fd7a4526c
MD5 95fee9308e4c7195177290c5fc07af6b
BLAKE2b-256 dd7c69e954bda94cb714b589dae4ccf88412c1300967064a7eafd7079c8fa914

See more details on using hashes here.

File details

Details for the file spaday_trees-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: spaday_trees-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 326.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for spaday_trees-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 485e54ef03ac90626a149e7845f8e838b5256d06c7570e8c43aeec5ab25cf3a7
MD5 03d3a22778e2d5d0054fcc74af8e9327
BLAKE2b-256 7b0d1189e130c6024fe6d2a3c2da8609dd1612ea3b78d80108e90182f2c2ba72

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page