Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .claude/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# front

Backend-agnostic core library for dispatching Python functions as webservices,
Docker containers and GUIs. Compiles a short-language configuration into a spec
(`SpecMakerBase`), builds a UI element tree from it (`ElementTreeMaker`), and
assembles the app (`AppMaker`). Concrete UI frameworks (e.g. `streamlitfront`)
build on `front`; `front` itself renders nothing.

## Module map (`front/`)

- `app_maker.py` β€” `AppMaker`: configuration + convention -> compiled spec -> app.
- `spec_maker_base.py` β€” the "short language -> long language" compiler:
builds a `FrontSpec` from a configuration.
- `elements/` β€” `tree_maker_base.py` (`ElementTreeMaker`), `elements.py`
(the dataclass-based composite element tree β€” no bitflags, despite some old
issue language), `implementation.py`.
- `crude.py` β€” **CRUDE = CRUD-Execution**: `Crudifier` / `prepare_for_crude_dispatch`
let functions with complex arguments be operated through string keys into
stores (mall-backed). This is the mature machinery several old open issues
(store access, param handling) turn out to already be substantially solved by.
- `dag.py` β€” crudifies the variable nodes of a `meshed` DAG (the producing
function's output gets stored and referenced by key).
- `data_binding.py` / `state.py` β€” `BoundData` wraps a keyed slot in `State`,
connecting element values to a backing store; `GetterSetter`/`StateType`/`Forbidden`.
- `py2pydantic.py` β€” bridges plain functions to pydantic v2 input models.
- `base.py` β€” `prepare_for_dispatch`: chains the wrappers a UI needs.
- `tools.py`, `util.py`, `types.py` β€” general helpers, signature/mapping
utilities, shared type aliases/dataclasses (`Configuration`, etc.).

## Tests & lint (verified)

```bash
uv venv .venv && uv pip install -e . pytest ruff
.venv/bin/pytest -v --tb=short # testpaths=["tests"] only: 1 passed (see gotcha)
.venv/bin/pytest --doctest-modules front/ --ignore=front/examples --ignore=front/scrap # 62 passed
.venv/bin/pytest front/tests # 15 passed β€” NOT in testpaths, run explicitly
.venv/bin/ruff check .
```
**Gotcha:** `[tool.pytest.ini_options].testpaths = ["tests"]` means a bare
`pytest` run collects only the one-test `tests/test_smoke.py` β€” `front/tests/`
(15 tests: crude, py2pydantic, state, combos, use-case) and the module doctests
must be run explicitly, as above, to actually exercise the package. `wads
ci-local` covers all three via its own invocation; a bare `pytest` locally does not.

## Docs

No `docs/`, ADRs, or shipped skills in this repo currently.

## Dependents

`extrude`, `opyratorfront`, `streamlitfront` import this package β€” check their
tests before changing `AppMaker`, `SpecMakerBase`, `Crudifier`, or the element
tree shape. `front` itself depends on `i2` and `meshed`.
Loading