Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tool to convert Python Mode .pyde code for use with pyp5js #45

Open
villares opened this issue May 27, 2019 · 5 comments
Open

Tool to convert Python Mode .pyde code for use with pyp5js #45

villares opened this issue May 27, 2019 · 5 comments

Comments

@villares
Copy link
Contributor

This is a proof of concept, running inside Processing IDE, that converts simple 'single tab' code for use with pyp5js:
https://gist.github.com/villares/1b14997beef52de34069b91752faef40

@berinhard suggested some CL ideas:
$ pyp5js from_processing /path/to/sketch.pyde
or
$ pyp5js from_processing /path/to/sketch.pyde -s my_new_sketch
(the last one would update a sketch with the converted code)

@berinhard
Copy link
Owner

@villares I was thinking if, by doing that, we're not giving ourselves some problems in the future... I'm basing my thought on your experience with you recent port from Pyprocessing to pyp5js.

You had some issues with how Py2 handles numbers division differently from Py3, since py2 returns an integer while py3 returns a float as explained by the following snippet:

[bernardo@macalandia ~]$ python3
Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
>>> type(3 / 3)
<class 'float'>

[bernardo@macalandia ~]$ python2
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15) 
>>> type(2 / 2)
<type 'int'>

And this is just one of the many differences between the python versions...

So, I think we have to assume that there could be other errors from this same nature when porting sketches and we have to take under consideration that, maybe, the people porting them aren't that familiar with such Python's versions details. Given that, I think it's very possible and reasonable for them to open issues on pyp5js that aren't related with the lib, but with the change on the python version.

Speaking as the project maintainer, this could be a little bit overwhelming for me if it really happens. So, I'll put that on hold for now until we have more port examples and until we can confirm that these issues with the version update are indeed happening.

@villares
Copy link
Contributor Author

villares commented May 28, 2019 via email

@berinhard
Copy link
Owner

@villares I had a few second thoughts on that! Now I really agree with this tool as a somehing to bring more people to use and to try pyp5js by just "translating" theirs pyde files. Sorry for not being that open in the first time.

Anyway, what do you think about this one? What do you think about something like:

$ pyp5js convert_pyde /home/bernardo/sketchbooks/sketch/sketch.pyde

@villares
Copy link
Contributor Author

Hey, if you could provide me an entry point where my converter should run...

Or maybe, better, If I implement an independent convert_pyde.py you can validate and couch me on best practices?

@berinhard
Copy link
Owner

Sure! Feel free to implement a convert_pyde.py script. Maybe you can add it to the pyp5js/pre_compile/ dir and open a PR so we can discuss on the top of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants