NyanCAD Python library for schematic editor with anywidget integration
Project description
NyanCAD Python Library
A Python library for the NyanCAD schematic editor with anywidget integration. Provides live access to schematic data from marimo notebooks.
Installation
pip install nyancad
Usage
Basic Usage
import marimo as mo
from nyancad import SchematicBridge
# Create a schematic bridge widget
bridge = SchematicBridge()
# Display the widget (shows connection status)
bridge
# Access live schematic data
print(bridge.schematic_data)
# Send simulation data back to the editor
bridge.simulation_data = {
"results": [1.2, 3.4, 5.6],
"timestamp": "2024-01-01T00:00:00Z"
}
Integration with Marimo
The SchematicBridge widget automatically connects to the NyanCAD editor running in the same marimo session. Any changes made in the schematic editor will be immediately reflected in the Python widget.
# In a marimo cell
bridge = SchematicBridge()
bridge # This will show the connection status
# In another marimo cell - access the live data
mo.md(f"""
## Schematic Analysis
Raw schematic data: {len(bridge.schematic_data)} items
""")
# View the actual schematic data structure
bridge.schematic_data
Features
- Live Sync: Real-time synchronization with NyanCAD schematic editor via PouchDB
- Bidirectional Communication: Send simulation data back to the editor from Python
- Zero Configuration: Automatically detects and connects to the active schematic
- Raw Data Access: Direct access to the complete schematic data structure
- Marimo Integration: Seamless integration with marimo notebooks
API Reference
SchematicBridge
The main widget class that provides bidirectional communication with the Mosaic editor.
Properties
schematic_data(dict): Raw schematic data from the Mosaic editor, automatically syncedsimulation_data(dict): Simulation data to send to the Mosaic editor. Setting this will store the data with a timestamp in the editor's database
Development
This package is part of the NyanCAD project. The anywidget integration uses a ClojureScript bridge that compiles to an ESM module, allowing seamless data sharing between the schematic editor and Python environment.
License
This project is licensed under the Mozilla Public License 2.0 - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nyancad-0.12.1.tar.gz.
File metadata
- Download URL: nyancad-0.12.1.tar.gz
- Upload date:
- Size: 21.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87ebac0d8d800fec9d0f1ece808eecd14ba4bff94b6911c47e4eb39eda2f074d
|
|
| MD5 |
6bb6c74e82189d0270a0ab4d72274ffc
|
|
| BLAKE2b-256 |
4fb9308bc09e757f19eddfc276c3e2b14de03d4bd849597bf0d1d67ecbbbdc80
|
File details
Details for the file nyancad-0.12.1-py3-none-any.whl.
File metadata
- Download URL: nyancad-0.12.1-py3-none-any.whl
- Upload date:
- Size: 22.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13eb7491036a75862547efdcfbc9ed2fce2d3ef8693307049473fa1973cb4e4f
|
|
| MD5 |
c69cc565b3a4f6cc736682e21fc82f47
|
|
| BLAKE2b-256 |
7ee6813cfe269b7f16024a6c59cd8002231d3b8e2f733730ee01061c179eda9b
|