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.2.0.tar.gz (366.1 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.2.0-py3-none-any.whl (333.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spaday_trees-0.2.0.tar.gz
  • Upload date:
  • Size: 366.1 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.2.0.tar.gz
Algorithm Hash digest
SHA256 64c1d3c5c4a73a5830b344aee4da42399f31d510c98d4f6b7d5c5ed4b13a773e
MD5 1c1d24ea9bbd78e8722eaf732db76d1e
BLAKE2b-256 229a3a6ef073503f68d0af2dd9ae8211d7d854786ef8aa0dad99da865f0a54db

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spaday_trees-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 333.8 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 77d324a49e59571e41a566e9d1de20bf6c311c9e60c4bccdce6d9cd95bd5698e
MD5 d51d7840f743250f2b21267bd3c2908b
BLAKE2b-256 aa302624174f95d3599b4b9534d6ac6259da6e5db2a60eeed896ef61fc148bd0

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