python-fasthtml 0.14.23__tar.gz → 0.14.25__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_fasthtml-0.14.23/python_fasthtml.egg-info → python_fasthtml-0.14.25}/PKG-INFO +1 -1
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/__init__.py +3 -2
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/core.py +5 -5
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/jupyter.py +10 -4
- python_fasthtml-0.14.25/fasthtml/skill.py +23 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/pyproject.toml +3 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25/python_fasthtml.egg-info}/PKG-INFO +1 -1
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/python_fasthtml.egg-info/SOURCES.txt +1 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/python_fasthtml.egg-info/entry_points.txt +3 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/CONTRIBUTING.md +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/LICENSE +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/MANIFEST.in +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/README.md +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/_modidx.py +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/authmw.py +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/basics.py +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/cli.py +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/common.py +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/components.py +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/components.pyi +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/core.pyi +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/fastapp.py +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/ft.py +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/js.py +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/katex.js +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/live_reload.py +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/oauth.py +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/pico.py +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/proxy.py +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/starlette.py +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/stripe_otp.py +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/svg.py +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/toaster.py +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/xtend.py +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/fasthtml/xtend.pyi +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/python_fasthtml.egg-info/dependency_links.txt +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/python_fasthtml.egg-info/requires.txt +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/python_fasthtml.egg-info/top_level.txt +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/setup.cfg +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/tests/test_fh.py +0 -0
- {python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/tests/test_proxy.py +0 -0
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Modules:
|
|
4
4
|
|
|
5
5
|
- `fasthtml.core`: The `FastHTML` subclass of `Starlette`.
|
|
6
|
-
- `fasthtml.proxy`: Streaming HTTP responses and bidirectional WebSocket forwarding
|
|
6
|
+
- `fasthtml.proxy`: Streaming HTTP responses and bidirectional WebSocket forwarding
|
|
7
|
+
- `fasthtml.skill`: Write and review idiomatic FastHTML apps."""
|
|
7
8
|
|
|
8
|
-
__version__ = "0.14.
|
|
9
|
+
__version__ = "0.14.25"
|
|
9
10
|
from .core import *
|
|
@@ -569,16 +569,16 @@ htmx_exts = {
|
|
|
569
569
|
"remove-me": "https://cdn.jsdelivr.net/npm/htmx-ext-remove-me@2.0.0/remove-me.js",
|
|
570
570
|
"debug": "https://unpkg.com/htmx.org@1.9.12/dist/ext/debug.js",
|
|
571
571
|
"ws": "https://cdn.jsdelivr.net/npm/htmx-ext-ws@2.0.3/ws.js",
|
|
572
|
-
"ws4": "https://cdn.jsdelivr.net/npm/htmx.org@4.0.
|
|
572
|
+
"ws4": "https://cdn.jsdelivr.net/npm/htmx.org@4.0.2/dist/ext/hx-ws.min.js",
|
|
573
573
|
"chunked-transfer": "https://cdn.jsdelivr.net/npm/htmx-ext-transfer-encoding-chunked@0.4.0/transfer-encoding-chunked.js",
|
|
574
|
-
"sse4": "https://cdn.jsdelivr.net/npm/htmx.org@4.0.
|
|
575
|
-
"live": "https://cdn.jsdelivr.net/npm/htmx.org@4.0.
|
|
576
|
-
"multipart": "https://cdn.jsdelivr.net/npm/htmx.org@4.0.
|
|
574
|
+
"sse4": "https://cdn.jsdelivr.net/npm/htmx.org@4.0.2/dist/ext/hx-sse.min.js",
|
|
575
|
+
"live": "https://cdn.jsdelivr.net/npm/htmx.org@4.0.2/dist/ext/hx-live.min.js",
|
|
576
|
+
"multipart": "https://cdn.jsdelivr.net/npm/htmx.org@4.0.2/dist/ext/hx-multipart.min.js"
|
|
577
577
|
}
|
|
578
578
|
|
|
579
579
|
# %% ../nbs/api/00_core.ipynb #60cb52ea
|
|
580
580
|
htmxsrc = Script(src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.js")
|
|
581
|
-
htmx4src = Script(src="https://cdn.jsdelivr.net/npm/htmx.org@4.0.
|
|
581
|
+
htmx4src = Script(src="https://cdn.jsdelivr.net/npm/htmx.org@4.0.2/dist/htmx.min.js")
|
|
582
582
|
fhjsscr = Script(src="https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js@1.0.13/fasthtml.js")
|
|
583
583
|
surrsrc = Script(src="https://cdn.jsdelivr.net/gh/answerdotai/surreal@main/surreal.js")
|
|
584
584
|
scopesrc = Script(src="https://cdn.jsdelivr.net/gh/gnat/css-scope-inline@main/script.js")
|
|
@@ -32,8 +32,14 @@ def nb_serve(app, log_level="error", port=8000, host='0.0.0.0', daemon=False, **
|
|
|
32
32
|
async def nb_serve_async(app, log_level="error", port=8000, host='0.0.0.0', **kwargs):
|
|
33
33
|
"Async version of `nb_serve`"
|
|
34
34
|
server = uvicorn.Server(uvicorn.Config(app, log_level=log_level, host=host, port=port, **kwargs))
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
async def serve():
|
|
36
|
+
try: await server.serve()
|
|
37
|
+
except SystemExit as e: raise RuntimeError(f'Uvicorn exited with status {e.code}') from e
|
|
38
|
+
server._serve_task = asyncio.get_running_loop().create_task(serve())
|
|
39
|
+
while not server.started and not server._serve_task.done(): await asyncio.sleep(0.01)
|
|
40
|
+
if not server.started:
|
|
41
|
+
await server._serve_task
|
|
42
|
+
raise RuntimeError('Server exited before startup completed')
|
|
37
43
|
return server
|
|
38
44
|
|
|
39
45
|
# %% ../nbs/api/06_jupyter.ipynb #654b36bb
|
|
@@ -150,10 +156,10 @@ def HTMX(path="/", host='localhost', app=None, port=8000, height="auto", link=Fa
|
|
|
150
156
|
def ws_client(app, nm='', host='localhost', port=8000, ws_connect='/ws', frame=True, link=True, **kwargs):
|
|
151
157
|
path = f'/{nm}'
|
|
152
158
|
c = Main('', cls="container", id=unqid())
|
|
159
|
+
ws_attrs = dict(hx_ws_connect=ws_connect) if app.htmx4 else dict(hx_ext='ws', ws_connect=ws_connect)
|
|
153
160
|
@app.get(path)
|
|
154
161
|
def f():
|
|
155
|
-
return Div(c, id=nm or '_dest', hx_trigger='load',
|
|
156
|
-
hx_ext="ws", ws_connect=ws_connect, **kwargs)
|
|
162
|
+
return Div(c, id=nm or '_dest', hx_trigger='load', **ws_attrs, **kwargs)
|
|
157
163
|
if link: display(HTML(f'<a href="http://{host}:{port}{path}" target="_blank">open in browser</a>'))
|
|
158
164
|
if frame: display(HTMX(path, host=host, port=port))
|
|
159
165
|
def send(o): asyncio.create_task(app._send(o))
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# NB: this file is designed for an LLM reader, not a human. Add it to your LLM's context and ask it to explain.
|
|
2
|
+
r"""Write and review idiomatic FastHTML apps.
|
|
3
|
+
|
|
4
|
+
## Read first
|
|
5
|
+
|
|
6
|
+
- index: https://www.fastht.ml/docs/llms.txt
|
|
7
|
+
- concise guide: https://www.fastht.ml/docs/ref/concise_guide.html.md
|
|
8
|
+
- handlers, binding, responses: https://www.fastht.ml/docs/ref/handlers.html.md
|
|
9
|
+
- routing: https://www.fastht.ml/docs/explains/routes.html.md
|
|
10
|
+
- role model: `examples/adv_app_strip.py`; https://raw.githubusercontent.com/AnswerDotAI/fasthtml/main/examples/adv_app_strip.py
|
|
11
|
+
|
|
12
|
+
## Idioms
|
|
13
|
+
|
|
14
|
+
- FT: Python call; positional children, keyword attributes; return FT or tuple. No templates, serializers or JSON-rendering pipeline.
|
|
15
|
+
- `@rt`: function-name path; GET+POST default. Normally no verb restrictions. When needed, `@rt('/x')` + `def get(...)` infers GET; no redundant `methods=`.
|
|
16
|
+
- handler references: `hx_post=save`, `href=edit.to(id=record.id)`; no copied URL strings
|
|
17
|
+
- typed handler arguments bind form/query fields; `req`, `sess`, `auth` injected. No FastAPI `Depends`, `Form`, `response_model`.
|
|
18
|
+
- HTMX action → FT fragment; `target_id`, `hx_swap` on caller. Normal requests gain document boilerplate.
|
|
19
|
+
- components: small functions; record rendering: `__ft__`. No controller/form-class framework.
|
|
20
|
+
- `Titled`: title+H1+Container
|
|
21
|
+
- shared auth: Beforeware; authorize actions as well as pages
|
|
22
|
+
- `from fasthtml.common import *`; `app,rt = fast_app()`; `serve()`; no `__main__` guard
|
|
23
|
+
"""
|
|
@@ -21,6 +21,9 @@ Documentation = "https://www.fastht.ml/docs/"
|
|
|
21
21
|
[project.entry-points.nbdev]
|
|
22
22
|
fasthtml = "fasthtml._modidx:d"
|
|
23
23
|
|
|
24
|
+
[project.entry-points.pyskills]
|
|
25
|
+
fasthtml = "fasthtml.skill"
|
|
26
|
+
|
|
24
27
|
[project.optional-dependencies]
|
|
25
28
|
dev = ['ipython', 'lxml', 'pysym2md>=0.0.6', 'monsterui', 'PyJWT', 'fastlite', 'pytest-asyncio']
|
|
26
29
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_fasthtml-0.14.23 → python_fasthtml-0.14.25}/python_fasthtml.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|