python-fasthtml 0.10.2__tar.gz → 0.11.0__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 (41) hide show
  1. {python_fasthtml-0.10.2/python_fasthtml.egg-info → python_fasthtml-0.11.0}/PKG-INFO +1 -1
  2. python_fasthtml-0.11.0/fasthtml/__init__.py +2 -0
  3. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/_modidx.py +5 -1
  4. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/common.py +1 -1
  5. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/components.py +15 -3
  6. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/core.py +8 -3
  7. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0/python_fasthtml.egg-info}/PKG-INFO +1 -1
  8. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/settings.ini +1 -1
  9. python_fasthtml-0.10.2/fasthtml/__init__.py +0 -2
  10. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/CONTRIBUTING.md +0 -0
  11. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/LICENSE +0 -0
  12. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/MANIFEST.in +0 -0
  13. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/README.md +0 -0
  14. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/authmw.py +0 -0
  15. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/basics.py +0 -0
  16. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/cli.py +0 -0
  17. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/components.pyi +0 -0
  18. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/core.pyi +0 -0
  19. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/fastapp.py +0 -0
  20. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/ft.py +0 -0
  21. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/js.py +0 -0
  22. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/jupyter.py +0 -0
  23. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/katex.js +0 -0
  24. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/live_reload.py +0 -0
  25. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/oauth.py +0 -0
  26. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/pico.py +0 -0
  27. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/starlette.py +0 -0
  28. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/svg.py +0 -0
  29. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/toaster.py +0 -0
  30. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/xtend.py +0 -0
  31. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/fasthtml/xtend.pyi +0 -0
  32. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/pyproject.toml +0 -0
  33. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/python_fasthtml.egg-info/SOURCES.txt +0 -0
  34. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/python_fasthtml.egg-info/dependency_links.txt +0 -0
  35. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/python_fasthtml.egg-info/entry_points.txt +0 -0
  36. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/python_fasthtml.egg-info/not-zip-safe +0 -0
  37. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/python_fasthtml.egg-info/requires.txt +0 -0
  38. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/python_fasthtml.egg-info/top_level.txt +0 -0
  39. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/setup.cfg +0 -0
  40. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/setup.py +0 -0
  41. {python_fasthtml-0.10.2 → python_fasthtml-0.11.0}/tests/test_toaster.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-fasthtml
