Hairball is a plugin-able framework useful for static analysis of Scratch projects.
Project description
# Installation for development
## Prerequisites
virtualenv
To install virtualenv a python package installer is required. This instruction will use pip.
### Ubuntu/debian installation of prerequisites
sudo apt-get install python-setuptools sudo easy_install pip
### Mac OS X installation of prerequisites
sudo easy_install pip sudo pip install virtualenv # Follow these instructions for git installation # https://help.github.com/articles/set-up-git#platform-mac
## Configure and become familiar with git
Regardless of how you installed git, please follow [these](https://help.github.com/articles/set-up-git#platform-all) instructions beginning with the section “Set Up Git” to configure your name and email combination. Also, if you are not familiar with git, please go through the [try.github.com](http://try.github.com/) tutorial.
## Check out the project and run in development mode
Check out the source
git clone git@github.com:ucsb-cs-education/hairball.git
Create the virtual environment
These examples use ~/.venv as the virtual environment location, however, feel free to use whatever you prefer.
virtualenv ~/.venv/hairball
0. Load the virtual environment (Note: you will need to run this everytime you open a new terminal to run the project’s commands)
source ~/.venv/hairball/bin/activate
Install the package and its dependencies in development mode
cd hairball python setup.py develop
# Developing Plugins
## Loading Plugins
The plugins for the web service are stored in the hairball/hairball/plugins folder. The association between projects and plugins is contained the attribute plugins of a project in the database. See the above section on Working with the Database for information on adding and removing projects. Note that both the webserver processes and the process_scratch_files processes need to be restarted whenever projects are modified.
## Writing Plugins
A plugin is a python class that inherits from the class hairball.plugins.PluginBase and defines at least a __init__ function, a _process function and a class doc string (a comment).
The classes that define plugins should be grouped by functionality into a single python module (.py file) and placed in the plugins folder. For example, a set of plugins dealing with scratch audio might be grouped into the file audio.py. If their class names were SpriteVolume, UniqueBeats, and VolumeReset then the plugin names would be audio.SpriteVolume, audio.UniqueBeats and audio.VolumeReset respectively.
A complete example of a simple plugin, referred to as simple.Simple (or shortened as simple when the class name is the title-cased version of the module name) is as follows:
### sample.py
from . import PluginBase
- class Simple(PluginBase):
“””Produces the standard ‘Hello World’ message.”””
- def __init__(self, batch):
super(Simple, self).__init__(name=’The Simple Plugin’, batch=batch)
- def _process(self, scratch):
return ‘Hello World!’
—
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file hairball-0.1b.tar.gz
.
File metadata
- Download URL: hairball-0.1b.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a66570e35e6ecbadd8995d1dc5a3164f715226b58df0c8ce0e0d95b1eb7208d |
|
MD5 | cef34a08618c743f74676492c3b7cd33 |
|
BLAKE2b-256 | 83a553fb0b191e06e2abd279f1a35ccb25b470e52eab52ceff8318f62b27ff20 |