Giter Club home page Giter Club logo

ipyp5's Introduction

ipyp5

Build Status Documentation Status Code style: black pypi Python Versions License Binder

⚠️ Disclaimer: this is a work in progress! ⚠️

p5.js in the Jupyter Notebook using the Jupyter Widgets.

This project aims to be a follow-up of p5-jupyter-notebook, so that p5 can be used in JupyterLab (and in the classic Notebook) as a proper package.

Current Status

screencast

  • Define a sketch using the instance mode of p5. This explains the use of p in the sample sketch.
  • The sketch is synced to the widget as a raw string and evaluated on the frontend.

TODO

  • Figure out how to expose a Python wrapper to the p5 API
  • How to avoid round trips to the server (syncing of values) when making animations (updating values at every frame)?
  • Proper testing, packaging and documentation once the problems above are solved

Goal

The ideal goal (disclaimer: not implemented yet) would be to write code like this in a notebook cell:

class MySketch(BaseSketch):
    W, H = 400, 400

    def setup(s):
        s.createCanvas(s.W, s.H)
        s.rectMode(s.CENTER)

    def draw(s):
        s.background('#ddd')
        s.translate(200, 200)
        for i in range(4):
            s.push()
            s.rotate(s.frameCount / 200 * (i + 1))
            s.fill(i * 5, i * 100, i * 150)
            s.rect(0, 0, 200, 200)
            s.pop()

sketch = MySketch()
sketch

Contributing

See CONTRIBUTING.md

ipyp5's People

Contributors

dependabot[bot] avatar jtpio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ipyp5's Issues

p5.js Jyve Kernel

There's a p5.js kernel for Jyve that may also be useful for this project? Jyve is JupyterLab compiled to run in a browser without any backend.
Src: https://github.com/deathbeds/jyve
Demo: https://deathbeds.github.io/jyve/lab/

p5.js JupyterLab NPM package: https://github.com/deathbeds/jyve/tree/master/packages/jyve-kyrnel-p5-unsafe

This seems to work in the demo:

// restart and run all
function setup() { createCanvas(100, 100) }
function draw() { rect(10, 20, 55, 55) }

A number of things are not yet implemented in Jyve; including:

  • Saving (e.g. to a cloud drive)
  • Exporting (nbconvert)

File nbextension/static/index.js missing when installing

Hi, I'd really like to try this project out. However I run into some problem when trying to install it.

When running pip install -e . there seems to be a file missing: ipyp5/ipyp5/nbextension/static/index.js.

        raise ValueError(("missing files: %s" % missing))
    ValueError: missing files: ['/home/user/GitHub/ipyp5/ipyp5/nbextension/static/index.js', '/home/user/GitHub/ipyp5/lib/plugin.js']
    
    ----------------------------------------
Command "/home/user/anaconda3/envs/ipyp5/bin/python -c "import setuptools, tokenize;__file__='/home/user/GitHub/ipyp5/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" develop --no-deps" failed with error code 1 in /home/user/GitHub/ipyp5/

install_error.txt

I noticed that the file is blocked from uploading in .gitignore.

Thanks for any help!

'Sketch'

I just got ipyp5 and am trying out the example you give in JupyterLab (I'm brand new to JupyterLab/Jupyter Notebook). I'm getting an ImportError: cannot import name 'Sketch' from 'ipyp5' (unknown location). Where should it be?

pyp5js

The readme.md states that

The ideal goal (disclaimer: not implemented yet) would be to write code like this in a notebook cell

looks like pyp5js just might be the ticket?

Install Error

IPYP5 Install Error

Is there a specific version of Python needed for this package to run? I'm trying to add this package to a new environment in Jupyter Notebooks but it's not working very well. I'd love to utilize this package to make a P5 tutorial for my college course. When I tried to download the ipyp5 package locally I kept getting the error: no module found. Is there a workaround for this or has this project kind of gone by the wayside? Any information is greatly appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.