python-fasthtml 0.0.16__tar.gz → 0.0.17__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 (32) hide show
  1. {python-fasthtml-0.0.16/python_fasthtml.egg-info → python-fasthtml-0.0.17}/PKG-INFO +1 -1
  2. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/fasthtml/__init__.py +1 -1
  3. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/fasthtml/_modidx.py +41 -0
  4. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/fasthtml/authmw.py +1 -1
  5. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/fasthtml/cli.py +3 -2
  6. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/fasthtml/common.py +2 -0
  7. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/fasthtml/components.py +22 -19
  8. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/fasthtml/components.pyi +95 -70
  9. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/fasthtml/core.py +10 -6
  10. python-fasthtml-0.0.17/fasthtml/fastapp.py +46 -0
  11. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/fasthtml/js.py +2 -9
  12. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/fasthtml/starlette.py +1 -1
  13. python-fasthtml-0.0.17/fasthtml/svg.py +4 -0
  14. python-fasthtml-0.0.17/fasthtml/test.py +317 -0
  15. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/fasthtml/xtend.py +34 -18
  16. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17/python_fasthtml.egg-info}/PKG-INFO +1 -1
  17. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/python_fasthtml.egg-info/SOURCES.txt +2 -0
  18. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/settings.ini +1 -1
  19. python-fasthtml-0.0.16/fasthtml/fastapp.py +0 -33
  20. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/LICENSE +0 -0
  21. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/MANIFEST.in +0 -0
  22. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/README.md +0 -0
  23. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/fasthtml/live_reload.py +0 -0
  24. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/fasthtml/oauth.py +0 -0
  25. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/fasthtml/xtend.pyi +0 -0
  26. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/python_fasthtml.egg-info/dependency_links.txt +0 -0
  27. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/python_fasthtml.egg-info/entry_points.txt +0 -0
  28. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/python_fasthtml.egg-info/not-zip-safe +0 -0
  29. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/python_fasthtml.egg-info/requires.txt +0 -0
  30. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/python_fasthtml.egg-info/top_level.txt +0 -0
  31. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/setup.cfg +0 -0
  32. {python-fasthtml-0.0.16 → python-fasthtml-0.0.17}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-fasthtml
3
- Version: 0.0.16
3
+ Version: 0.0.17
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.0.16"
1
+ __version__ = "0.0.17"
2
2
  from .core import *
3
3
  from .authmw import *
4
4
  from .components import *
