Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

openjsoncanvas

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openjsoncanvas

A python implementation of the JsonCanvas format: https://github.com/obsidianmd/jsoncanvas/blob/main/spec/1.0.md

  • 3.0.0
  • PyPI
  • Socket score

Maintainers
1

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')

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc