JupyterLab extension for widgets based on Yjs
Requirements
- JupyterLab == 4.0.0b0
Installation
You can install yjs-widgets using pip:
pip install yjs-widgets
Usage
import { IJupyterYModel } from './types';
import { JupyterYModel } from './model';
import { IJupyterYWidgetManager } from './notebookrenderer/types';
import {
JupyterFrontEnd,
JupyterFrontEndPlugin
} from '@jupyterlab/application';
class MyWidget {
constructor(yModel: IJupyterYModel, node: HTMLElement) {
this.yModel = yModel;
this.node = node;
yModel.sharedModel.attrsChanged.connect(() => {
this._attrsChanged();
});
node.textContent = 'Hello world!';
}
_attrsChanged(): void {
const foo: string = this.yModel.sharedModel.getAttr('foo') as string;
const bar: string = this.yModel.sharedModel.getAttr('bar') as string;
this.node.textContent = `foo=${foo}, bar=${bar}`;
}
yModel: IJupyterYModel;
node: HTMLElement;
}
export const foo: JupyterFrontEndPlugin<void> = {
id: 'foo:bar',
autoStart: true,
requires: [IJupyterYWidgetManager],
activate: (app: JupyterFrontEnd, wm: IJupyterYWidgetManager): void => {
wm.registerWidget('MyWidget', JupyterYModel, MyWidget);
}
};
Contributing
yjs-widgets is an open-source project, and contributions are always welcome. If you would like to contribute, please fork the repository and submit a pull request.
See CONTRIBUTING for dev installation instructions.
License
yjs-widgets is licensed under the BSD 3-Clause License. See the LICENSE file for more information.
Metadata
Release files for yjs-widgets 0.6.0
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 | |
|---|---|---|---|---|
| yjs_widgets-0.6.0.tar.gz | 162.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yjs_widgets-0.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 182.0 kB
Release files / yjs_widgets-0.6.0.tar.gz
| Download URL | yjs_widgets-0.6.0.tar.gz |
|---|---|
| Size | 162.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6eaf3673a5147bccf20d32f63bc40a387d9edee8d22bdefe85dce3d2f9f6b5e0
|
|
BLAKE2b-256 checksum How to use checksums |
10ab78e7108681fbe4bfd8c8881b012af298eb8dbd0f1d1ca014d076ff9d8fa2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / yjs_widgets-0.6.0-py3-none-any.whl
| Download URL | yjs_widgets-0.6.0-py3-none-any.whl |
|---|---|
| Size | 19.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0bf494c00e223dbbe3bcf68c19cc0bcb20c92a49728d01c360ad14049c6040e8
|
|
BLAKE2b-256 checksum How to use checksums |
720d4dcfcb92a024be67504b2a778a8a7df981e756e051acb92f332a340b3b83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for yjs-widgets 0.6.0
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.