python-fasthtml 0.4.0__tar.gz → 0.4.1__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.4.0/python_fasthtml.egg-info → python-fasthtml-0.4.1}/PKG-INFO +1 -1
- python-fasthtml-0.4.1/fasthtml/__init__.py +2 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/fasthtml/_modidx.py +1 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/fasthtml/components.py +1 -1
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/fasthtml/core.py +27 -16
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1/python_fasthtml.egg-info}/PKG-INFO +1 -1
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/settings.ini +1 -1
- python-fasthtml-0.4.0/fasthtml/__init__.py +0 -2
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/CONTRIBUTING.md +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/LICENSE +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/MANIFEST.in +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/README.md +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/fasthtml/authmw.py +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/fasthtml/basics.py +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/fasthtml/cli.py +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/fasthtml/common.py +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/fasthtml/components.pyi +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/fasthtml/fastapp.py +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/fasthtml/ft.py +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/fasthtml/js.py +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/fasthtml/katex.js +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/fasthtml/live_reload.py +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/fasthtml/oauth.py +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/fasthtml/starlette.py +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/fasthtml/svg.py +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/fasthtml/toaster.py +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/fasthtml/xtend.py +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/fasthtml/xtend.pyi +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/python_fasthtml.egg-info/SOURCES.txt +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/python_fasthtml.egg-info/dependency_links.txt +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/python_fasthtml.egg-info/entry_points.txt +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/python_fasthtml.egg-info/not-zip-safe +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/python_fasthtml.egg-info/requires.txt +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/python_fasthtml.egg-info/top_level.txt +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/setup.cfg +0 -0
- {python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/setup.py +0 -0
|
@@ -62,6 +62,7 @@ d = { 'settings': { 'branch': 'main',
|
|
|
62
62
|
'fasthtml.core._is_body': ('api/core.html#_is_body', 'fasthtml/core.py'),
|
|
63
63
|
'fasthtml.core._list': ('api/core.html#_list', 'fasthtml/core.py'),
|
|
64
64
|
'fasthtml.core._mk_list': ('api/core.html#_mk_list', 'fasthtml/core.py'),
|
|
65
|
+
'fasthtml.core._mk_locfunc': ('api/core.html#_mk_locfunc', 'fasthtml/core.py'),
|
|
65
66
|
'fasthtml.core._resp': ('api/core.html#_resp', 'fasthtml/core.py'),
|
|
66
67
|
'fasthtml.core._send_ws': ('api/core.html#_send_ws', 'fasthtml/core.py'),
|
|
67
68
|
'fasthtml.core._sig': ('api/core.html#_sig', 'fasthtml/core.py'),
|
|
@@ -85,7 +85,7 @@ def File(fname):
|
|
|
85
85
|
|
|
86
86
|
# %% ../nbs/api/01_components.ipynb
|
|
87
87
|
def _fill_item(item, obj):
|
|
88
|
-
if not isinstance(item,
|
|
88
|
+
if not isinstance(item,FT): return item
|
|
89
89
|
tag,cs,attr = item.list
|
|
90
90
|
if isinstance(cs,tuple): cs = tuple(_fill_item(o, obj) for o in cs)
|
|
91
91
|
name = attr.get('name', None)
|
|
@@ -18,7 +18,7 @@ from datetime import datetime
|
|
|
18
18
|
from dataclasses import dataclass,fields,is_dataclass,MISSING,asdict
|
|
19
19
|
from collections import namedtuple
|
|
20
20
|
from inspect import isfunction,ismethod,Parameter,get_annotations
|
|
21
|
-
from functools import wraps, partialmethod
|
|
21
|
+
from functools import wraps, partialmethod, update_wrapper
|
|
22
22
|
from http import cookies
|
|
23
23
|
from urllib.parse import urlencode, parse_qs, quote, unquote
|
|
24
24
|
from copy import copy,deepcopy
|
|
@@ -469,27 +469,38 @@ class FastHTML(Starlette):
|
|
|
469
469
|
self.router = RouterX(routes, on_startup=on_startup, on_shutdown=on_shutdown, lifespan=lifespan,
|
|
470
470
|
hdrs=hdrs, ftrs=ftrs, before=before, after=after, htmlkw=htmlkw, **bodykw)
|
|
471
471
|
|
|
472
|
-
def route(self, path:str=None, methods=None, name=None, include_in_schema=True):
|
|
473
|
-
"Add a route at `path`; the function name is the default method"
|
|
474
|
-
pathstr = None if callable(path) else path
|
|
475
|
-
def f(func):
|
|
476
|
-
n,fn,p = name,func.__name__,pathstr
|
|
477
|
-
assert path or (fn not in _verbs), "Must provide a path when using http verb-based function name"
|
|
478
|
-
if methods: m = [methods] if isinstance(methods,str) else methods
|
|
479
|
-
else: m = [fn] if fn in _verbs else ['get'] if fn=='index' else ['post']
|
|
480
|
-
if not n: n = fn
|
|
481
|
-
if not p: p = '/'+('' if fn=='index' else fn)
|
|
482
|
-
self.router.add_route(p, func, methods=m, name=n, include_in_schema=include_in_schema)
|
|
483
|
-
func.__routename__ = n
|
|
484
|
-
return func
|
|
485
|
-
return f(path) if callable(path) else f
|
|
486
|
-
|
|
487
472
|
def ws(self, path:str, conn=None, disconn=None, name=None):
|
|
488
473
|
def f(func):
|
|
489
474
|
self.router.add_ws(path, func, conn=conn, disconn=disconn, name=name)
|
|
490
475
|
return func
|
|
491
476
|
return f
|
|
492
477
|
|
|
478
|
+
# %% ../nbs/api/00_core.ipynb
|
|
479
|
+
def _mk_locfunc(f,p):
|
|
480
|
+
class _lf:
|
|
481
|
+
def __init__(self): update_wrapper(self, f)
|
|
482
|
+
def __call__(self, **kw): return p + (f'?{urlencode(kw)}' if kw else '')
|
|
483
|
+
def __str__(self): return p
|
|
484
|
+
return _lf()
|
|
485
|
+
|
|
486
|
+
# %% ../nbs/api/00_core.ipynb
|
|
487
|
+
@patch
|
|
488
|
+
def route(self:FastHTML, path:str=None, methods=None, name=None, include_in_schema=True):
|
|
489
|
+
"Add a route at `path`; the function name is the default method"
|
|
490
|
+
pathstr = None if callable(path) else path
|
|
491
|
+
def f(func):
|
|
492
|
+
n,fn,p = name,func.__name__,pathstr
|
|
493
|
+
assert path or (fn not in _verbs), "Must provide a path when using http verb-based function name"
|
|
494
|
+
if methods: m = [methods] if isinstance(methods,str) else methods
|
|
495
|
+
else: m = [fn] if fn in _verbs else ['get'] if fn=='index' else ['post']
|
|
496
|
+
if not n: n = fn
|
|
497
|
+
if not p: p = '/'+('' if fn=='index' else fn)
|
|
498
|
+
self.router.add_route(p, func, methods=m, name=n, include_in_schema=include_in_schema)
|
|
499
|
+
lf = _mk_locfunc(func, p)
|
|
500
|
+
lf.__routename__ = n
|
|
501
|
+
return lf
|
|
502
|
+
return f(path) if callable(path) else f
|
|
503
|
+
|
|
493
504
|
all_meths = 'get post put delete patch head trace options'.split()
|
|
494
505
|
for o in all_meths: setattr(FastHTML, o, partialmethod(FastHTML.route, methods=o))
|
|
495
506
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[DEFAULT]
|
|
2
2
|
repo = fasthtml
|
|
3
3
|
lib_name = fasthtml
|
|
4
|
-
version = 0.4.
|
|
4
|
+
version = 0.4.1
|
|
5
5
|
min_python = 3.10
|
|
6
6
|
license = apache2
|
|
7
7
|
requirements = fastcore>=1.7.0 python-dateutil starlette>0.33 oauthlib itsdangerous uvicorn[standard]>=0.30 httpx fastlite>=0.0.6 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
|
{python-fasthtml-0.4.0 → python-fasthtml-0.4.1}/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
|
|
File without changes
|