reactpy-jupyter
A client for ReactPy implemented using Jupyter widgets
Try It Now!
Check out some live examples by clicking the badge below:
Getting Started
To install use pip:
pip install reactpy_jupyter
Then, before anything else, do one of the following:
-
At the top of your notebook run
import reactpy_jupyter
-
Register
reactpy_jupyteras a permanant IPython extension in your config file:c.InteractiveShellApp.extensions = [ 'reactpy_jupyter' ]
Usage
Once you're done getting started, you can author and display ReactPy layouts natively in your Jupyter Notebook:
import reactpy
@reactpy.component
def ClickCount():
count, set_count = reactpy.hooks.use_state(0)
return reactpy.html.button(
{"onClick": lambda event: set_count(count + 1)},
[f"Click count: {count}"],
)
ClickCount()
You can also turn an reactpy element constructor into one that returns an ipywidget with
the reactpy_juptyer.widgetize function. This is useful if you wish to use ReactPy in combination
with other Jupyter Widgets as in the following example:
ClickCountWidget = reactpy_jupyter.widgetize(ClickCount)
ipywidgets.Box(
[
ClickCountWidget(),
ClickCountWidget(),
]
)
Alternatively just wrap an reactpy element instance in an reactpy_jupyter.LayoutWidget:
ipywidgets.Box(
[
reactpy_jupyter.LayoutWidget(ClickCount()),
reactpy_jupyter.LayoutWidget(ClickCount()),
]
)
For a more detailed introduction check out this live demo here:
Development Installation
For a development installation (requires Node.js and Yarn version 1),
$ git clone https://github.com/reactive-python/reactpy-jupyter.git
$ cd reactpy-jupyter
$ pip install -e .
To automatically re-build and refresh Jupyter when making changes start a Vite dev server:
$ npx vite
Then, before importing reactpy_jupyter set the following environment variable:
import os
os.environ["REACTPY_JUPYTER_DEV"] = "1"
import reactpy_jupyter
Metadata
Release files for reactpy-jupyter 0.9.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| reactpy_jupyter-0.9.5.tar.gz | 28.2 kB | Without provenance | Details for reactpy_jupyter-0.9.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| reactpy_jupyter-0.9.5-py3-none-any.whl | Python 3 | none | any | Details for reactpy_jupyter-0.9.5-py3-none-any.whl |
Total release size: 54.8 kB
Release files / reactpy_jupyter-0.9.5.tar.gz
| Download URL | reactpy_jupyter-0.9.5.tar.gz |
|---|---|
| Size | 28.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
05e075deacaef3bd5ec0ab052276b7eccbd1d39ba86f9b04dac656a7d82449a5
|
|
BLAKE2b-256 checksum How to use checksums |
6f8313313210db5913f134e7085a70918bfbb508229397620b502219b0912e40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / reactpy_jupyter-0.9.5-py3-none-any.whl
| Download URL | reactpy_jupyter-0.9.5-py3-none-any.whl |
|---|---|
| Size | 26.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e63ecf35fba525c45a052e9546ac9edfc02fd8087b0b26dea5c594a1e83e735c
|
|
BLAKE2b-256 checksum How to use checksums |
8d5ccf76863fbcd0d714c89662afafa339ad9d7c538519bb780ff921056c23a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Security for reactpy-jupyter 0.9.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.