Skip to main content

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 synced
  • simulation_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nyancad-0.1.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nyancad-0.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file nyancad-0.1.0.tar.gz.

File metadata

  • Download URL: nyancad-0.1.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for nyancad-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7270aa6055fb1c595f4914da71b0b043ab770a15bde9bb340eb3172049b659f7
MD5 398944abc110b172213f01b529df51b6
BLAKE2b-256 43e78493714e0e2242a2a5999d942c05528687f4e65b7f02af299c637bd9dcc0

See more details on using hashes here.

Provenance

The following attestation bundles were made for nyancad-0.1.0.tar.gz:

Publisher: main.yml on NyanCAD/Mosaic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nyancad-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nyancad-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for nyancad-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c4628c4adb8c37dad39521f4bf0187386582d4492f5694dafa61f54d0bc272c
MD5 a966221fadd3ebf01d6f5aeeb1748a67
BLAKE2b-256 dff91b17238bd419f703cc82678e06561cbdddaaef3f039b3ecaf4dca5142ae5

See more details on using hashes here.

Provenance

The following attestation bundles were made for nyancad-0.1.0-py3-none-any.whl:

Publisher: main.yml on NyanCAD/Mosaic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page