anywidget


Nameanywidget JSON
Version 0.9.13 PyPI version JSON
download
home_pageNone
Summarycustom jupyter widgets made easy
upload_time2024-06-22 00:29:53
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1>
<p align="center">
  <img src="https://raw.githubusercontent.com/manzt/anywidget/main/docs/public/favicon.svg" alt="anywidget logo. A circular icon with two connected arrows pointing clockwise, symbolizing a refresh or restart action" width="60">
  <br>anywidget
</h1>
<samp>
  <p align="center">
    <span>custom jupyter widgets made easy</span>
      <br>
      <br>
      <a href="#installation">installation</a> .
      <a href="https://anywidget.dev">docs</a> .
      <a href="https://discord.gg/W5h4vPMbDQ">discord</a> .
      <a href="https://blog.jupyter.org/anywidget-jupyter-widgets-made-easy-164eb2eae102">learn</a>
  </p>
</samp>
</p>

## About

**anywidget** uses modern web standards to simplify authoring and distributing
custom Jupyter Widgets.

- 🛠️ create widgets **without complicated cookiecutter templates**
- 📚 **publish to PyPI** like any other Python package
- 🤖 prototype **within** `.ipynb` or `.py` files
- 🚀 run in **Jupyter**, **JupyterLab**, **Google Colab**, **VSCode**, and more
- ⚡ develop with **instant HMR**, like modern web frameworks