3
- Version: 0.10.2
3
+ Version: 0.11.0
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
@@ -0,0 +1,2 @@
1
+ __version__ = "0.11.0"
2
+ from .core import *
@@ -11,7 +11,10 @@ d = { 'settings': { 'branch': 'main',
11
11
  'fasthtml.cli.railway_deploy': ('api/cli.html#railway_deploy', 'fasthtml/cli.py'),
12
12
  'fasthtml.cli.railway_link': ('api/cli.html#railway_link', 'fasthtml/cli.py')},
13
13
  'fasthtml.common': {},
14
- 'fasthtml.components': { 'fasthtml.components.File': ('api/components.html#file', 'fasthtml/components.py'),
14
+ 'fasthtml.components': { 'fasthtml.components.FT.__add__': ('api/components.html#ft.__add__', 'fasthtml/components.py'),
15
+ 'fasthtml.components.FT.__radd__': ('api/components.html#ft.__radd__', 'fasthtml/components.py'),
16
+ 'fasthtml.components.FT.__str__': ('api/components.html#ft.__str__', 'fasthtml/components.py'),
17
+ 'fasthtml.components.File': ('api/components.html#file', 'fasthtml/components.py'),
15
18
  'fasthtml.components.__getattr__': ('api/components.html#__getattr__', 'fasthtml/components.py'),
16
19
  'fasthtml.components._fill_item': ('api/components.html#_fill_item', 'fasthtml/components.py'),
17
20
  'fasthtml.components.attrmap_x': ('api/components.html#attrmap_x', 'fasthtml/components.py'),
@@ -103,6 +106,7 @@ d = { 'settings': { 'branch': 'main',
103
106
  'fasthtml.core.flat_xt': ('api/core.html#flat_xt', 'fasthtml/core.py'),
104
107
  'fasthtml.core.form2dict': ('api/core.html#form2dict', 'fasthtml/core.py'),
105
108
  'fasthtml.core.get_key': ('api/core.html#get_key', 'fasthtml/core.py'),
109
+ 'fasthtml.core.nested_name': ('api/core.html#nested_name', 'fasthtml/core.py'),
106
110
  'fasthtml.core.noop_body': ('api/core.html#noop_body', 'fasthtml/core.py'),
107
111
  'fasthtml.core.parse_form': ('api/core.html#parse_form', 'fasthtml/core.py'),
108
112
  'fasthtml.core.parsed_date': ('api/core.html#parsed_date', 'fasthtml/core.py'),
@@ -4,7 +4,7 @@ from dataclasses import dataclass
4
4
  from .starlette import *
5
5
  from fastcore.utils import *
6
6
  from fastcore.xml import *
7
- from sqlite_minutils import Database
7
+ from apswutils import Database
8
8
  from fastlite import *
9
9
  from .basics import *
10
10
  from .pico import *
@@ -37,6 +37,18 @@ def show(ft,*rest):
37
37
  if rest: ft = (ft,)+rest
38
38
  display.display(display.HTML(to_xml(ft)))
39
39
 
40
+ # %% ../nbs/api/01_components.ipynb
41
+ @patch
42
+ def __str__(self:FT): return self.id if self.id else object.__str__(self)
43
+
44
+ # %% ../nbs/api/01_components.ipynb
45
+ @patch
46
+ def __radd__(self:FT, b): return f'{b}{self}'
47
+
48
+ # %% ../nbs/api/01_components.ipynb
49
+ @patch
50
+ def __add__(self:FT, b): return f'{self}{b}'
51
+
40
52
  # %% ../nbs/api/01_components.ipynb
41
53
  named = set('a button form frame iframe img input map meta object param select textarea'.split())
42
54
  html_attrs = 'id cls title style accesskey contenteditable dir draggable enterkeyhint hidden inert inputmode lang popover spellcheck tabindex translate'.split()
@@ -69,14 +81,14 @@ fh_cfg['auto_id']=False
69
81
  fh_cfg['auto_name']=True
70
82
 
71
83
  # %% ../nbs/api/01_components.ipynb
72
- def ft_html(tag: str, *c, id=None, cls=None, title=None, style=None, attrmap=None, valmap=None, ft_cls=None, auto_id=None, **kwargs):
84
+ def ft_html(tag: str, *c, id=None, cls=None, title=None, style=None, attrmap=None, valmap=None, ft_cls=None, **kwargs):
73
85
  ds,c = partition(c, risinstance(dict))
74
86
  for d in ds: kwargs = {**kwargs, **d}
75
87
  if ft_cls is None: ft_cls = fh_cfg.ft_cls
76
88
  if attrmap is None: attrmap=fh_cfg.attrmap
77
89
  if valmap is None: valmap =fh_cfg.valmap
78
- if auto_id is None: auto_id = fh_cfg.auto_id
79
- if auto_id and not id: id = unqid()
90
+ if not id and fh_cfg.auto_id: id = True
91
+ if id and isinstance(id,bool): id = unqid()
80
92
  kwargs['id'] = id.id if isinstance(id,FT) else id
81
93
  kwargs['cls'],kwargs['title'],kwargs['style'] = cls,title,style
82
94
  tag,c,kw = ft(tag, *c, attrmap=attrmap, valmap=valmap, **kwargs).list
@@ -7,8 +7,8 @@ __all__ = ['empty', 'htmx_hdrs', 'fh_cfg', 'htmx_resps', 'htmx_exts', 'htmxsrc',
7
7
  'charset', 'cors_allow', 'iframe_scr', 'all_meths', 'parsed_date', 'snake2hyphens', 'HtmxHeaders',
8
8
  'HttpHeader', 'HtmxResponseHeaders', 'form2dict', 'parse_form', 'flat_xt', 'Beforeware', 'EventStream',
9
9
  'signal_shutdown', 'uri', 'decode_uri', 'flat_tuple', 'noop_body', 'respond', 'Redirect', 'get_key', 'qp',
10
- 'def_hdrs', 'FastHTML', 'serve', 'Client', 'RouteFuncs', 'APIRouter', 'cookie', 'reg_re_param',
11
- 'MiddlewareBase', 'FtResponse', 'unqid', 'setup_ws']
10
+ 'def_hdrs', 'FastHTML', 'nested_name', 'serve', 'Client', 'RouteFuncs', 'APIRouter', 'cookie',
11
+ 'reg_re_param', 'MiddlewareBase', 'FtResponse', 'unqid', 'setup_ws']
12
12
 
13
13
  # %% ../nbs/api/00_core.ipynb
14
14
  import json,uuid,inspect,types,uvicorn,signal,asyncio,threading,inspect
@@ -597,10 +597,15 @@ def _mk_locfunc(f,p):
597
597
  def __str__(self): return p
598
598
  return _lf()
599
599
 
600
+ # %% ../nbs/api/00_core.ipynb
601
+ def nested_name(f):
602
+ "Get name of function `f` using '_' to join nested function names"
603
+ return f.__qualname__.replace('.<locals>.', '_')
604
+
600
605
  # %% ../nbs/api/00_core.ipynb
601
606
  @patch
602
607
  def _add_route(self:FastHTML, func, path, methods, name, include_in_schema, body_wrap):
603
- n,fn,p = name,func.__name__,None if callable(path) else path
608
+ n,fn,p = name,nested_name(func),None if callable(path) else path
604
609
  if methods: m = [methods] if isinstance(methods,str) else methods
605
610
  elif fn in all_meths and p is not None: m = [fn]
606
611
  else: m = ['get','post']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-fasthtml
3
- Version: 0.10.2
3
+ Version: 0.11.0
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
@@ -1,7 +1,7 @@
1
1
  [DEFAULT]
2
2
  repo = fasthtml
3
3
  lib_name = fasthtml
4
- version = 0.10.2
4
+ version = 0.11.0
5
5
  min_python = 3.10
6
6
  license = apache2
7
7
  requirements = fastcore>=1.7.18 python-dateutil starlette>0.33 oauthlib itsdangerous uvicorn[standard]>=0.30 httpx fastlite>=0.0.9 python-multipart beautifulsoup4
@@ -1,2 +0,0 @@
1
- __version__ = "0.10.2"
2
- from .core import *