python-fasthtml 0.12.10__tar.gz → 0.12.12__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 (42) hide show
  1. {python_fasthtml-0.12.10/python_fasthtml.egg-info → python_fasthtml-0.12.12}/PKG-INFO +2 -2
  2. python_fasthtml-0.12.12/fasthtml/__init__.py +2 -0
  3. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/toaster.py +5 -7
  4. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12/python_fasthtml.egg-info}/PKG-INFO +2 -2
  5. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/python_fasthtml.egg-info/requires.txt +1 -1
  6. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/settings.ini +3 -2
  7. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/tests/test_toaster.py +6 -1
  8. python_fasthtml-0.12.10/fasthtml/__init__.py +0 -2
  9. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/CONTRIBUTING.md +0 -0
  10. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/LICENSE +0 -0
  11. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/MANIFEST.in +0 -0
  12. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/README.md +0 -0
  13. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/_modidx.py +0 -0
  14. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/authmw.py +0 -0
  15. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/basics.py +0 -0
  16. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/cli.py +0 -0
  17. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/common.py +0 -0
  18. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/components.py +0 -0
  19. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/components.pyi +0 -0
  20. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/core.py +0 -0
  21. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/core.pyi +0 -0
  22. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/fastapp.py +0 -0
  23. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/ft.py +0 -0
  24. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/js.py +0 -0
  25. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/jupyter.py +0 -0
  26. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/katex.js +0 -0
  27. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/live_reload.py +0 -0
  28. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/oauth.py +0 -0
  29. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/pico.py +0 -0
  30. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/starlette.py +0 -0
  31. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/stripe_otp.py +0 -0
  32. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/svg.py +0 -0
  33. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/xtend.py +0 -0
  34. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/fasthtml/xtend.pyi +0 -0
  35. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/pyproject.toml +0 -0
  36. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/python_fasthtml.egg-info/SOURCES.txt +0 -0
  37. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/python_fasthtml.egg-info/dependency_links.txt +0 -0
  38. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/python_fasthtml.egg-info/entry_points.txt +0 -0
  39. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/python_fasthtml.egg-info/not-zip-safe +0 -0
  40. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/python_fasthtml.egg-info/top_level.txt +0 -0
  41. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/setup.cfg +0 -0
  42. {python_fasthtml-0.12.10 → python_fasthtml-0.12.12}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-fasthtml
3
- Version: 0.12.10
3
+ Version: 0.12.12
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 and contributors
@@ -18,7 +18,7 @@ Classifier: License :: OSI Approved :: Apache Software License
18
18
  Requires-Python: >=3.10
19
19
  Description-Content-Type: text/markdown
20
20
  License-File: LICENSE
21
- Requires-Dist: fastcore>=1.7.18
21
+ Requires-Dist: fastcore>=1.8.1
22
22
  Requires-Dist: python-dateutil
23
23
  Requires-Dist: starlette>0.33
24
24
  Requires-Dist: oauthlib
