python-fasthtml 0.14.0__tar.gz → 0.14.2__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 (39) hide show
  1. {python_fasthtml-0.14.0/python_fasthtml.egg-info → python_fasthtml-0.14.2}/PKG-INFO +2 -2
  2. python_fasthtml-0.14.2/fasthtml/__init__.py +2 -0
  3. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/_modidx.py +2 -0
  4. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/components.py +3 -1
  5. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/core.py +4 -2
  6. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/js.py +3 -1
  7. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/jupyter.py +24 -5
  8. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/oauth.py +3 -1
  9. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/pico.py +3 -1
  10. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/stripe_otp.py +2 -0
  11. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/svg.py +3 -1
  12. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/xtend.py +3 -1
  13. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/pyproject.toml +1 -1
  14. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2/python_fasthtml.egg-info}/PKG-INFO +2 -2
  15. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/python_fasthtml.egg-info/requires.txt +1 -1
  16. python_fasthtml-0.14.0/fasthtml/__init__.py +0 -2
  17. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/CONTRIBUTING.md +0 -0
  18. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/LICENSE +0 -0
  19. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/MANIFEST.in +0 -0
  20. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/README.md +0 -0
  21. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/authmw.py +0 -0
  22. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/basics.py +0 -0
  23. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/cli.py +0 -0
  24. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/common.py +0 -0
  25. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/components.pyi +0 -0
  26. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/core.pyi +0 -0
  27. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/fastapp.py +0 -0
  28. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/ft.py +0 -0
  29. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/katex.js +0 -0
  30. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/live_reload.py +0 -0
  31. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/starlette.py +0 -0
  32. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/toaster.py +0 -0
  33. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/fasthtml/xtend.pyi +0 -0
  34. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/python_fasthtml.egg-info/SOURCES.txt +0 -0
  35. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/python_fasthtml.egg-info/dependency_links.txt +0 -0
  36. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/python_fasthtml.egg-info/entry_points.txt +0 -0
  37. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/python_fasthtml.egg-info/top_level.txt +0 -0
  38. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/setup.cfg +0 -0
  39. {python_fasthtml-0.14.0 → python_fasthtml-0.14.2}/tests/test_toaster.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-fasthtml
3
- Version: 0.14.0
3
+ Version: 0.14.2
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: Apache-2.0
@@ -17,7 +17,7 @@ Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
18
  Requires-Dist: fastcore>=1.12.45
19
19
  Requires-Dist: python-dateutil
20
- Requires-Dist: starlette~=1.0
20
+ Requires-Dist: starlette>=1.0.1
21
21
  Requires-Dist: oauthlib
22
22
  Requires-Dist: itsdangerous
23
23
  Requires-Dist: uvicorn[standard]>=0.30
