Skip to main content

Panel Sketch Logo

✏ ️ Panel Sketch

THIS IS APLHA SOFTWARE AND YOU MAY EXPERIENCE ROUGH EDGES.

The purpose of the panel-sketch package is to make it easy for Pythonistas to quickly sketch interactive visualizations and other applications running in

  • The browser - also without a Python backend
  • The Jupyter Notebook.
  • Your favorite editor or IDE.

It is heavily inspired by p5js, p5js sketches and pyp5js but not limited to the p5js universe.

You can also think of it as a Code Sandbox or JS Fiddle but for #Python 🐍.

Check out the panel-sketch examples on Binder

Jupyter Notebook Jupyter Labs Panel Apps
Binder Binder Binder

Panel Sketch Reference Example

It leverages Python to Javascript frameworks. Currently Pyodide and Transcrypt. But potentially also Brython or similar in the future.

License

The panel-sketch python package and repository is open source and free to use (MIT License).

Installation

With pip

pip install panel-sketch

Usage

from panel_sketch import Sketch

import panel as pn
pn.config.sizing_mode="stretch_width"
args={"r": 10, "g": 200, "b": 40} # This will give us the color for our sketch
sketch_python = """
# https://p5js.org/examples/interaction-wavemaker.html


from pyp5js import *

t = 0


def setup():
    createCanvas(600, 600)
    stroke(250)
    strokeWeight(3)
    fill(window.args.r, window.args.g, window.args.b)


def draw():
    global t
    background(10, 10)
    fill(window.args.r, window.args.g, window.args.b)

    xAngle = map(mouseX, 0, width, -4 * PI, 4 * PI, True)
    yAngle = map(mouseY, 0, height, -4 * PI, 4 * PI, True)
    for x in range(0, width, 30):
        for y in range(0, height, 30):

            angle = xAngle * (x / width) + yAngle * (y / height)

            myX = x + 20 * cos(2 * PI * t + angle)
            myY = y + 20 * sin(2 * TWO_PI * t + angle)

            ellipse(myX, myY, 10)

    t = t + 0.01
"""
sketch = Sketch(object=sketch_python, template="pyp5js", compiler="pyodide", args=args)
sketch.viewer.view

Basic Example

Reference Guides

Sketch Reference Example

Binder

Examples

Binder

Additional Resources

You can find more inspiration via the links below.

Roadmap

When I get the time I would like to

  • Add basic template examples.
  • Enable using the content of notebook cells instead of a string to instantite Sketch.
  • Add more notebook examples
  • Enable easy import and export of sketches
  • Find out how I can serve the target js modules in notebook (Enable Transcrypt in Notebook).
  • Support alternatives to p5js like three.js
  • (re-)align with pyp5js
  • Add example app to awesome-panel.org.
  • Support extensions to p5js like m5.js
  • Create youtube tutorial video
  • Add badges for 100% test coverage etc.
  • Distribute as conda package

Change Log

  • 20210410: First Release to PyPi.

Metadata

Release files for panel-sketch 20210411.2

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

Source distribution (sdist)

Source distribution for panel-sketch 20210411.2
File Size Uploaded Provenance Actions
panel-sketch-20210411.2.tar.gz 25.3 kB Without provenance Details for panel-sketch-20210411.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for panel-sketch 20210411.2
File Interpreter ABI Platform Actions
panel_sketch-20210411.2-py3-none-any.whl Python 3 none any Details for panel_sketch-20210411.2-py3-none-any.whl

Total release size: 57.0 kB

Release files / panel-sketch-20210411.2.tar.gz

Download URL panel-sketch-20210411.2.tar.gz
Size 25.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6826d598ad07f2f4cd41158bf6c4d7d63170aa323bea79900b17131c637cb118
BLAKE2b-256 checksum
How to use checksums
15d52e9caa52a6ba99ea0b15d514938f43b30e631753e505e1f5afce8d5f8679
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.4

Release files / panel_sketch-20210411.2-py3-none-any.whl

Download URL panel_sketch-20210411.2-py3-none-any.whl
Size 31.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a64d6c1591d11aa5823c8b7d1bbb7d16e5bbc9e44944143ad46682551f13332
BLAKE2b-256 checksum
How to use checksums
21560d52d427ec28cb5f236aa411fa3abfe926ee1f987f845eeae37a705d42ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.4

Security for panel-sketch 20210411.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

20210411.2 This release

2 release files No provenance

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