jdf / processing-py-site

Site for processing.py.
MIT License
198 stars 52 forks source link

Processing.py Documentation How are we doing?

This repository contains the files and executable code used to build py.processing.org, the official documentation for Processing.py.

Dependencies and installation

To build this project, you need to have the following software installed:

(Both java and python should be in your path.)

You'll need to install the various Python library requirements as well. These requirements are provided in this repository in the standard pip-formatted requirements.txt. The easiest way to do this is to create and activate a Python virtual environment and then install the requirements with pip like so:

pip install -r requirements.txt

(Tip: For most platforms, it's easier to install lxml if you upgrade pip first. With your virtual environment activated, type pip install -U pip and then install the packages with the command above.)

Finally, you'll need the standalone Processing.py JAR file. You can build Processing.py from source to obtain this file, or download the pre-built JAR for your platform using the appropriate link below:

Unarchive the file you downloaded and copy the two files with a .jar extension into your processing-py-site directory.

Overview

The generator.py script takes the various files in this repository, processes them and generates a static HTML site. (You can think of generator.py as being a kind of bespoke static site generator, akin to, e.g., Jekyll.) Running the following command will build the entire site:

python generator.py build --all --images

(See below for further discussion of the command line options available in generator.py.) The best way to understand how the site is generated is to study generator.py's source code, but here's the basic overview.

On successful completion of generator.py, the static site ends up in the generated directory.

Building the documentation

As noted above, the generator.py script builds the site from the source files in the repository. Run python generator.py --help for full details on its command line options. Here's an overview:

To build all content:

python generator.py build --all --images

To build the site without performing the image generation process:

python generator.py build

To build only a.xml, b.xml and c.xml files from the reference (remove --images to skip the image generation process):

python generator.py build --images --files a.xml b.xml c.xml

To test the site in a local server:

python generator.py test

Troubleshooting

Here are a few common and/or possible scenarios you might run into...

Error: Could not find or load main class org.python.util.jython

You're missing the Jython code necessary to execute the image generation script. Ensure that you've copied (or linked) processing-py.jar from the standalone Processing.py distribution into your processing-py-site directory.

NullPointerException - foo is probably dynamic-mode; fix that, please.

The image generation process only creates images for "static-mode" sketches, i.e., sketches that don't have a draw() function and therefore can't be animated or interactive. To fix this, rewrite the code example so it isn't interactive, or add <notest /><noimage /> as children of the <example> tag in the XML to suppress image generation for that item.

Could not initialize class com.jogamp.newt.NewtFactory

I've seen this error when trying to build on Linux without processing-py-natives-linux-amd64.jar in the processing-py-site directory. Ensure this file (or the file appropriate for your platform) is present and try again.

I can't run the image generation process in a headless environment

If you're running on a Linux machine without a connected display (say, an EC2 box), you'll need to install xvfb using the package manager for your operating system. Then run the build script like so:

xvfb-run python generator.py build --images

Reporting Issues

Before opening a new issue, please review existing issues.

Issues should include as many details as possible, including URLs and/or excerpts from the related material, and a description of what is missing/wrong or could be improved, and if possible how.

Contributing:

see CONTRIBUTING.md