@@ -0,0 +1,2 @@
1
+ __version__ = "0.14.2"
2
+ from .core import *
@@ -173,6 +173,8 @@ d = { 'settings': { 'branch': 'main',
173
173
  'fasthtml.jupyter': { 'fasthtml.jupyter.HTMX': ('api/jupyter.html#htmx', 'fasthtml/jupyter.py'),
174
174
  'fasthtml.jupyter.JupyUvi': ('api/jupyter.html#jupyuvi', 'fasthtml/jupyter.py'),
175
175
  'fasthtml.jupyter.JupyUvi.__init__': ('api/jupyter.html#jupyuvi.__init__', 'fasthtml/jupyter.py'),
176
+ 'fasthtml.jupyter.JupyUvi._live_sse': ('api/jupyter.html#jupyuvi._live_sse', 'fasthtml/jupyter.py'),
177
+ 'fasthtml.jupyter.JupyUvi._setup_live': ('api/jupyter.html#jupyuvi._setup_live', 'fasthtml/jupyter.py'),
176
178
  'fasthtml.jupyter.JupyUvi.start': ('api/jupyter.html#jupyuvi.start', 'fasthtml/jupyter.py'),
177
179
  'fasthtml.jupyter.JupyUvi.start_async': ('api/jupyter.html#jupyuvi.start_async', 'fasthtml/jupyter.py'),
178
180
  'fasthtml.jupyter.JupyUvi.stop': ('api/jupyter.html#jupyuvi.stop', 'fasthtml/jupyter.py'),
@@ -1,4 +1,6 @@
1
- """`ft_html` and `ft_hx` functions to add some conveniences to `ft`, along with a full set of basic HTML components, and functions to work with forms and `FT` conversion"""
1
+ """`ft_html` and `ft_hx` functions to add some conveniences to `ft`, along with a full set of basic HTML components, and functions to work with forms and `FT` conversion
2
+
3
+ Docs: https://www.fastht.ml/docsapi/components.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/01_components.ipynb.
4
6
 
@@ -1,4 +1,6 @@
1
- """The `FastHTML` subclass of `Starlette`."""
1
+ """The `FastHTML` subclass of `Starlette`.
2
+
3
+ Docs: https://www.fastht.ml/docsapi/core.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/00_core.ipynb.
4
6
 
@@ -810,7 +812,7 @@ def serve(
810
812
  if not port: port=int(os.getenv("PORT", default=5001))
811
813
  link = f'http://{"localhost" if host=="0.0.0.0" else host}:{port}'
812
814
  print('Link: '+ S.light_red.bold(link))
813
- uvicorn.run(f'{appname}:{app}', host=host, port=port, reload=reload, **kwargs)
815
+ run(f'{appname}:{app}', host=host, port=port, reload=reload, **kwargs)
814
816
 
815
817
  # %% ../nbs/api/00_core.ipynb #8121968a
816
818
  class Client:
@@ -1,4 +1,6 @@
1
- """Basic external Javascript lib wrappers"""
1
+ """Basic external Javascript lib wrappers
2
+
3
+ Docs: https://www.fastht.ml/docsapi/js.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/03_js.ipynb.
4
6
 
@@ -1,4 +1,6 @@
1
- """Use FastHTML in Jupyter notebooks"""
1
+ """Use FastHTML in Jupyter notebooks
2
+
3
+ Docs: https://www.fastht.ml/docsapi/jupyter.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/06_jupyter.ipynb.
4
6
 
@@ -79,16 +81,18 @@ document.body.addEventListener('htmx:configRequest', (event) => {
79
81
  });
80
82
  </script>''' % port))
81
83
 
82
- # %% ../nbs/api/06_jupyter.ipynb #29a834a5
84
+ # %% ../nbs/api/06_jupyter.ipynb #79406618
83
85
  class JupyUvi:
84
86
  "Start and stop a Jupyter compatible uvicorn server with ASGI `app` on `port` with `log_level`"
85
- def __init__(self, app, log_level="error", host='0.0.0.0', port=8000, start=True, daemon=False, **kwargs):
87
+ def __init__(self, app, log_level="error", host='0.0.0.0', port=8000, start=True, live=False, live_rt='/_lr', daemon=False, **kwargs):
86
88
  self.kwargs = kwargs
87
- store_attr(but='start')
89
+ store_attr(but='start,live')
88
90
  self.server = None
91
+ self._live_ver = 0
92
+ if live: self._setup_live(app)
89
93
  if start: self.start()
90
94
  if not os.environ.get('IN_SOLVEIT'): htmx_config_port(port)
91
-
95
+
92
96
  def start(self):
93
97
  self.server = nb_serve(self.app, log_level=self.log_level, host=self.host, port=self.port,daemon=self.daemon, **self.kwargs)
94
98
 
@@ -99,6 +103,21 @@ class JupyUvi:
99
103
  self.server.should_exit = True
100
104
  wait_port_free(self.port)
101
105
 
106
+ def _setup_live(self, app):
107
+ rt = self.live_rt or '/_lr'
108
+ if not rt.startswith('/'): rt = f'/{rt}'
109
+ app.hdrs.append(Script(f"new EventSource({rt!r}).onmessage=e=>{{if(e.data==='reload')navigation.reload()}}"))
110
+ @app.get(rt)
111
+ async def _sse(): return EventStream(self._live_sse())
112
+ get_ipython().events.register('post_run_cell', lambda _: setattr(self, '_live_ver', self._live_ver+1))
113
+
114
+ async def _live_sse(self):
115
+ ver = self._live_ver
116
+ while not self.server.should_exit:
117
+ await asyncio.sleep(0.1)
118
+ if ver != self._live_ver:
119
+ ver = self._live_ver
120
+ yield 'data: reload\n\n'
102
121
 
103
122
  # %% ../nbs/api/06_jupyter.ipynb #9134035e
104
123
  class JupyUviAsync(JupyUvi):
@@ -1,4 +1,6 @@
1
- """Basic scaffolding for handling OAuth"""
1
+ """Basic scaffolding for handling OAuth
2
+
3
+ Docs: https://www.fastht.ml/docsapi/oauth.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/08_oauth.ipynb.
4
6
 
@@ -1,4 +1,6 @@
1
- """Basic components for generating Pico CSS tags"""
1
+ """Basic components for generating Pico CSS tags
2
+
3
+ Docs: https://www.fastht.ml/docsapi/pico.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/04_pico.ipynb.
4
6
 
@@ -1,3 +1,5 @@
1
+ """Docs: https://www.fastht.ml/docsexplains/stripe.html.md"""
2
+
1
3
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/explains/Stripe.ipynb.
2
4
 
3
5
  # %% auto #0
@@ -1,4 +1,6 @@
1
- """Simple SVG FT elements"""
1
+ """Simple SVG FT elements
2
+
3
+ Docs: https://www.fastht.ml/docsapi/svg.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/05_svg.ipynb.
4
6
 
@@ -1,4 +1,6 @@
1
- """Simple extensions to standard HTML components, such as adding sensible defaults"""
1
+ """Simple extensions to standard HTML components, such as adding sensible defaults
2
+
3
+ Docs: https://www.fastht.ml/docsapi/xtend.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/02_xtend.ipynb.
4
6
 
@@ -12,7 +12,7 @@ license = {text = "Apache-2.0"}
12
12
  authors = [{name = "Jeremy Howard and contributors", email = "github@jhoward.fastmail.fm"}]
13
13
  keywords = ['nbdev', 'jupyter', 'notebook', 'python']
14
14
  classifiers = ["Natural Language :: English", "Intended Audience :: Developers", "Development Status :: 3 - Alpha", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only"]
15
- dependencies = ['fastcore>=1.12.45', 'python-dateutil', 'starlette~=1.0', 'oauthlib', 'itsdangerous', 'uvicorn[standard]>=0.30', 'httpx', 'fastlite>=0.1.1', 'python-multipart', 'beautifulsoup4']
15
+ dependencies = ['fastcore>=1.12.45', 'python-dateutil', 'starlette>=1.0.1', 'oauthlib', 'itsdangerous', 'uvicorn[standard]>=0.30', 'httpx', 'fastlite>=0.1.1', 'python-multipart', 'beautifulsoup4']
16
16
 
17
17
  [project.urls]
18
18
  Repository = "https://github.com/AnswerDotAI/fasthtml"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-fasthtml
3
- Version: 0.14.0
3
+ Version: 0.14.2
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: Apache-2.0
@@ -17,7 +17,7 @@ Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
18
  Requires-Dist: fastcore>=1.12.45
19
19
  Requires-Dist: python-dateutil
20
- Requires-Dist: starlette~=1.0
20
+ Requires-Dist: starlette>=1.0.1
21
21
  Requires-Dist: oauthlib
22
22
  Requires-Dist: itsdangerous
23
23
  Requires-Dist: uvicorn[standard]>=0.30
@@ -1,6 +1,6 @@
1
1
  fastcore>=1.12.45
2
2
  python-dateutil
3
- starlette~=1.0
3
+ starlette>=1.0.1
4
4
  oauthlib
5
5
  itsdangerous
6
6
  uvicorn[standard]>=0.30
@@ -1,2 +0,0 @@
1
- __version__ = "0.14.0"
2
- from .core import *