Spaces:
Running
Running
chore: Update fasthtml to 0.8.0
Browse files- README.md +12 -9
- pyproject.toml +18 -1
- src/tutorial/__init__.py +0 -1
- uv.lock +0 -0
README.md
CHANGED
|
@@ -17,21 +17,24 @@ Visit the site [here](https://phihung-htmx-examples.hf.space)
|
|
| 17 |
|
| 18 |
Github: [link](https://github.com/phihung/fasthtml_examples)
|
| 19 |
|
| 20 |
-
Run
|
| 21 |
|
| 22 |
```bash
|
| 23 |
-
# Local
|
| 24 |
uv sync
|
| 25 |
-
uv run
|
| 26 |
|
| 27 |
-
|
| 28 |
-
docker build -t htmx_examples .
|
| 29 |
-
docker run --rm -p 5001:5001 -it htmx_examples
|
| 30 |
```
|
| 31 |
|
| 32 |
-
|
| 33 |
|
| 34 |
```bash
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
```
|
|
|
|
| 17 |
|
| 18 |
Github: [link](https://github.com/phihung/fasthtml_examples)
|
| 19 |
|
| 20 |
+
**Run**
|
| 21 |
|
| 22 |
```bash
|
|
|
|
| 23 |
uv sync
|
| 24 |
+
alias tom="uv run tom"
|
| 25 |
|
| 26 |
+
tom dev
|
|
|
|
|
|
|
| 27 |
```
|
| 28 |
|
| 29 |
+
**Dev**
|
| 30 |
|
| 31 |
```bash
|
| 32 |
+
# List command
|
| 33 |
+
tom
|
| 34 |
+
|
| 35 |
+
# Run test
|
| 36 |
+
tom test
|
| 37 |
+
|
| 38 |
+
# Build and run docker
|
| 39 |
+
tom docker
|
| 40 |
```
|
pyproject.toml
CHANGED
|
@@ -4,7 +4,7 @@ version = "0.1.0"
|
|
| 4 |
description = "Add your description here"
|
| 5 |
readme = "README.md"
|
| 6 |
requires-python = ">=3.11"
|
| 7 |
-
dependencies = ["fh-utils>=0.4.0", "python-fasthtml>=0.
|
| 8 |
|
| 9 |
[project.scripts]
|
| 10 |
start_tutorial = "tutorial:start"
|
|
@@ -22,6 +22,7 @@ dev-dependencies = [
|
|
| 22 |
"pytest-playwright>=0.5.2",
|
| 23 |
"pytest>=8.3.2",
|
| 24 |
"ruff>=0.6.3",
|
|
|
|
| 25 |
# "devicorn",
|
| 26 |
]
|
| 27 |
|
|
@@ -35,3 +36,19 @@ target-version = "py311"
|
|
| 35 |
|
| 36 |
[tool.pytest.ini_options]
|
| 37 |
addopts = "--base-url http://0.0.0.0:5001"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
description = "Add your description here"
|
| 5 |
readme = "README.md"
|
| 6 |
requires-python = ">=3.11"
|
| 7 |
+
dependencies = ["fh-utils>=0.4.0", "python-fasthtml>=0.8"]
|
| 8 |
|
| 9 |
[project.scripts]
|
| 10 |
start_tutorial = "tutorial:start"
|
|
|
|
| 22 |
"pytest-playwright>=0.5.2",
|
| 23 |
"pytest>=8.3.2",
|
| 24 |
"ruff>=0.6.3",
|
| 25 |
+
"tomlscript>=0.2.0",
|
| 26 |
# "devicorn",
|
| 27 |
]
|
| 28 |
|
|
|
|
| 36 |
|
| 37 |
[tool.pytest.ini_options]
|
| 38 |
addopts = "--base-url http://0.0.0.0:5001"
|
| 39 |
+
|
| 40 |
+
[tool.tomlscript]
|
| 41 |
+
# Lint and test
|
| 42 |
+
test = """
|
| 43 |
+
uv run ruff check
|
| 44 |
+
uv run pytest
|
| 45 |
+
"""
|
| 46 |
+
|
| 47 |
+
# Start dev server
|
| 48 |
+
dev = "uv run fh_utils dev src/tutorial --app get_app --factory --live"
|
| 49 |
+
|
| 50 |
+
# Run in docker
|
| 51 |
+
docker = """
|
| 52 |
+
docker build -t htmx_examples .
|
| 53 |
+
docker run --rm -p 5001:5001 -it htmx_examples
|
| 54 |
+
"""
|
src/tutorial/__init__.py
CHANGED
|
@@ -73,7 +73,6 @@ class RequestInfo:
|
|
| 73 |
@app.put("/requests")
|
| 74 |
def requests(r: RequestInfo):
|
| 75 |
headers = json.loads(r.headers)
|
| 76 |
-
print(headers)
|
| 77 |
headers = {
|
| 78 |
k: v for k, v in headers.items() if k in ("HX-Trigger", "HX-Trigger-Name", "HX-Target", "HX-Prompt") and v
|
| 79 |
}
|
|
|
|
| 73 |
@app.put("/requests")
|
| 74 |
def requests(r: RequestInfo):
|
| 75 |
headers = json.loads(r.headers)
|
|
|
|
| 76 |
headers = {
|
| 77 |
k: v for k, v in headers.items() if k in ("HX-Trigger", "HX-Trigger-Name", "HX-Target", "HX-Prompt") and v
|
| 78 |
}
|
uv.lock
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|