Skip to content

Releases: manzt/anywidget

[email protected]

01 Jun 15:43
39bf909
Compare
Choose a tag to compare

Minor Changes

  • feat: Add support for evented msgspec.Struct objects (#64)

    Our experimental descriptor API can now work with msgspec, a fast and efficient serialization library, similar to pydantic but with a stronger emphasis on ser/de, and less on runtime casting of Python types.

    from anywidget._descriptor import MimeBundleDescriptor
    import psygnal
    import msgspec
    
    @psygnal.evented
    class Counter(msgspec.Struct, weakref=True):
        value: int = 0
        _repr_mimebundle_: ClassVar = MimeBundleDescriptor(_esm="index.js", autodetect_observer=False)

[email protected]

26 May 14:43
b635f76
Compare
Choose a tag to compare

Patch Changes

  • fix: properly cache cleanup function for HMR (#122)

[email protected]

09 May 16:48
3656bff
Compare
Choose a tag to compare

Minor Changes

  • fix: replace deprecated ipykernel.comm.Comm with comm module (#119)

Patch Changes

  • fix: revert watchfiles to optional-dependency (#118)

[email protected]

08 May 14:08
8be557c
Compare
Choose a tag to compare

Patch Changes

  • fix: add watchfiles as a direct dependency (#116)

[email protected]

20 Apr 02:01
08caec7
Compare
Choose a tag to compare

Patch Changes

  • fix: JS variable scope issue (eacc99c)

[email protected]

17 Apr 22:13
3a593ce
Compare
Choose a tag to compare

Patch Changes

  • feat: log an re-raise error on ESM import failure (#105)

v0.2.1

14 Apr 03:35
Compare
Choose a tag to compare

Patch Changes

fix: allow more flexible semver resolution for @jupyter-widgets/base (#107)

v0.2.0

17 Mar 15:35
ecd57b8
Compare
Choose a tag to compare

Minor Changes

  • feat: auto-create (and watch) FileContents for valid file paths (#79)

    import anywidget
    import traitlets
    
    class Counter(anywidget.AnyWidget):
        _esm = "index.js"
        value = traitlets.Int(0).tag(sync=True)

    If a file path for an existing file is detected for _esm or _css,
    the contents will be read from disk automatically. If the resolved
    path is not in site-packages (i.e., likely a development install), a
    background thread will start watching for file changes and push updates
    to the front end.

  • feat: add anywidget/types to npm package to allow opt-in strictness (#80)

    // @ts-check
    
    /** @type {import("anywidget/types").Render<{ value: number }>} */
    export function render(view) {
      let value = view.model.get("value");
      //^ ? `number`
    
      view.model.set("value", "not-a-number");
      // Error: Argument of type 'string' is not assignable to parameter of type 'number'. [2345]
    }

v0.1.2

21 Feb 14:28
9ac02a4
Compare
Choose a tag to compare

Patch Changes

  • feat: add (optional) cleanup/unmount return to render (#67)

    export function render(view) {
      /* create elements and add event listeners */
      return function cleanup() => {
        /* specify how to cleanup any expensive resources created above */
      }
    }
  • feat: add colab metadata to _repr_mimebundle_ to fix displaying ipywidgets v7 & v8 in Colab (#75)

v0.1.1

13 Feb 23:40
b1496fc
Compare
Choose a tag to compare

Patch Changes

  • fix: support ipywidgets v7 and v8 in Google Colab (#52) (7540ec9)

  • fix: hot CSS replacement (#65) (7540ec9)

  • feat: add ESM fallback if none is specified for an anywidget.AnyWidget subclass (#45) (7540ec9)

    class MyWidget(anywidget.AnyWidget):
        ...
    
    MyWidget()
    # Dev note: Implement an `_esm` attribute on AnyWidget subclass
    # `__main__.MyWidget` to customize this widget.
  • feat: add FileContents to read/watch files (#62) (7540ec9)

    contents = FileContents("./index.js", start_thread=True)
    
    contents.changed.connect
    def _on_change(new_contents: str):
        print("index.js changed:")
        print(new_contents)
  • chore: deprecate _module attribute for _esm for defining widget ESM (#66) (7540ec9)

  • fix: support Python 3.7 with from __future__ import annotations (#44) (7540ec9)

  • feat: add MimeBundleDescriptor pattern, for more library agnostic Python <> JS communication (#49) (7540ec9)

    from anywidget._descriptor import MimeBundleDescriptor
    
    import traitlets
    
    class Counter(traitlets.HasTraits):
        _repr_mimebundle_ = MimeBundleDescriptor(_esm=ESM)
        value = traitlets.Int(0).tag(sync=True)
  • feat: add support for HMR during development (#60) (7540ec9)