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.
Files changed (34) hide show
  1. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/MANIFEST.in +2 -2
  2. {python-fasthtml-0.3.6/python_fasthtml.egg-info → python-fasthtml-0.3.7}/PKG-INFO +1 -1
  3. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/__init__.py +1 -1
  4. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/core.py +5 -2
  5. python-fasthtml-0.3.7/fasthtml/katex.js +23 -0
  6. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7/python_fasthtml.egg-info}/PKG-INFO +1 -1
  7. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/python_fasthtml.egg-info/SOURCES.txt +1 -0
  8. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/settings.ini +1 -1
  9. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/CONTRIBUTING.md +0 -0
  10. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/LICENSE +0 -0
  11. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/README.md +0 -0
  12. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/_modidx.py +0 -0
  13. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/authmw.py +0 -0
  14. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/cli.py +0 -0
  15. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/common.py +0 -0
  16. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/components.py +0 -0
  17. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/components.pyi +0 -0
  18. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/fastapp.py +0 -0
  19. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/ft.py +0 -0
  20. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/js.py +0 -0
  21. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/live_reload.py +0 -0
  22. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/oauth.py +0 -0
  23. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/starlette.py +0 -0
  24. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/svg.py +0 -0
  25. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/toaster.py +0 -0
  26. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/xtend.py +0 -0
  27. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/fasthtml/xtend.pyi +0 -0
  28. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/python_fasthtml.egg-info/dependency_links.txt +0 -0
  29. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/python_fasthtml.egg-info/entry_points.txt +0 -0
  30. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/python_fasthtml.egg-info/not-zip-safe +0 -0
  31. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/python_fasthtml.egg-info/requires.txt +0 -0
  32. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/python_fasthtml.egg-info/top_level.txt +0 -0
  33. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/setup.cfg +0 -0
  34. {python-fasthtml-0.3.6 → python-fasthtml-0.3.7}/setup.py +0 -0
@@ -1,5 +1,5 @@
1
- include *.pyi
2
- include *.js
1
+ include fasthtml/*.pyi
2
+ include fasthtml/*.js
3
3
  include settings.ini
4
4
  include LICENSE
5
5
  include CONTRIBUTING.md
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-fasthtml
3
- Version: 0.3.6
3
+ Version: 0.3.7
4
4
  Summary: The fastest way to create an HTML app
5
5
  Home-page: https://github.com/AnswerDotAI/fasthtml
6
6
  Author: Jeremy Howard
@@ -1,4 +1,4 @@
1
- __version__ = "0.3.6"
1
+ __version__ = "0.3.7"
2
2
  from .core import *
3
3
  from .authmw import *
4
4
  from .components import *
@@ -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): # Default is to reload the app upon code changes
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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-fasthtml
3
- Version: 0.3.6
3
+ Version: 0.3.7
4
4
  Summary: The fastest way to create an HTML app
5
5
  Home-page: https://github.com/AnswerDotAI/fasthtml
6
6
  Author: Jeremy Howard
@@ -15,6 +15,7 @@ fasthtml/core.py
15
15
  fasthtml/fastapp.py
16
16
  fasthtml/ft.py
17
17
  fasthtml/js.py
18
+ fasthtml/katex.js
18
19
  fasthtml/live_reload.py
19
20
  fasthtml/oauth.py
20
21
  fasthtml/starlette.py
@@ -1,7 +1,7 @@
1
1
  [DEFAULT]
2
2
  repo = fasthtml
3
3
  lib_name = fasthtml
4
- version = 0.3.6
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