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.

Documentation

Quick 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.

Run the local example

python -m pip install -e ".[examples]"
python -m spaday_trees.example

Open http://127.0.0.1:8016 to inspect the complete project-explorer example: reactive server path updates, selection, built-in search, Git status, responsive styling, and client events logged by Python. It passes the local package descriptor directly, so it does not install or resolve the integration from GitHub.

[!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.1.tar.gz (366.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.1-py3-none-any.whl (333.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for spaday_trees-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2e8619f80dab6339af7ae203a414359e05bb5eb53219d329ead7d7f16dc663ae
MD5 7faaaa13b855a78203d1b5c2e93fdc2f
BLAKE2b-256 13e705fb0a744568de059e12257c74ab5642cb1466ed71a4e597a9af36b55e50

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for spaday_trees-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dc17724f476638e8c0ceb13d172fb821906aefe4f5c45a58a21cfa4b3c1757a9
MD5 be3167ca5e761e427eedefe5d0f407eb
BLAKE2b-256 f9e7957fd9512a3e83b39b595f8b76ee9d088397dd07ab057b586a36a4c4a36b

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