Metadata-Version: 2.5
Name: gramlot-examples
Version: 0.3.41
Summary: Gramlot example pages, the gallery page and its catalogue.
Project-URL: Documentation, https://gramlot-examples.readthedocs.io/en/latest/
Project-URL: Homepage, https://github.com/gramlot-org/gramlot-examples
Project-URL: Repository, https://github.com/gramlot-org/gramlot-examples
Project-URL: Issues, https://github.com/gramlot-org/gramlot-examples/issues
License-Expression: Apache-2.0
License-File: LICENSE
License-File: NOTICE
Requires-Python: >=3.11
Requires-Dist: gramlot>=0.3.33
Provides-Extra: chat
Requires-Dist: anthropic>=2.0.0; extra == 'chat'
Requires-Dist: openai; extra == 'chat'
Provides-Extra: system-monitor
Requires-Dist: psutil>=7; extra == 'system-monitor'
Provides-Extra: test
Requires-Dist: psutil>=7; extra == 'test'
Requires-Dist: pytest-asyncio>=0.24; extra == 'test'
Requires-Dist: pytest>=8; extra == 'test'
Description-Content-Type: text/markdown

# gramlot-examples

The common example pages of [Gramlot](https://github.com/gramlot-org/gramlot), the
gallery page that presents them, and its catalogue. Published as a package that
depends only on the Gramlot core:

```sh
pip install gramlot-examples
npm install @gramlot/gramlot-examples
```

[![PyPI](https://img.shields.io/pypi/v/gramlot-examples)](https://pypi.org/project/gramlot-examples/)
[![npm](https://img.shields.io/npm/v/@gramlot/gramlot-examples)](https://www.npmjs.com/package/@gramlot/gramlot-examples)

Current release: 0.3.41.

## Run the gallery locally

Clone the examples to keep an editable copy. Install Python 3.11 or newer,
Git and Node.js 22 or newer with npm, then run (macOS/Linux):

```sh
git clone https://github.com/gramlot-org/gramlot-examples.git
cd gramlot-examples
python3 -m venv .venv
source .venv/bin/activate
npm install --package-lock=false
npm run build
python -m pip install -e . "gramlot-py-server[uvicorn]"
gramlot uvicorn gallery --remote-edit
```

On Windows, use `python -m venv .venv` and activate the environment with
`.venv\Scripts\activate` in Command Prompt; the remaining commands are the same.

Open the local address printed by the command. In an example's **Code** tab,
edit the Python source and select **Save**; the local source file is updated
and the preview reloads. `--remote-edit` also permits saving in the IDE's
temporary sample workspace, which is reset when the gallery stops. Use this
option only on your own trusted local server; the public gallery is read-only.
Without the option, example sources remain read-only.

Database examples may require additional services and configuration.

[Documentation and learning sequence](https://gramlot-examples.readthedocs.io/en/latest/)
include every lesson, its Python and JavaScript source, and the gallery guide.
To run the examples, choose the [Python server](https://gramlot-py-server.readthedocs.io/en/latest/),
[Node.js/Bun server](https://gramlot-js-server.readthedocs.io/en/latest/010-tutorial.html)
or [serverless exporter](https://gramlot-js-server.readthedocs.io/en/latest/135-serverless-tutorial.html).

The repositories of the family are described in
[The Gramlot family](https://github.com/gramlot-org/gramlot/blob/main/docs/public/055-family.md)
(GC-055).

## Updating

Choose [packaged or source-checkout updates](docs/010-gallery.md#ge-010-050). A Python gallery installed from source also needs its JavaScript bundles rebuilt; updating Python files alone does not update the footer inspector.

## Pages

[`src/gramlot_examples/pages/`](https://github.com/gramlot-org/gramlot-examples/blob/main/src/gramlot_examples/pages/README.md) holds five
families. Each example is a Python page and its JavaScript equivalent, with a
same-name README:

- `html_svg/`: thirteen HTML and SVG pages, without binding (`e01`–`e13`);
- `binding/`: eleven pages whose DOM follows the Data (`b01`–`b11`);
- `controllers/`: twenty-three pages with formulas, controllers, named logic, events, the
  end-to-end story, `dataRpc` calls to the endpoints of the page, `remote` fragments and
  `dataRemote` values (`c01`–`c23`). Later lessons introduce topics, authored references, native ask,
  parent/child messages, plain HTML buttons and delayed Gramlot clicks. The package
  requires the current core release; each lesson states which features it uses.

- `components/`: thirty-four lessons for inputs, labelbox, formlet, group copy,
  command buttons and field validation (`w01`–`w25`), with compact controls.
- `layout/`: eight container lessons (`l01`–`l08`), with live splitters, drawers,
  nested layouts, selection and closing events, fourteen tab presentations,
  a guided drawer tour and a lazy carousel with retained live previews.

Each `NN_name.js` exports `Page`, and `Logic` when the page names client methods; the
Python page `NN_name.py` takes that `Logic` from the module beside it.

## Gallery

The gallery page lists the families and opens each example beside its README and
source. `build_gallery` (Python) and `buildGallery` (JavaScript) return its routes and
static assets; each environment (`gramlot-py-server`, `gramlot-js-server`) serves the
gallery with its own server and can add its own catalogue. Guide:
[GE-010](https://github.com/gramlot-org/gramlot-examples/blob/main/docs/010-gallery.md).

```sh
npm install --no-package-lock
npm run build
npm test
python -m pytest -q tests
```

[Repository map](https://github.com/gramlot-org/gramlot-examples/blob/main/docs/005-repository-map.md) (GE-005).
