Skip to main content

JsonCanvas Python Implementation

This project provides a Python implementation of the JsonCanvas format, designed to facilitate the creation, manipulation, and visualization of a structured canvas using objects and relations. It leverages Python's pydantic library to ensure data validation and management, supporting a range of node and edge types for comprehensive canvas construction.

Features

  • Robust model definitions for canvas elements (Nodes and Edges) with comprehensive validation and default settings via pydantic.
  • Dynamic addition and manipulation of various node types including Text, File, Link, Group, and Edge elements.
  • Enhanced canvas operations allowing easy addition of nodes and edges with automated type handling.
  • Serialize canvas structures to standard Python dictionaries for easy integration with other systems.

Installation

pip install openjsoncanvas

Usage

Creating a Canvas

Instantiate and manipulate a canvas with various nodes and edges:

from openjsoncanvas import Canvas

canvas = Canvas()

canvas.create_text_node(id='1', x=0, y=0, width=100, height=100, text='Hello, World!')
canvas.create_file_node(id='2', x=100, y=100, width=100, height=100, file='example.md')
canvas.create_link_node(id='3', x=200, y=200, width=100, height=100, url='https://example.com')
canvas.create_group_node(id='4', x=300, y=300, width=100, height=100)
canvas.create_edge(id='5', fromNode='1', toNode='2', fromEnd='arrow', toEnd='arrow', color='red', label='Edge')

# you can save and load the canvas to/from a file
canvas.to_file('my_canvas.canvas')
canvas = Canvas.from_file('my_canvas.canvas')

Release files for openjsoncanvas 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openjsoncanvas 3.0.0
File Size Uploaded
openjsoncanvas-3.0.0.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openjsoncanvas 3.0.0
File Interpreter ABI Platform
openjsoncanvas-3.0.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 9.2 kB

Release files / openjsoncanvas-3.0.0.tar.gz

Download URL openjsoncanvas-3.0.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
90d4cedc3a2eb4c87426e3b4522cbf9e1535879ca999adbad3f3d8b329b69b45
BLAKE2b-256 checksum
How to use checksums
f52a18bb1ae0f4ace3326acc726f04f423c8dfc2ae3b55adf3235c063c121821
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Release files / openjsoncanvas-3.0.0-py2.py3-none-any.whl

Download URL openjsoncanvas-3.0.0-py2.py3-none-any.whl
Size 4.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
cbe7feb5d241586cab24fe51343c18d558d2fe62042bdfcff73b642cfc31b62c
BLAKE2b-256 checksum
How to use checksums
d144f0fccb73d59f94b7723e7f96612c4c36c70b6e70d293dfe03c7eea5d6fc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Release history Release notifications | RSS feed

This release

3.0.0 This release

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.0

2 release files

1.0.5

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page