@@ -0,0 +1,2 @@
1
+ __version__ = "0.12.12"
2
+ from .core import *
@@ -35,24 +35,22 @@ toast_css = """
35
35
 
36
36
  def Toast(message: str, typ: str = "info", dismiss: bool = False, duration:int=5000):
37
37
  x_btn = Button('x', cls="fh-toast-dismiss", onclick="htmx.remove(this?.parentElement);") if dismiss else None
38
- return Div(Div(Span(message), x_btn, cls=f"fh-toast fh-toast-{typ}", hx_on_transitionend="setTimeout(() => this?.remove(), %d);" % duration), hx_swap_oob=f"afterbegin:#{tcid}")
38
+ return Div(Span(message), x_btn, cls=f"fh-toast fh-toast-{typ}", hx_on_transitionend="setTimeout(() => this?.remove(), %d);" % duration)
39
39
 
40
40
  def add_toast(sess, message: str, typ: str = "info", dismiss: bool = False):
41
41
  assert typ in ("info", "success", "warning", "error"), '`typ` not in ("info", "success", "warning", "error")'
42
42
  sess.setdefault(sk, []).append((message, typ, dismiss))
43
43
 
44
44
  def render_toasts(sess):
45
- toasts = [Toast(msg, typ, dismiss, sess['toast_duration'])
46
- for msg, typ, dismiss in sess.pop(sk, [])]
47
- return Div(*toasts)
45
+ toasts = [Toast(msg, typ, dismiss, sess['toast_duration']) for msg, typ, dismiss in sess.pop(sk, [])]
46
+ return Div(*toasts, id=tcid, hx_swap_oob='afterbegin')
48
47
 
49
48
  def toast_after(resp, req, sess):
50
49
  if sk in sess and (not resp or isinstance(resp, (tuple,FT,FtResponse))):
51
50
  sess['toast_duration'] = req.app.state.toast_duration
52
51
  req.injects.append(render_toasts(sess))
53
52
 
54
- js = Script("htmx.onLoad(() => {if (!document.querySelector('#%s')){const elm = document.createElement('div'); elm.id='%s'; document.body.prepend(elm);}})" % (tcid, tcid))
55
53
  def setup_toasts(app, duration=5000):
56
54
  app.state.toast_duration = duration
57
- app.hdrs += [Style(toast_css), js]
58
- app.after.append(toast_after)
55
+ app.hdrs += [Style(toast_css)]
56
+ app.after.append(toast_after)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-fasthtml
3
- Version: 0.12.10
3
+ Version: 0.12.12
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 and contributors
@@ -18,7 +18,7 @@ Classifier: License :: OSI Approved :: Apache Software License
18
18
  Requires-Python: >=3.10
19
19
  Description-Content-Type: text/markdown
20
20
  License-File: LICENSE
21
- Requires-Dist: fastcore>=1.7.18
21
+ Requires-Dist: fastcore>=1.8.1
22
22
  Requires-Dist: python-dateutil
23
23
  Requires-Dist: starlette>0.33
24
24
  Requires-Dist: oauthlib
@@ -1,4 +1,4 @@
1
- fastcore>=1.7.18
1
+ fastcore>=1.8.1
2
2
  python-dateutil
3
3
  starlette>0.33
4
4
  oauthlib
@@ -1,10 +1,10 @@
1
1
  [DEFAULT]
2
2
  repo = fasthtml
3
3
  lib_name = python-fasthtml
4
- version = 0.12.10
4
+ version = 0.12.12
5
5
  min_python = 3.10
6
6
  license = apache2
7
- requirements = fastcore>=1.7.18 python-dateutil starlette>0.33 oauthlib itsdangerous uvicorn[standard]>=0.30 httpx fastlite>=0.1.1 python-multipart beautifulsoup4
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
8
8
  dev_requirements = ipython lxml pysymbol_llm monsterui
9
9
  black_formatting = False
10
10
  conda_user = fastai
@@ -39,4 +39,5 @@ clean_ids = True
39
39
  clear_all = False
40
40
  cell_number = False
41
41
  skip_procs =
42
+ update_pyproject = True
42
43
 
@@ -52,7 +52,12 @@ def test_get_toaster_with_typehint():
52
52
  res = cli.get('/see-toast-with-typehint', follow_redirects=True)
53
53
  assert 'Toast get' in res.text
54
54
 
55
+ def test_toast_container_in_response():
56
+ # toasts will not render correctly if the toast container isn't rendered.
57
+ res = cli.get('/see-toast-ft-response')
58
+ assert 'id="fh-toast-container"' in res.text
59
+
55
60
  test_get_toaster()
56
61
  test_post_toaster()
57
62
  test_ft_response()
58
-
63
+ test_toast_container_in_response()
@@ -1,2 +0,0 @@
1
- __version__ = "0.12.10"
2
- from .core import *