python-fasthtml 0.3.6__tar.gz → 0.3.7__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.3.6 → python-fasthtml-0.3.7}/MANIFEST.in +2 -2
- {python-fasthtml-0.3.6/python_fasthtml.egg-info → python-fasthtml-0.3.7}/PKG-INFO +1 -1
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/__init__.py +1 -1
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/core.py +5 -2
- python-fasthtml-0.3.7/fasthtml/katex.js +23 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7/python_fasthtml.egg-info}/PKG-INFO +1 -1
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/python_fasthtml.egg-info/SOURCES.txt +1 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/settings.ini +1 -1
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/CONTRIBUTING.md +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/LICENSE +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/README.md +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/_modidx.py +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/authmw.py +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/cli.py +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/common.py +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/components.py +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/components.pyi +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/fastapp.py +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/ft.py +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/js.py +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/live_reload.py +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/oauth.py +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/starlette.py +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/svg.py +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/toaster.py +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/xtend.py +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/xtend.pyi +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/python_fasthtml.egg-info/dependency_links.txt +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/python_fasthtml.egg-info/entry_points.txt +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/python_fasthtml.egg-info/not-zip-safe +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/python_fasthtml.egg-info/requires.txt +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/python_fasthtml.egg-info/top_level.txt +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/setup.cfg +0 -0
- {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/setup.py +0 -0
|
@@ -499,7 +499,10 @@ def serve(
|
|
|
499
499
|
app='app', # App instance to be served
|
|
500
500
|
host='0.0.0.0', # If host is 0.0.0.0 will convert to localhost
|
|
501
501
|
port=None, # If port is None it will default to 5001 or the PORT environment variable
|
|
502
|
-
reload=True
|
|
502
|
+
reload=True, # Default is to reload the app upon code changes
|
|
503
|
+
reload_includes:list[str]|str|None=None, # Additional files to watch for changes
|
|
504
|
+
reload_excludes:list[str]|str|None=None # Files to ignore for changes
|
|
505
|
+
):
|
|
503
506
|
"Run the app in an async server, with live reload set as the default."
|
|
504
507
|
bk = inspect.currentframe().f_back
|
|
505
508
|
glb = bk.f_globals
|
|
@@ -510,7 +513,7 @@ def serve(
|
|
|
510
513
|
if appname:
|
|
511
514
|
if not port: port=int(os.getenv("PORT", default=5001))
|
|
512
515
|
print(f'Link: http://{"localhost" if host=="0.0.0.0" else host}:{port}')
|
|
513
|
-
uvicorn.run(f'{appname}:{app}', host=host, port=port, reload=reload)
|
|
516
|
+
uvicorn.run(f'{appname}:{app}', host=host, port=port, reload=reload, reload_includes=reload_includes, reload_excludes=reload_excludes)
|
|
514
517
|
|
|
515
518
|
# %% ../nbs/api/00_core.ipynb
|
|
516
519
|
def cookie(key: str, value="", max_age=None, expires=None, path="/", domain=None, secure=False, httponly=False, samesite="lax",):
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { marked } from "https://cdn.jsdelivr.net/npm/marked/lib/marked.esm.js";
|
|
2
|
+
import { proc_htmx } from "https://cdn.jsdelivr.net/gh/answerdotai/fasthtml-js/fasthtml.js";
|
|
3
|
+
import katex from "https://cdn.jsdelivr.net/npm/katex/dist/katex.mjs";
|
|
4
|
+
|
|
5
|
+
const renderMath = (tex, displayMode) => { return katex.renderToString(tex, {
|
|
6
|
+
throwOnError: false, displayMode: displayMode, output: 'html', trust: true
|
|
7
|
+
}) };
|
|
8
|
+
|
|
9
|
+
const processLatexEnvironments = (content) => {
|
|
10
|
+
return content.replace(/\\begin{(\w+)}([\s\S]*?)\\end{\1}/g, (match, env, innerContent) => {
|
|
11
|
+
if ([{env_list}].includes(env)) { return `{display_delim}${match}{display_delim}`; }
|
|
12
|
+
return match;
|
|
13
|
+
}) };
|
|
14
|
+
|
|
15
|
+
proc_htmx('{sel}', e => {
|
|
16
|
+
let content = processLatexEnvironments(e.textContent);
|
|
17
|
+
// Display math (including environments)
|
|
18
|
+
content = content.replace(/{display_delim}([\s\S]+?){display_delim}/gm, (_, tex) => renderMath(tex.trim(), true));
|
|
19
|
+
// Inline math
|
|
20
|
+
content = content.replace(/(?<!\w){inline_delim}([^{inline_delim}\s](?:[^{inline_delim}]*[^{inline_delim}\s])?){inline_delim}(?!\w)/g, (_, tex) => renderMath(tex.trim(), false));
|
|
21
|
+
e.innerHTML = marked.parse(content);
|
|
22
|
+
});
|
|
23
|
+
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[DEFAULT]
|
|
2
2
|
repo = fasthtml
|
|
3
3
|
lib_name = fasthtml
|
|
4
|
-
version = 0.3.
|
|
4
|
+
version = 0.3.7
|
|
5
5
|
min_python = 3.10
|
|
6
6
|
license = apache2
|
|
7
7
|
requirements = fastcore>=1.6.9 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
|
{python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/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
|