@@ -35,10 +35,51 @@ d = { 'settings': { 'branch': 'main',
35
35
  'fasthtml.oauth._AppClient.retr_info': ('oauth.html#_appclient.retr_info', 'fasthtml/oauth.py'),
36
36
  'fasthtml.oauth.retr_code': ('oauth.html#retr_code', 'fasthtml/oauth.py')},
37
37
  'fasthtml.starlette': {},
38
+ 'fasthtml.svg': {},
39
+ 'fasthtml.test': { 'fasthtml.test.Beforeware': ('core_tests.html#beforeware', 'fasthtml/test.py'),
40
+ 'fasthtml.test.Beforeware.__init__': ('core_tests.html#beforeware.__init__', 'fasthtml/test.py'),
41
+ 'fasthtml.test.FastHTML': ('core_tests.html#fasthtml', 'fasthtml/test.py'),
42
+ 'fasthtml.test.FastHTML.__init__': ('core_tests.html#fasthtml.__init__', 'fasthtml/test.py'),
43
+ 'fasthtml.test.FastHTML.route': ('core_tests.html#fasthtml.route', 'fasthtml/test.py'),
44
+ 'fasthtml.test.HtmxHeaders': ('core_tests.html#htmxheaders', 'fasthtml/test.py'),
45
+ 'fasthtml.test.HtmxHeaders.__bool__': ('core_tests.html#htmxheaders.__bool__', 'fasthtml/test.py'),
46
+ 'fasthtml.test.HttpHeader': ('core_tests.html#httpheader', 'fasthtml/test.py'),
47
+ 'fasthtml.test.MiddlewareBase': ('core_tests.html#middlewarebase', 'fasthtml/test.py'),
48
+ 'fasthtml.test.MiddlewareBase.__call__': ('core_tests.html#middlewarebase.__call__', 'fasthtml/test.py'),
49
+ 'fasthtml.test.RouteX': ('core_tests.html#routex', 'fasthtml/test.py'),
50
+ 'fasthtml.test.RouteX.__init__': ('core_tests.html#routex.__init__', 'fasthtml/test.py'),
51
+ 'fasthtml.test.RouterX': ('core_tests.html#routerx', 'fasthtml/test.py'),
52
+ 'fasthtml.test.RouterX.__init__': ('core_tests.html#routerx.__init__', 'fasthtml/test.py'),
53
+ 'fasthtml.test.RouterX.add_route': ('core_tests.html#routerx.add_route', 'fasthtml/test.py'),
54
+ 'fasthtml.test.RouterX.add_ws': ('core_tests.html#routerx.add_ws', 'fasthtml/test.py'),
55
+ 'fasthtml.test.WS_RouteX': ('core_tests.html#ws_routex', 'fasthtml/test.py'),
56
+ 'fasthtml.test.WS_RouteX.__init__': ('core_tests.html#ws_routex.__init__', 'fasthtml/test.py'),
57
+ 'fasthtml.test._annotations': ('core_tests.html#_annotations', 'fasthtml/test.py'),
58
+ 'fasthtml.test._find_p': ('core_tests.html#_find_p', 'fasthtml/test.py'),
59
+ 'fasthtml.test._fix_anno': ('core_tests.html#_fix_anno', 'fasthtml/test.py'),
60
+ 'fasthtml.test._form_arg': ('core_tests.html#_form_arg', 'fasthtml/test.py'),
61
+ 'fasthtml.test._formitem': ('core_tests.html#_formitem', 'fasthtml/test.py'),
62
+ 'fasthtml.test._from_body': ('core_tests.html#_from_body', 'fasthtml/test.py'),
63
+ 'fasthtml.test._get_htmx': ('core_tests.html#_get_htmx', 'fasthtml/test.py'),
64
+ 'fasthtml.test._is_body': ('core_tests.html#_is_body', 'fasthtml/test.py'),
65
+ 'fasthtml.test._wrap_ep': ('core_tests.html#_wrap_ep', 'fasthtml/test.py'),
66
+ 'fasthtml.test._wrap_req': ('core_tests.html#_wrap_req', 'fasthtml/test.py'),
67
+ 'fasthtml.test._wrap_resp': ('core_tests.html#_wrap_resp', 'fasthtml/test.py'),
68
+ 'fasthtml.test._xt_resp': ('core_tests.html#_xt_resp', 'fasthtml/test.py'),
69
+ 'fasthtml.test.date': ('core_tests.html#date', 'fasthtml/test.py'),
70
+ 'fasthtml.test.flat_xt': ('core_tests.html#flat_xt', 'fasthtml/test.py'),
71
+ 'fasthtml.test.form2dict': ('core_tests.html#form2dict', 'fasthtml/test.py'),
72
+ 'fasthtml.test.get_key': ('core_tests.html#get_key', 'fasthtml/test.py'),
73
+ 'fasthtml.test.is_namedtuple': ('core_tests.html#is_namedtuple', 'fasthtml/test.py'),
74
+ 'fasthtml.test.is_typeddict': ('core_tests.html#is_typeddict', 'fasthtml/test.py'),
75
+ 'fasthtml.test.reg_re_param': ('core_tests.html#reg_re_param', 'fasthtml/test.py'),
76
+ 'fasthtml.test.snake2hyphens': ('core_tests.html#snake2hyphens', 'fasthtml/test.py'),
77
+ 'fasthtml.test.str2int': ('core_tests.html#str2int', 'fasthtml/test.py')},
38
78
  'fasthtml.xtend': { 'fasthtml.xtend.A': ('xtend.html#a', 'fasthtml/xtend.py'),
39
79
  'fasthtml.xtend.AX': ('xtend.html#ax', 'fasthtml/xtend.py'),
40
80
  'fasthtml.xtend.Card': ('xtend.html#card', 'fasthtml/xtend.py'),
41
81
  'fasthtml.xtend.Checkbox': ('xtend.html#checkbox', 'fasthtml/xtend.py'),
82
+ 'fasthtml.xtend.Container': ('xtend.html#container', 'fasthtml/xtend.py'),
42
83
  'fasthtml.xtend.DialogX': ('xtend.html#dialogx', 'fasthtml/xtend.py'),
43
84
  'fasthtml.xtend.Grid': ('xtend.html#grid', 'fasthtml/xtend.py'),
44
85
  'fasthtml.xtend.Group': ('xtend.html#group', 'fasthtml/xtend.py'),
@@ -1,4 +1,4 @@
1
- import base64, binascii
1
+ import base64, binascii, re
2
2
  from fasthtml.core import *
3
3
  from fasthtml.starlette import *
4
4
  from typing import Mapping
@@ -6,10 +6,11 @@ __all__ = ['railway_link']
6
6
  # %% ../nbs/04_cli.ipynb 1
7
7
  from fastcore.utils import *
8
8
  from fastcore.script import call_parse
9
- import json
10
9
  from subprocess import run
11
10
 
12
- # %% ../nbs/04_cli.ipynb 2
11
+ import json
12
+
13
+ # %% ../nbs/04_cli.ipynb 3
13
14
  @call_parse
14
15
  def railway_link():
15
16
  t = run("railway status --json".split(), capture_output=True)
@@ -1,4 +1,5 @@
1
1
  import uvicorn
2
+ from dataclasses import dataclass
2
3
 
3
4
  from .starlette import *
4
5
  from fastcore.utils import *
@@ -7,4 +8,5 @@ from sqlite_minutils import Database
7
8
  from fastlite import *
8
9
  from . import *
9
10
  from .js import *
11
+ from .fastapp import *
10
12
 
@@ -1,14 +1,17 @@
1
1
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/01_components.ipynb.
2
2
 
3
3
  # %% auto 0
4
- __all__ = ['named', 'html_attrs', 'hx_attrs', 'show', 'xt_html', 'xt_hx', 'fill_form', 'fill_dataclass', 'find_inputs', 'html2xt',
5
- 'Html', 'Head', 'Title', 'Meta', 'Link', 'Style', 'Body', 'Pre', 'Code', 'Div', 'Span', 'P', 'H1', 'H2',
6
- 'H3', 'H4', 'H5', 'H6', 'Strong', 'Em', 'B', 'I', 'U', 'S', 'Strike', 'Sub', 'Sup', 'Hr', 'Br', 'Img', 'Nav',
7
- 'Ul', 'Ol', 'Li', 'Dl', 'Dt', 'Dd', 'Table', 'Thead', 'Tbody', 'Tfoot', 'Tr', 'Th', 'Td', 'Caption', 'Col',
8
- 'Colgroup', 'Form', 'Input', 'Textarea', 'Button', 'Select', 'Option', 'Label', 'Fieldset', 'Legend',
9
- 'Details', 'Dialog', 'Summary', 'Main', 'Header', 'Footer', 'Section', 'Article', 'Aside', 'Figure',
10
- 'Figcaption', 'Mark', 'Small', 'Iframe', 'Object', 'Embed', 'Param', 'Video', 'Audio', 'Source', 'Canvas',
11
- 'Svg', 'Math', 'Script', 'Noscript', 'Template', 'Slot']
4
+ __all__ = ['voids', 'named', 'html_attrs', 'hx_attrs', 'show', 'xt_html', 'xt_hx', 'fill_form', 'fill_dataclass', 'find_inputs',
5
+ 'html2xt', 'A', 'Abbr', 'Address', 'Area', 'Article', 'Aside', 'Audio', 'B', 'Base', 'Bdi', 'Bdo',
6
+ 'Blockquote', 'Body', 'Br', 'Button', 'Canvas', 'Caption', 'Cite', 'Code', 'Col', 'Colgroup', 'Data',
7
+ 'Datalist', 'Dd', 'Del', 'Details', 'Dfn', 'Dialog', 'Div', 'Dl', 'Dt', 'Em', 'Embed', 'Fencedframe',
8
+ 'Fieldset', 'Figcaption', 'Figure', 'Footer', 'Form', 'H1', 'Head', 'Header', 'Hgroup', 'Hr', 'Html', 'I',
9
+ 'Iframe', 'Img', 'Input', 'Ins', 'Kbd', 'Label', 'Legend', 'Li', 'Link', 'Main', 'Map', 'Mark', 'Menu',
10
+ 'Meta', 'Meter', 'Nav', 'Noscript', 'Object', 'Ol', 'Optgroup', 'Option', 'Output', 'P', 'Picture',
11
+ 'PortalExperimental', 'Pre', 'Progress', 'Q', 'Rp', 'Rt', 'Ruby', 'S', 'Samp', 'Script', 'Search', 'Section',
12
+ 'Select', 'Slot', 'Small', 'Source', 'Span', 'Strong', 'Style', 'Sub', 'Summary', 'Sup', 'Table', 'Tbody',
13
+ 'Td', 'Template', 'Textarea', 'Tfoot', 'Th', 'Thead', 'Time', 'Title', 'Tr', 'Track', 'U', 'Ul', 'Var',
14
+ 'Video', 'Wbr']
12
15
 
13
16
  # %% ../nbs/01_components.ipynb 2
14
17
  from dataclasses import dataclass, asdict, is_dataclass, make_dataclass, replace, astuple, MISSING
@@ -28,6 +31,7 @@ def show(xt,*rest):
28
31
  return display.HTML(to_xml(xt))
29
32
 
30
33
  # %% ../nbs/01_components.ipynb 5
34
+ voids = set('area base br col command embed hr img input keygen link meta param source track wbr !doctype'.split())
31
35
  named = set('a button form frame iframe img input map meta object param select textarea'.split())
32
36
  html_attrs = 'id cls title style accesskey contenteditable dir draggable enterkeyhint hidden inert inputmode lang popover spellcheck tabindex translate'.split()
33
37
  hx_attrs = 'get post put delete patch trigger target swap include select indicator push_url confirm disable replace_url on'
@@ -38,7 +42,7 @@ def xt_html(tag: str, *c, id=None, cls=None, title=None, style=None, **kwargs):
38
42
  kwargs['id'],kwargs['cls'],kwargs['title'],kwargs['style'] = id,cls,title,style
39
43
  tag,c,kw = xt(tag, *c, **kwargs)
40
44
  if tag in named and 'id' in kw and 'name' not in kw: kw['name'] = kw['id']
41
- return XT(tag,c,kw)
45
+ return XT(tag,c,kw, void_=tag in voids)
42
46
 
43
47
  # %% ../nbs/01_components.ipynb 7
44
48
  @use_kwargs(hx_attrs, keep=True)
@@ -48,16 +52,15 @@ def xt_hx(tag: str, *c, target_id=None, **kwargs):
48
52
 
49
53
  # %% ../nbs/01_components.ipynb 8
50
54
  _g = globals()
51
- _all_ = ['Html', 'Head', 'Title', 'Meta', 'Link', 'Style', 'Body', 'Pre', 'Code',
52
- 'Div', 'Span', 'P', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'Strong', 'Em', 'B',
53
- 'I', 'U', 'S', 'Strike', 'Sub', 'Sup', 'Hr', 'Br', 'Img', 'Link', 'Nav',
54
- 'Ul', 'Ol', 'Li', 'Dl', 'Dt', 'Dd', 'Table', 'Thead', 'Tbody', 'Tfoot', 'Tr',
55
- 'Th', 'Td', 'Caption', 'Col', 'Colgroup', 'Form', 'Input', 'Textarea',
56
- 'Button', 'Select', 'Option', 'Label', 'Fieldset', 'Legend', 'Details', 'Dialog',
57
- 'Summary', 'Main', 'Header', 'Footer', 'Section', 'Article', 'Aside', 'Figure',
58
- 'Figcaption', 'Mark', 'Small', 'Iframe', 'Object', 'Embed', 'Param', 'Video',
59
- 'Audio', 'Source', 'Canvas', 'Svg', 'Math', 'Script', 'Noscript', 'Template', 'Slot']
60
-
55
+ _all_ = [
56
+ 'A', 'Abbr', 'Address', 'Area', 'Article', 'Aside', 'Audio', 'B', 'Base', 'Bdi', 'Bdo', 'Blockquote', 'Body', 'Br',
57
+ 'Button', 'Canvas', 'Caption', 'Cite', 'Code', 'Col', 'Colgroup', 'Data', 'Datalist', 'Dd', 'Del', 'Details', 'Dfn',
58
+ 'Dialog', 'Div', 'Dl', 'Dt', 'Em', 'Embed', 'Fencedframe', 'Fieldset', 'Figcaption', 'Figure', 'Footer', 'Form',
59
+ 'H1', 'Head', 'Header', 'Hgroup', 'Hr', 'Html', 'I', 'Iframe', 'Img', 'Input', 'Ins', 'Kbd', 'Label', 'Legend', 'Li',
60
+ 'Link', 'Main', 'Map', 'Mark', 'Menu', 'Meta', 'Meter', 'Nav', 'Noscript', 'Object', 'Ol', 'Optgroup', 'Option', 'Output',
61
+ 'P', 'Picture', 'PortalExperimental', 'Pre', 'Progress', 'Q', 'Rp', 'Rt', 'Ruby', 'S', 'Samp', 'Script', 'Search',
62
+ 'Section', 'Select', 'Slot', 'Small', 'Source', 'Span', 'Strong', 'Style', 'Sub', 'Summary', 'Sup', 'Table', 'Tbody',
63
+ 'Td', 'Template', 'Textarea', 'Tfoot', 'Th', 'Thead', 'Time', 'Title', 'Tr', 'Track', 'U', 'Ul', 'Var', 'Video', 'Wbr']
61
64
  for o in _all_: _g[o] = partial(xt_hx, o.lower())
62
65
 
63
66
  # %% ../nbs/01_components.ipynb 12