Learn more in the
[Jupyter blog](https://blog.jupyter.org/anywidget-jupyter-widgets-made-easy-164eb2eae102).

## Installation

**anywidget** is available on [PyPI](https://pypi.org/project/anywidget/):

```bash
pip install "anywidget[dev]"
```

and also on [conda-forge](https://anaconda.org/conda-forge/anywidget):

```bash
conda install -c conda-forge anywidget
```

## Usage

```python
import anywidget
import traitlets

class CounterWidget(anywidget.AnyWidget):
    # Widget front-end JavaScript code
    _esm = """
    function render({ model, el }) {
      let button = document.createElement("button");
      button.innerHTML = `count is ${model.get("value")}`;
      button.addEventListener("click", () => {
        model.set("value", model.get("value") + 1);
        model.save_changes();
      });
      model.on("change:value", () => {
        button.innerHTML = `count is ${model.get("value")}`;
      });
      el.appendChild(button);
    }
    export default { render };
    """
    # Stateful property that can be accessed by JavaScript & Python
    value = traitlets.Int(0).tag(sync=True)
```

Front-end code can also live in separate files (recommend):

```python
import pathlib
import anywidget
import traitlets

class CounterWidget(anywidget.AnyWidget):
    _esm = pathlib.Path("index.js")
    _css = pathlib.Path("styles.css")
    value = traitlets.Int(0).tag(sync=True)
```

Read [the documentation](https://anywidget.dev/en/getting-started) to learn
more.

## Packages

Beyond the primary Python package, **anywidget** provides an ecosystem of
tooling to help you build and distribute custom Jupyter Widgets.

| Name                                                                                             | Description                     | Version (click for changelogs)                                                                                                                                                                     |
| ------------------------------------------------------------------------------------------------ | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`anywidget`](https://github.com/manzt/anywidget/tree/main/packages/anywidget)                   | Primary Python package          | [![version](https://img.shields.io/pypi/v/anywidget.svg?labelColor=0273B7&color=0C3141)](https://github.com/manzt/anywidget/blob/main/packages/anywidget/CHANGELOG.md)                             |
| [`npm:@anywidget/types`](https://github.com/manzt/anywidget/tree/main/packages/types)            | Client type declarations        | [![version](https://img.shields.io/npm/v/@anywidget/types.svg?labelColor=C43636&color=0C3141&logo=npm&label)](https://github.com/manzt/anywidget/blob/main/packages/types/CHANGELOG.md)            |
| [`npm:@anywidget/vite`](https://github.com/manzt/anywidget/tree/main/packages/vite)              | Vite plugin                     | [![version](https://img.shields.io/npm/v/@anywidget/vite.svg?labelColor=C43636&color=0C3141&logo=npm&label)](https://github.com/manzt/anywidget/blob/main/packages/vite/CHANGELOG.md)              |
| [`npm:@anywidget/react`](https://github.com/manzt/anywidget/tree/main/packages/react)            | React framework adapter         | [![version](https://img.shields.io/npm/v/@anywidget/react.svg?labelColor=C43636&color=0C3141&logo=npm&label)](https://github.com/manzt/anywidget/blob/main/packages/react/CHANGELOG.md)            |
| [`npm:@anywidget/svelte`](https://github.com/manzt/anywidget/tree/main/packages/svelte)          | Svelte framework adapter        | [![version](https://img.shields.io/npm/v/@anywidget/svelte.svg?labelColor=C43636&color=0C3141&logo=npm&label)](https://github.com/manzt/anywidget/blob/main/packages/svelte/CHANGELOG.md)          |
| [`npm:create-anywidget`](https://github.com/manzt/anywidget/tree/main/packages/create-anywidget) | CLI to bootstrap a new project  | [![version](https://img.shields.io/npm/v/create-anywidget.svg?labelColor=C43636&color=0C3141&logo=npm&label)](https://github.com/manzt/anywidget/blob/main/packages/create-anywidget/CHANGELOG.md) |
| [`jsr:@anywidget/deno`](https://github.com/manzt/anywidget/tree/main/packages/deno)              | Backend for Deno Jupyter kernel | [![version](https://jsr.io/badges/@anywidget/deno)](https://github.com/manzt/anywidget/blob/main/packages/deno/CHANGELOG.md)                                                                       |

## Support

Having trouble? Get help in our [Discord](https://discord.gg/W5h4vPMbDQ) or open
a [Discussion](https://github.com/manzt/anywidget/issues/new).

## Contributing

**New contributors welcome!** Check out our
[Contributors Guide](./CONTRIBUTING.md) for help getting started.

Join us on [Discord](https://discord.gg/W5h4vPMbDQ) to meet other maintainers.
We'll help you get your first contribution in no time!

## License

[MIT](https://github.com/manzt/anywidget/blob/main/LICENSE)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "anywidget",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Trevor Manz <trevor.j.manz@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/87/79/647983b0cbddd797d9d79e09f89ee5912bb066af6bf456bd8acde66b1a39/anywidget-0.9.13.tar.gz",
    "platform": null,
    "description": "<h1>\n<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/manzt/anywidget/main/docs/public/favicon.svg\" alt=\"anywidget logo. A circular icon with two connected arrows pointing clockwise, symbolizing a refresh or restart action\" width=\"60\">\n  <br>anywidget\n</h1>\n<samp>\n  <p align=\"center\">\n    <span>custom jupyter widgets made easy</span>\n      <br>\n      <br>\n      <a href=\"#installation\">installation</a> .\n      <a href=\"https://anywidget.dev\">docs</a> .\n      <a href=\"https://discord.gg/W5h4vPMbDQ\">discord</a> .\n      <a href=\"https://blog.jupyter.org/anywidget-jupyter-widgets-made-easy-164eb2eae102\">learn</a>\n  </p>\n</samp>\n</p>\n\n## About\n\n**anywidget** uses modern web standards to simplify authoring and distributing\ncustom Jupyter Widgets.\n\n- \ud83d\udee0\ufe0f create widgets **without complicated cookiecutter templates**\n- \ud83d\udcda **publish to PyPI** like any other Python package\n- \ud83e\udd16 prototype **within** `.ipynb` or `.py` files\n- \ud83d\ude80 run in **Jupyter**, **JupyterLab**, **Google Colab**, **VSCode**, and more\n- \u26a1 develop with **instant HMR**, like modern web frameworks\n\nLearn more in the\n[Jupyter blog](https://blog.jupyter.org/anywidget-jupyter-widgets-made-easy-164eb2eae102).\n\n## Installation\n\n**anywidget** is available on [PyPI](https://pypi.org/project/anywidget/):\n\n```bash\npip install \"anywidget[dev]\"\n```\n\nand also on [conda-forge](https://anaconda.org/conda-forge/anywidget):\n\n```bash\nconda install -c conda-forge anywidget\n```\n\n## Usage\n\n```python\nimport anywidget\nimport traitlets\n\nclass CounterWidget(anywidget.AnyWidget):\n    # Widget front-end JavaScript code\n    _esm = \"\"\"\n    function render({ model, el }) {\n      let button = document.createElement(\"button\");\n      button.innerHTML = `count is ${model.get(\"value\")}`;\n      button.addEventListener(\"click\", () => {\n        model.set(\"value\", model.get(\"value\") + 1);\n        model.save_changes();\n      });\n      model.on(\"change:value\", () => {\n        button.innerHTML = `count is ${model.get(\"value\")}`;\n      });\n      el.appendChild(button);\n    }\n    export default { render };\n    \"\"\"\n    # Stateful property that can be accessed by JavaScript & Python\n    value = traitlets.Int(0).tag(sync=True)\n```\n\nFront-end code can also live in separate files (recommend):\n\n```python\nimport pathlib\nimport anywidget\nimport traitlets\n\nclass CounterWidget(anywidget.AnyWidget):\n    _esm = pathlib.Path(\"index.js\")\n    _css = pathlib.Path(\"styles.css\")\n    value = traitlets.Int(0).tag(sync=True)\n```\n\nRead [the documentation](https://anywidget.dev/en/getting-started) to learn\nmore.\n\n## Packages\n\nBeyond the primary Python package, **anywidget** provides an ecosystem of\ntooling to help you build and distribute custom Jupyter Widgets.\n\n| Name                                                                                             | Description                     | Version (click for changelogs)                                                                                                                                                                     |\n| ------------------------------------------------------------------------------------------------ | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [`anywidget`](https://github.com/manzt/anywidget/tree/main/packages/anywidget)                   | Primary Python package          | [![version](https://img.shields.io/pypi/v/anywidget.svg?labelColor=0273B7&color=0C3141)](https://github.com/manzt/anywidget/blob/main/packages/anywidget/CHANGELOG.md)                             |\n| [`npm:@anywidget/types`](https://github.com/manzt/anywidget/tree/main/packages/types)            | Client type declarations        | [![version](https://img.shields.io/npm/v/@anywidget/types.svg?labelColor=C43636&color=0C3141&logo=npm&label)](https://github.com/manzt/anywidget/blob/main/packages/types/CHANGELOG.md)            |\n| [`npm:@anywidget/vite`](https://github.com/manzt/anywidget/tree/main/packages/vite)              | Vite plugin                     | [![version](https://img.shields.io/npm/v/@anywidget/vite.svg?labelColor=C43636&color=0C3141&logo=npm&label)](https://github.com/manzt/anywidget/blob/main/packages/vite/CHANGELOG.md)              |\n| [`npm:@anywidget/react`](https://github.com/manzt/anywidget/tree/main/packages/react)            | React framework adapter         | [![version](https://img.shields.io/npm/v/@anywidget/react.svg?labelColor=C43636&color=0C3141&logo=npm&label)](https://github.com/manzt/anywidget/blob/main/packages/react/CHANGELOG.md)            |\n| [`npm:@anywidget/svelte`](https://github.com/manzt/anywidget/tree/main/packages/svelte)          | Svelte framework adapter        | [![version](https://img.shields.io/npm/v/@anywidget/svelte.svg?labelColor=C43636&color=0C3141&logo=npm&label)](https://github.com/manzt/anywidget/blob/main/packages/svelte/CHANGELOG.md)          |\n| [`npm:create-anywidget`](https://github.com/manzt/anywidget/tree/main/packages/create-anywidget) | CLI to bootstrap a new project  | [![version](https://img.shields.io/npm/v/create-anywidget.svg?labelColor=C43636&color=0C3141&logo=npm&label)](https://github.com/manzt/anywidget/blob/main/packages/create-anywidget/CHANGELOG.md) |\n| [`jsr:@anywidget/deno`](https://github.com/manzt/anywidget/tree/main/packages/deno)              | Backend for Deno Jupyter kernel | [![version](https://jsr.io/badges/@anywidget/deno)](https://github.com/manzt/anywidget/blob/main/packages/deno/CHANGELOG.md)                                                                       |\n\n## Support\n\nHaving trouble? Get help in our [Discord](https://discord.gg/W5h4vPMbDQ) or open\na [Discussion](https://github.com/manzt/anywidget/issues/new).\n\n## Contributing\n\n**New contributors welcome!** Check out our\n[Contributors Guide](./CONTRIBUTING.md) for help getting started.\n\nJoin us on [Discord](https://discord.gg/W5h4vPMbDQ) to meet other maintainers.\nWe'll help you get your first contribution in no time!\n\n## License\n\n[MIT](https://github.com/manzt/anywidget/blob/main/LICENSE)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "custom jupyter widgets made easy",
    "version": "0.9.13",
    "project_urls": {
        "homepage": "https://github.com/manzt/anywidget"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1a5a7b024920cca385eb9b56bc63edf0a647de208346bfac5b339b544733d53a",
                "md5": "e58f8a9c6868c8741718f04d482528b1",
                "sha256": "43d1658f1043b8c95cd350b2f5deccb123fd37810a36f656d6163aefe8163705"
            },
            "downloads": -1,
            "filename": "anywidget-0.9.13-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e58f8a9c6868c8741718f04d482528b1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 213685,
            "upload_time": "2024-06-22T00:29:49",
            "upload_time_iso_8601": "2024-06-22T00:29:49.872408Z",
            "url": "https://files.pythonhosted.org/packages/1a/5a/7b024920cca385eb9b56bc63edf0a647de208346bfac5b339b544733d53a/anywidget-0.9.13-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8779647983b0cbddd797d9d79e09f89ee5912bb066af6bf456bd8acde66b1a39",
                "md5": "fe94edef8ca060f81f7741a631a92d1f",
                "sha256": "c655455bf51f82182eb23c5947d37cc41f0b1ffacaf7e2b763147a2332cb3f07"
            },
            "downloads": -1,
            "filename": "anywidget-0.9.13.tar.gz",
            "has_sig": false,
            "md5_digest": "fe94edef8ca060f81f7741a631a92d1f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 9666998,
            "upload_time": "2024-06-22T00:29:53",
            "upload_time_iso_8601": "2024-06-22T00:29:53.960259Z",
            "url": "https://files.pythonhosted.org/packages/87/79/647983b0cbddd797d9d79e09f89ee5912bb066af6bf456bd8acde66b1a39/anywidget-0.9.13.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-22 00:29:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "manzt",
    "github_project": "anywidget",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "anywidget"
}
        
Elapsed time: 3.84981s