Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
129 changes: 129 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Datastar Python SDK Examples

## How to Run These Examples with `uv`

All of the examples here (except Django) include Inline Script Metadata (PEP 723), allowing them to be run with [uv](https://docs.astral.sh/uv/) without first installing dependencies.

The following commands assume you are running them from the root of the repository.

### Django

We use the `--with` argument to declare dependencies to run our Django app.

```sh
uv run --with django --with daphne ./examples/django/manage.py runserver
```

### FastAPI

```sh
uv run ./examples/fastapi/app.py
```

### FastHTML

```sh
uv run ./examples/fasthtml/simple.py
```

```sh
uv run ./examples/fasthtml/advanced.py
```

### Litestar

```sh
uv run ./examples/litestar/app.py
```

### Quart

```sh
uv run ./examples/quart/app.py
```

### Sanic

```sh
uv run ./examples/sanic/app.py
```

## How to Run These Examples with `pip`

### Setup

```sh
python -m venv .venv
```

```sh
source .venv/bin/activate
```

### Django

```sh
pip install . daphne django
```

```sh
python ./examples/django/manage.py runserver
```

### FastAPI

```sh
pip install . uvicorn fastapi
```

```sh
python ./examples/fastapi/app.py
```

### FastHTML

```sh
pip install . python-fasthtml
```

```sh
python ./examples/fasthtml/simple.py
```

```sh
pip install . python-fasthtml great-tables pandas polars
```

```sh
python ./examples/fasthtml/advanced.py
```

### Litestar

```sh
pip install . uvicorn litestar
```

```sh
python ./examples/litestar/app.py
```

### Quart

```sh
pip install . quart
```

```sh
python ./examples/quart/app.py
```

### Sanic

```sh
pip install . sanic
```

```sh
python ./examples/sanic/app.py
```
1 change: 1 addition & 0 deletions examples/litestar/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# dependencies = [
# "datastar-py",
# "litestar",
# "uvicorn",
# ]
# [tool.uv.sources]
# datastar-py = { path = "../../" }
Expand Down
20 changes: 0 additions & 20 deletions examples/pyproject.toml

This file was deleted.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ urls.GitHub = "https://github.com/starfederation/datastar-python"

[dependency-groups]
dev = [
"daphne>=4.2.1",
"django>=4.2.17",
"fastapi[standard]>=0.115.4",
"flask[async]>=3.0.3",
Expand Down