Skip to content

0.11.0#18

Merged
jealouscloud merged 34 commits into
mainfrom
0.11.0
Nov 10, 2025
Merged

0.11.0#18
jealouscloud merged 34 commits into
mainfrom
0.11.0

Conversation

@jealouscloud
Copy link
Copy Markdown
Owner

0.11.0

  • Add html_compose.resource module which includes
    js_import, css_import, and font_import helpers
  • html_compose.document: Add streaming document generators which will produce
    head element before other content.
  • Add js/css/font composition along with other changes to html_compose.document
  • [breaking] Change HTML5Document into a class with a .render and .stream function
    which wrap other functionality in the module.
    The signature is now different which may require updates.
  • HTML converter improvements: Survive round trip for more text.
    Output single elements when we identify an attribute could be a list
  • Documentation improvements
    • Migrate element/attr docstrings to Google style.
      Pyright on Zed seems to tolerate this better.
    • Fix a weird pylance bug on WatchCond
  • Live reload now accepts daemon host/port/timeout and can wait to send browser
    reload until after the server responds
  • py.typed improvements to module exports
  • Child elements passed uninstantiated will be instantiated at render time
    • This means you can p['line 1', br, 'line 2'] where previously you had to br()
  • notebook.render accepts _HasHtml which includes documents and elements

This feature set adds automatic document setup for
optimal resource loading for fonts, css, and js.

It also extends the document module by adding
a streaming method to return head first to the browser

document_streamer is added as welll which combines the two features.
I had trouble reading the docs from our docs page, so I decided this needed a full pass.

The quick start was polished, and we added some stuff like document_generator.
First pass

Parameter hints weren't displaying at all which is the opposite of what we want.

We're going to try a 'value hint' prefix for the untyped elements.
* track completion status
* on exceptions, terminate task runner
* detect if the daemon has died
* send sigkill if exiting is hung and user hits Ctrl C
* fix pylance docstring parser bug in watchcond by swapping args
This is probably the best extension-forward way to handle this transition
pyright/basedpyright informed.
Lots of casts were used and I'm not sorrry.

* module exports elements/etc correctly per pyright
* __class_getitem__ -> metaclass impl of h1['text'] / constructor skip.
informed by type hinters believing the former returned
type[h1] instead of instance of h1.
* For metaclass, the _HasHtml protocol inheritence was dropped.
protocols are runtime detected without interfaces anyway and we implement
__html__.
This means you can
p[
'text',
br,
'new line text'
}
src/html_compose/base_element.py:186: error: Incompatible types in assignment (expression has type "str | float | int | bool | Iterable[str | float | int | bool] | Mapping[str | float | int | bool, bool] | None", variable has type "str")  [assignment]
src/html_compose/base_element.py:201: error: Incompatible types in assignment (expression has type "str | float | int | bool | Iterable[str | float | int | bool] | Mapping[str | float | int | bool, bool] | None", variable has type "str")  [assignment]
@jealouscloud jealouscloud merged commit 8c08cf0 into main Nov 10, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant