python-fasthtml 0.14.24__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.
Files changed (41) hide show
  1. {python_fasthtml-0.14.24/python_fasthtml.egg-info → python_fasthtml-0.14.25}/PKG-INFO +1 -1
  2. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/__init__.py +3 -2
  3. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/core.py +5 -5
  4. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/jupyter.py +2 -2
  5. python_fasthtml-0.14.25/fasthtml/skill.py +23 -0
  6. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/pyproject.toml +3 -0
  7. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25/python_fasthtml.egg-info}/PKG-INFO +1 -1
  8. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/python_fasthtml.egg-info/SOURCES.txt +1 -0
  9. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/python_fasthtml.egg-info/entry_points.txt +3 -0
  10. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/CONTRIBUTING.md +0 -0
  11. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/LICENSE +0 -0
  12. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/MANIFEST.in +0 -0
  13. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/README.md +0 -0
  14. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/_modidx.py +0 -0
  15. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/authmw.py +0 -0
  16. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/basics.py +0 -0
  17. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/cli.py +0 -0
  18. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/common.py +0 -0
  19. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/components.py +0 -0
  20. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/components.pyi +0 -0
  21. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/core.pyi +0 -0
  22. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/fastapp.py +0 -0
  23. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/ft.py +0 -0
  24. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/js.py +0 -0
  25. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/katex.js +0 -0
  26. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/live_reload.py +0 -0
  27. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/oauth.py +0 -0
  28. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/pico.py +0 -0
  29. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/proxy.py +0 -0
  30. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/starlette.py +0 -0
  31. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/stripe_otp.py +0 -0
  32. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/svg.py +0 -0
  33. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/toaster.py +0 -0
  34. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/xtend.py +0 -0
  35. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/fasthtml/xtend.pyi +0 -0
  36. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/python_fasthtml.egg-info/dependency_links.txt +0 -0
  37. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/python_fasthtml.egg-info/requires.txt +0 -0
  38. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/python_fasthtml.egg-info/top_level.txt +0 -0
  39. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/setup.cfg +0 -0
  40. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/tests/test_fh.py +0 -0
  41. {python_fasthtml-0.14.24 → python_fasthtml-0.14.25}/tests/test_proxy.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-fasthtml
3
- Version: 0.14.24
3
+ Version: 0.14.25
4
4
  Summary: The fastest way to create an HTML app
5
5
  Author-email: Jeremy Howard and contributors <github@jhoward.fastmail.fm>
6
6
  License-Expression: Apache-2.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.24"
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.1/dist/ext/hx-ws.min.js",
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.1/dist/ext/hx-sse.min.js",
575
- "live": "https://cdn.jsdelivr.net/npm/htmx.org@4.0.1/dist/ext/hx-live.min.js",
576
- "multipart": "https://cdn.jsdelivr.net/npm/htmx.org@4.0.1/dist/ext/hx-multipart.min.js"
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.1/dist/htmx.min.js")
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")
@@ -156,10 +156,10 @@ def HTMX(path="/", host='localhost', app=None, port=8000, height="auto", link=Fa
156
156
  def ws_client(app, nm='', host='localhost', port=8000, ws_connect='/ws', frame=True, link=True, **kwargs):
157
157
  path = f'/{nm}'
158
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)
159
160
  @app.get(path)
160
161
  def f():
161
- return Div(c, id=nm or '_dest', hx_trigger='load',
162
- hx_ext="ws", ws_connect=ws_connect, **kwargs)
162
+ return Div(c, id=nm or '_dest', hx_trigger='load', **ws_attrs, **kwargs)
163
163
  if link: display(HTML(f'<a href="http://{host}:{port}{path}" target="_blank">open in browser</a>'))
164
164
  if frame: display(HTMX(path, host=host, port=port))
165
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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-fasthtml
3
- Version: 0.14.24
3
+ Version: 0.14.25
4
4
  Summary: The fastest way to create an HTML app
5
5
  Author-email: Jeremy Howard and contributors <github@jhoward.fastmail.fm>
6
6
  License-Expression: Apache-2.0
@@ -22,6 +22,7 @@ fasthtml/live_reload.py
22
22
  fasthtml/oauth.py
23
23
  fasthtml/pico.py
24
24
  fasthtml/proxy.py
25
+ fasthtml/skill.py
25
26
  fasthtml/starlette.py
26
27
  fasthtml/stripe_otp.py
27
28
  fasthtml/svg.py
@@ -4,3 +4,6 @@ fh_railway_link = fasthtml.cli:railway_link
4
4
 
5
5
  [nbdev]
6
6
  fasthtml = fasthtml._modidx:d
7
+
8
+ [pyskills]
9
+ fasthtml = fasthtml.skill