Skip to content

Commit afcf381

Browse files
committed
Update examples to work in the new repo
1 parent 589da38 commit afcf381

File tree

7 files changed

+37
-32
lines changed

7 files changed

+37
-32
lines changed

examples/django/pyproject.toml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,18 @@ version = "1.0.0"
44
description = "Datastar Example Django Project"
55
readme = "README.md"
66
requires-python = ">=3.10"
7+
classifiers = [
8+
"Programming Language :: Python :: 3 :: Only",
9+
"Programming Language :: Python :: 3.10",
10+
"Programming Language :: Python :: 3.11",
11+
"Programming Language :: Python :: 3.12",
12+
"Programming Language :: Python :: 3.13",
13+
]
714
dependencies = [
8-
"daphne>=4.2.0",
9-
"datastar-py>=0.4.4",
10-
"django>=5.2.1",
15+
"daphne>=4.2",
16+
"datastar-py>=0.4.4",
17+
"django>=5.2.1",
1118
]
1219

1320
[tool.uv.sources]
14-
datastar-py = { path = "../../../sdk/python" }
21+
datastar-py = { path = "../../" }

examples/fastapi/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# "uvicorn",
66
# ]
77
# [tool.uv.sources]
8-
# datastar-py = { path = "../../../sdk/python" }
8+
# datastar-py = { path = "../../" }
99
# ///
1010

1111
import asyncio

examples/fasthtml/advanced.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@
99
# "python-fasthtml",
1010
# ]
1111
# [tool.uv.sources]
12-
# datastar-py = { path = "../../../sdk/python" }
12+
# datastar-py = { path = "../../" }
1313
# ///
1414
import asyncio
1515
import json
1616
from datetime import datetime
17-
from pathlib import Path
1817

1918
import polars as pl
2019
from datastar_py.fasthtml import DatastarResponse, ServerSentEventGenerator
@@ -39,14 +38,16 @@
3938
# - Great Tables: https://posit-dev.github.io/great-tables/articles/intro.html #
4039
###################################################################################
4140

42-
repo_root = next(p for p in Path(__file__).parents if (p / ".git").exists())
43-
4441
app, rt = fast_app(
4542
htmx=False,
4643
surreal=False,
4744
live=True,
48-
static_path=str(repo_root),
49-
hdrs=(Script(type="module", src="/bundles/datastar.js"),),
45+
hdrs=(
46+
Script(
47+
type="module",
48+
src="https://cdn.jsdelivr.net/gh/starfederation/datastar@main/bundles/datastar.js",
49+
),
50+
),
5051
)
5152

5253
default_pattern = "aldehyde"

examples/fasthtml/simple.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,27 @@
55
# "python-fasthtml",
66
# ]
77
# [tool.uv.sources]
8-
# datastar-py = { path = "../../../sdk/python" }
8+
# datastar-py = { path = "../../" }
99
# ///
1010
import asyncio
1111
import json
1212
from datetime import datetime
13-
from pathlib import Path
1413

1514
from datastar_py.fasthtml import DatastarResponse, ServerSentEventGenerator, read_signals
1615

1716
# ruff: noqa: F403, F405
1817
from fasthtml.common import *
1918

20-
repo_root = next(p for p in Path(__file__).parents if (p / ".git").exists())
21-
2219
app, rt = fast_app(
2320
htmx=False,
2421
surreal=False,
2522
live=True,
26-
static_path=str(repo_root),
27-
hdrs=(Script(type="module", src="/bundles/datastar.js"),),
23+
hdrs=(
24+
Script(
25+
type="module",
26+
src="https://cdn.jsdelivr.net/gh/starfederation/datastar@main/bundles/datastar.js",
27+
),
28+
),
2829
)
2930

3031
example_style = Style(

examples/litestar/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# "litestar",
55
# ]
66
# [tool.uv.sources]
7-
# datastar-py = { path = "../../../sdk/python" }
7+
# datastar-py = { path = "../../" }
88
# ///
99

1010
import asyncio

examples/pyproject.toml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
[tool.ruff]
22
line-length = 99
3-
exclude = [
4-
"src/datastar_py/consts.py",
5-
]
6-
[tool.ruff.lint]
7-
select = [
3+
lint.select = [
4+
# flake8-bugbear
5+
"B",
86
# pycodestyle
97
"E",
108
# Pyflakes
119
"F",
12-
# pyupgrade
13-
"UP",
14-
# flake8-bugbear
15-
"B",
16-
# flake8-simplify
17-
"SIM",
1810
# isort
1911
"I",
12+
# flake8-simplify
13+
"SIM",
14+
# pyupgrade
15+
"UP",
2016
]
21-
extend-ignore = [
17+
lint.extend-ignore = [
2218
"E501", # line too long
2319
]
24-
fixable = ["ALL"]
20+
lint.fixable = [ "ALL" ]

examples/sanic/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# "sanic",
55
# ]
66
# [tool.uv.sources]
7-
# datastar-py = { path = "../../../sdk/python" }
7+
# datastar-py = { path = "../../" }
88
# ///
99

1010
import asyncio

0 commit comments

Comments
 (0)