Load processing.py as a module in vanilla python project?

I’m sure this is a silly question to ask, but I’m curious if you can load Processing as a module in Python? I love the power and abstraction that Processing provides, but I’m not a huge fan of the PDE. I’d like to use more standard tools and directory structures. Definitely a novice, so I could be using the native processing tools incorrectly.

Side complaint: I don’t like that I can’t save versions of tabs as separate files without saving the entire project directory again so I end up having duplicates of everything in my data folder. Maybe I just need to implement git and use that for versioning into a single project directory? How do you manage iteration?

Thanks in advance (or sorry if this is obvious or answered somewhere else), I appreciate any insights.

Welcome @pxlmnkeee

If you’d like to avoid the Processing editor (in favour of some other code editor), then you can use the command line version of processsing.py. If you search the forums, you’ll find ways to integrate this into Atom, Sublime, etc.

For a pure-Python solution, you can look at p5. Note that this is a recreation of the Processing API in Python, so there are differences, and it’s not using Processing to compile and run sketches.

I’m not sure I fully understand your “side complaint”. Each tab is a separate Python file; typically you’d import those into your main sketch. Why not use some approach like this:

# this is the main sketch (.pyde) file

#import tabfile_1_1
#import tabfile_1_2
import tabfile_1_3

def setup():
    ...

I’ve commented out the ‘versions’ I don’t wish to import; this way I can always reactivate any version. But, yes, I’d opt for some kind of version control (Git, etc.).

2 Likes

Thanks for the feedback. I’ve seen info about running Processing from the command line but I assumed that was just for running sketches without the PDE GUI. I’ll look into that a bit more closely!

I guess my problem with my “side complaint” is that I made the noob mistake of putting most of my code in the main sketch, I wasn’t sure if there was another option other than pasting most of my code into another file and importing into the main .pyde. Thanks again for taking the time to answer these basic questions!