python-fasthtml 0.12.14__tar.gz → 0.12.16__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.12.14/python_fasthtml.egg-info → python_fasthtml-0.12.16}/PKG-INFO +1 -1
- python_fasthtml-0.12.16/fasthtml/__init__.py +2 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/_modidx.py +3 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/components.py +1 -1
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/core.py +25 -6
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/jupyter.py +5 -3
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/starlette.py +1 -1
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16/python_fasthtml.egg-info}/PKG-INFO +1 -1
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/settings.ini +1 -1
- python_fasthtml-0.12.14/fasthtml/__init__.py +0 -2
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/CONTRIBUTING.md +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/LICENSE +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/MANIFEST.in +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/README.md +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/authmw.py +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/basics.py +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/cli.py +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/common.py +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/components.pyi +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/core.pyi +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/fastapp.py +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/ft.py +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/js.py +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/katex.js +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/live_reload.py +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/oauth.py +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/pico.py +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/stripe_otp.py +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/svg.py +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/toaster.py +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/xtend.py +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/fasthtml/xtend.pyi +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/pyproject.toml +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/python_fasthtml.egg-info/SOURCES.txt +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/python_fasthtml.egg-info/dependency_links.txt +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/python_fasthtml.egg-info/entry_points.txt +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/python_fasthtml.egg-info/not-zip-safe +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/python_fasthtml.egg-info/requires.txt +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/python_fasthtml.egg-info/top_level.txt +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/setup.cfg +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/setup.py +0 -0
- {python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/tests/test_toaster.py +0 -0
|
@@ -45,6 +45,7 @@ d = { 'settings': { 'branch': 'main',
|
|
|
45
45
|
'fasthtml.core.FastHTML._add_ws': ('api/core.html#fasthtml._add_ws', 'fasthtml/core.py'),
|
|
46
46
|
'fasthtml.core.FastHTML._endp': ('api/core.html#fasthtml._endp', 'fasthtml/core.py'),
|
|
47
47
|
'fasthtml.core.FastHTML.add_route': ('api/core.html#fasthtml.add_route', 'fasthtml/core.py'),
|
|
48
|
+
'fasthtml.core.FastHTML.devtools_json': ('api/core.html#fasthtml.devtools_json', 'fasthtml/core.py'),
|
|
48
49
|
'fasthtml.core.FastHTML.route': ('api/core.html#fasthtml.route', 'fasthtml/core.py'),
|
|
49
50
|
'fasthtml.core.FastHTML.static_route': ('api/core.html#fasthtml.static_route', 'fasthtml/core.py'),
|
|
50
51
|
'fasthtml.core.FastHTML.static_route_exts': ('api/core.html#fasthtml.static_route_exts', 'fasthtml/core.py'),
|
|
@@ -58,6 +59,8 @@ d = { 'settings': { 'branch': 'main',
|
|
|
58
59
|
'fasthtml.core.HtmxHeaders.__bool__': ('api/core.html#htmxheaders.__bool__', 'fasthtml/core.py'),
|
|
59
60
|
'fasthtml.core.HtmxResponseHeaders': ('api/core.html#htmxresponseheaders', 'fasthtml/core.py'),
|
|
60
61
|
'fasthtml.core.HttpHeader': ('api/core.html#httpheader', 'fasthtml/core.py'),
|
|
62
|
+
'fasthtml.core.JSONResponse': ('api/core.html#jsonresponse', 'fasthtml/core.py'),
|
|
63
|
+
'fasthtml.core.JSONResponse.render': ('api/core.html#jsonresponse.render', 'fasthtml/core.py'),
|
|
61
64
|
'fasthtml.core.MiddlewareBase': ('api/core.html#middlewarebase', 'fasthtml/core.py'),
|
|
62
65
|
'fasthtml.core.MiddlewareBase.__call__': ('api/core.html#middlewarebase.__call__', 'fasthtml/core.py'),
|
|
63
66
|
'fasthtml.core.Redirect': ('api/core.html#redirect', 'fasthtml/core.py'),
|
|
@@ -33,7 +33,7 @@ except ImportError: display=None
|
|
|
33
33
|
|
|
34
34
|
# %% ../nbs/api/01_components.ipynb
|
|
35
35
|
@patch
|
|
36
|
-
def __str__(self:FT): return self.id if self.id else
|
|
36
|
+
def __str__(self:FT): return self.id if self.id else to_xml(self, indent=False)
|
|
37
37
|
|
|
38
38
|
# %% ../nbs/api/01_components.ipynb
|
|
39
39
|
@patch
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
# %% auto 0
|
|
6
6
|
__all__ = ['empty', 'htmx_hdrs', 'fh_cfg', 'htmx_resps', 'htmx_exts', 'htmxsrc', 'fhjsscr', 'surrsrc', 'scopesrc', 'viewport',
|
|
7
|
-
'charset', 'cors_allow', 'iframe_scr', 'all_meths', '
|
|
8
|
-
'HttpHeader', 'HtmxResponseHeaders', 'form2dict', 'parse_form', '
|
|
9
|
-
'
|
|
10
|
-
'
|
|
11
|
-
'reg_re_param', 'MiddlewareBase', 'FtResponse', 'unqid', 'setup_ws']
|
|
7
|
+
'charset', 'cors_allow', 'iframe_scr', 'all_meths', 'devtools_loc', 'parsed_date', 'snake2hyphens',
|
|
8
|
+
'HtmxHeaders', 'HttpHeader', 'HtmxResponseHeaders', 'form2dict', 'parse_form', 'JSONResponse', 'flat_xt',
|
|
9
|
+
'Beforeware', 'EventStream', 'signal_shutdown', 'uri', 'decode_uri', 'flat_tuple', 'noop_body', 'respond',
|
|
10
|
+
'Redirect', 'get_key', 'qp', 'def_hdrs', 'FastHTML', 'nested_name', 'serve', 'Client', 'RouteFuncs',
|
|
11
|
+
'APIRouter', 'cookie', 'reg_re_param', 'MiddlewareBase', 'FtResponse', 'unqid', 'setup_ws']
|
|
12
12
|
|
|
13
13
|
# %% ../nbs/api/00_core.ipynb
|
|
14
14
|
import json,uuid,inspect,types,signal,asyncio,threading,inspect
|
|
@@ -164,6 +164,13 @@ async def _from_body(req, p):
|
|
|
164
164
|
cargs = {k: _form_arg(k, v, d) for k, v in data.items() if not d or k in d}
|
|
165
165
|
return anno(**cargs)
|
|
166
166
|
|
|
167
|
+
# %% ../nbs/api/00_core.ipynb
|
|
168
|
+
class JSONResponse(JSONResponseOrig):
|
|
169
|
+
"Same as starlette's version, but auto-stringifies non serializable types"
|
|
170
|
+
def render(self, content: Any) -> bytes:
|
|
171
|
+
res = json.dumps(content, ensure_ascii=False, allow_nan=False, indent=None, separators=(",", ":"), default=str)
|
|
172
|
+
return res.encode("utf-8")
|
|
173
|
+
|
|
167
174
|
# %% ../nbs/api/00_core.ipynb
|
|
168
175
|
async def _find_p(req, arg:str, p:Parameter):
|
|
169
176
|
"In `req` find param named `arg` of type in `p` (`arg` is ignored for body types)"
|
|
@@ -436,6 +443,7 @@ async def _wrap_call(f, req, params):
|
|
|
436
443
|
|
|
437
444
|
# %% ../nbs/api/00_core.ipynb
|
|
438
445
|
htmx_exts = {
|
|
446
|
+
"morph": "https://cdn.jsdelivr.net/npm/idiomorph@0.7.3/dist/idiomorph-ext.min.js",
|
|
439
447
|
"head-support": "https://cdn.jsdelivr.net/npm/htmx-ext-head-support@2.0.3/head-support.js",
|
|
440
448
|
"preload": "https://cdn.jsdelivr.net/npm/htmx-ext-preload@2.1.0/preload.js",
|
|
441
449
|
"class-tools": "https://cdn.jsdelivr.net/npm/htmx-ext-class-tools@2.0.1/class-tools.js",
|
|
@@ -748,7 +756,7 @@ def reg_re_param(m, s):
|
|
|
748
756
|
# %% ../nbs/api/00_core.ipynb
|
|
749
757
|
# Starlette doesn't have the '?', so it chomps the whole remaining URL
|
|
750
758
|
reg_re_param("path", ".*?")
|
|
751
|
-
_static_exts = "ico gif jpg jpeg webm css js woff png svg mp4 webp ttf otf eot woff2 txt html map pdf zip tgz gz csv mp3 wav ogg flac aac doc docx xls xlsx ppt pptx epub mobi bmp tiff avi mov wmv mkv
|
|
759
|
+
_static_exts = "ico gif jpg jpeg webm css js woff png svg mp4 webp ttf otf eot woff2 txt html map pdf zip tgz gz csv mp3 wav ogg flac aac doc docx xls xlsx ppt pptx epub mobi bmp tiff avi mov wmv mkv xml yaml yml rar 7z tar bz2 htm xhtml apk dmg exe msi swf iso".split()
|
|
752
760
|
reg_re_param("static", '|'.join(_static_exts))
|
|
753
761
|
|
|
754
762
|
@patch
|
|
@@ -806,3 +814,14 @@ def setup_ws(app, f=noop):
|
|
|
806
814
|
for o in conns.values(): await o(s)
|
|
807
815
|
app._send = send
|
|
808
816
|
return send
|
|
817
|
+
|
|
818
|
+
# %% ../nbs/api/00_core.ipynb
|
|
819
|
+
devtools_loc = "/.well-known/appspecific/com.chrome.devtools.json"
|
|
820
|
+
|
|
821
|
+
@patch
|
|
822
|
+
def devtools_json(self:FastHTML, path=None, uuid=None):
|
|
823
|
+
if not path: path = Path().absolute()
|
|
824
|
+
if not uuid: uuid = get_key()
|
|
825
|
+
@self.route(devtools_loc)
|
|
826
|
+
def devtools():
|
|
827
|
+
return dict(workspace=dict(root=path, uuid=uuid))
|
|
@@ -10,6 +10,7 @@ __all__ = ['nb_serve', 'nb_serve_async', 'is_port_free', 'wait_port_free', 'show
|
|
|
10
10
|
import asyncio, socket, time, uvicorn
|
|
11
11
|
from threading import Thread
|
|
12
12
|
from fastcore.utils import *
|
|
13
|
+
from fastcore.meta import delegates
|
|
13
14
|
from .common import *
|
|
14
15
|
from .common import show as _show
|
|
15
16
|
from fastcore.parallel import startthread
|
|
@@ -54,10 +55,11 @@ def wait_port_free(port, host='localhost', max_wait=3):
|
|
|
54
55
|
time.sleep(0.1)
|
|
55
56
|
|
|
56
57
|
# %% ../nbs/api/06_jupyter.ipynb
|
|
57
|
-
|
|
58
|
+
@delegates(_show)
|
|
59
|
+
def show(*s, **kwargs):
|
|
58
60
|
"Same as fasthtml.components.show, but also adds `htmx.process()`"
|
|
59
|
-
if IN_NOTEBOOK: return _show(*s, Script('if (window.htmx) htmx.process(document.body)'))
|
|
60
|
-
return _show(*s)
|
|
61
|
+
if IN_NOTEBOOK: return _show(*s, Script('if (window.htmx) htmx.process(document.body)'), **kwargs)
|
|
62
|
+
return _show(*s, **kwargs)
|
|
61
63
|
|
|
62
64
|
# %% ../nbs/api/06_jupyter.ipynb
|
|
63
65
|
def render_ft():
|
|
@@ -6,7 +6,7 @@ from starlette.middleware.authentication import AuthenticationMiddleware
|
|
|
6
6
|
from starlette.authentication import AuthCredentials, AuthenticationBackend, AuthenticationError, SimpleUser, requires
|
|
7
7
|
from starlette.middleware.httpsredirect import HTTPSRedirectMiddleware
|
|
8
8
|
from starlette.middleware.trustedhost import TrustedHostMiddleware
|
|
9
|
-
from starlette.responses import Response, HTMLResponse, FileResponse, JSONResponse, RedirectResponse, StreamingResponse
|
|
9
|
+
from starlette.responses import Response, HTMLResponse, FileResponse, JSONResponse as JSONResponseOrig, RedirectResponse, StreamingResponse
|
|
10
10
|
from starlette.requests import Request, HTTPConnection, FormData
|
|
11
11
|
from starlette.staticfiles import StaticFiles
|
|
12
12
|
from starlette.exceptions import HTTPException
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[DEFAULT]
|
|
2
2
|
repo = fasthtml
|
|
3
3
|
lib_name = python-fasthtml
|
|
4
|
-
version = 0.12.
|
|
4
|
+
version = 0.12.16
|
|
5
5
|
min_python = 3.10
|
|
6
6
|
license = apache2
|
|
7
7
|
requirements = fastcore>=1.8.1 python-dateutil starlette>0.33 oauthlib itsdangerous uvicorn[standard]>=0.30 httpx fastlite>=0.1.1 python-multipart beautifulsoup4
|
|
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.12.14 → python_fasthtml-0.12.16}/python_fasthtml.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{python_fasthtml-0.12.14 → python_fasthtml-0.12.16}/python_fasthtml.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|