@@ -112,31 +112,37 @@ guide and Python best practices.
112112
113113CrumPy makes use of the widget creation tool
114114[ AnyWidget] ( https://anywidget.dev/ ) . With AnyWidget, Python classes are able to
115- take JavaScript and display custom widgets in Jupyter environments. CrumPy
116- therefore includes both JavaScript and Python subparts:
115+ take JavaScript and display custom widgets in Jupyter environments. In order to
116+ visualize Crumble within CrumPy, some modifications in the Crumble source code
117+ were needed. CrumPy therefore includes both JavaScript and Python subparts:
117118
118119``` text
119120glue/
120- ├── crumble/ # Modified Crumble code
121- │ ├── crumpy/
122- │ │ ├── __init__.py # Python code for CircuitWidget
123- │ │ └── bundle.js # Bundled JavaScript will appear here
124- │ ├── main.js # Main circuit visualization/setup
121+ ├── crumpy/ # Modified Crumble code
122+ │ ├── src/
123+ │ │ ├── crumpy/
124+ │ │ │ └── __init__.py # Python code for CircuitWidget
125+ │ │ ├── js/
126+ │ │ │ ├── draw/ # Modified JS source code
127+ │ │ │ ├── main.js # Main circuit visualization/setup
128+ │ │ │ ├── bundle.js # Bundled JavaScript will appear here
129+ │ │ │ └── package.json # Bundling setup and scripts
125130│ └── ...
126- │ └ ── package.json # Bundling setup and scripts
127- ├── tests/ # Python tests
128- └── ...
131+ │ ├ ── tests/ # Python tests
132+ │ ├── simple_example.ipynb # Example notebook
133+ │ └── getting_started.ipynb # Getting started notebook
129134```
130135
131- ` glue/crumble/ crumpy ` contains the main Python package code.
136+ ` glue/crumpy ` contains the main Python package code.
132137
133- ` glue/crumble /crumpy/__init__.py ` contains the main class of the ` crumpy ` package,
138+ ` glue/crumpy/src /crumpy/__init__.py ` contains the main class of the ` crumpy ` package,
134139` CircuitWidget ` .
135140
136- ` glue/crumble/ ` contains the modified Crumble circuit visualization code that
137- will be rendered in the ` CircuitWidget ` widget.
141+ ` glue/crumpy/src/js/ ` contains the modified Crumble circuit visualization code that
142+ will be rendered in the ` CircuitWidget ` widget. In the build step, we copy the Crumble
143+ source code and modify it with the ` .js ` files in this folder.
138144
139- ` glue/crumble /main.js ` contains the main circuit visualization and setup logic
145+ ` glue/crumpy/src/js /main.js ` contains the main circuit visualization and setup logic
140146in the form of the ` render ` function
141147[ used by AnyWidget] ( https://anywidget.dev/en/afm/#anywidget-front-end-module-afm ) .
142148
@@ -159,6 +165,13 @@ A new bundle should appear at `src/js/bundle.js`.
159165you may need to restart the notebook kernel and rerun any widget-displaying code
160166for the changes to take effect.
161167
168+ ### Install from source
169+
170+ After creating the bundle, you can install the package from source:
171+
172+ 1 . Navigate to ` glue/crumpy `
173+ 2 . Run ` pip install -e . ` in your favorite Python environment
174+
162175<!-- SPHINX-START -->
163176
164177<!-- prettier-ignore-start -->
0 commit comments