Skinner Box
This repository contains the code for running and managing a Skinner Box experimental setup.
Table of Contents
- First Time Setup
- Installation with setup.py
- Running the Application
- Development and Versioning
- Network Configuration
- Automating with Crontab
- Running in WSL
- Troubleshooting
First Time Setup
On Raspberry Pi:
-
Download and unzip the repository on your Raspberry Pi
-
Navigate to the project directory and run the installer script:
$ chmod +x installer.sh $ ./installer.shThis will install all necessary packages and dependencies.
-
After installation, verify that all components are working properly:
$ python test.py
Installation with setup.py
For development installations or if the installer script doesn't meet your needs, you can use setup.py:
-
Install in development mode (changes to code take effect immediately):
$ pip install -e . -
Install as a regular package:
$ pip install . -
Build a distribution package:
$ python setup.py sdist bdist_wheelThis creates distributable packages in the
dist/directory. -
Install specific dependencies:
$ pip install -r requirements.txt
Note: The setup.py file automatically reads the version from "version.txt" and requirements from "requirements.txt".
Running the Application
You can run the application using either the shell script or directly with Python:
$ ./run.sh
Or:
$ python run.py
Development and Versioning
Version Control:
When merging changes with the main branch, use bump2version to increment version numbers:
$ bump2version [major|minor|patch]
Examples:
- For major version changes:
bump2version major - For minor feature additions:
bump2version minor - For bug fixes:
bump2version patch
Contributing:
- Create a feature branch from main
- Make your changes
- Run tests to ensure functionality
- Submit a pull request
Network Configuration
To set up the network on Raspberry Pi:
- Click on the network icon in the top right corner of the screen
- Select "Advanced Connections" → "Edit Connections" → "Wired Connection 1" → "Settings" → "IPv4 Settings"
- Change "Method" to "Manual"
- Click "Add" under "Additional Static Addresses"
- Open a terminal and type
ifconfigto get your network information - In the Network Connection dialog:
- Address: Enter the inet address shown in the terminal (or your preferred custom value)
- Netmask: Enter the netmask value from terminal
- Gateway: Enter the broadcast address from terminal
- Click "Save" to apply changes
- Restart the network service:
$ sudo service networking restart
Automating with Crontab
To set up automatic execution:
-
Open a terminal and enter:
$ crontab -e -
Select your preferred editor if prompted
-
Add one of the following lines at the end of the file:
-
To run the script daily at 8 AM:
0 8 * * * cd /path/to/skinner_box && ./run.sh > /path/to/skinner_box/logs/daily_run.log 2>&1 -
To run on system startup:
@reboot cd /path/to/skinner_box && ./run.sh > /path/to/skinner_box/logs/startup.log 2>&1
-
-
Save and exit the editor
Running in WSL
To run this application in a Debian WSL virtual environment:
-
Navigate to the project directory:
$ cd /mnt/c/Users/jacob/Documents/GitHub/skinner_box -
Create a virtual environment if you haven't already:
$ python -m venv venv -
Activate the virtual environment:
$ source venv/bin/activate -
Install required dependencies:
$ pip install -r requirements.txt(If requirements.txt doesn't exist, create it or install dependencies manually)
-
Run the application:
$ python main.py
Additional Dependencies for WSL
You might need to install additional packages depending on your setup:
- For GPIO functionality (if running on a Raspberry Pi):
pip install RPi.GPIO gpiozero - For the Flask web app:
pip install flask
Troubleshooting
Common Issues:
-
GPIO Permission Errors: If you encounter permission issues when accessing GPIO pins, try:
$ sudo chmod -R 777 /dev/gpiomem -
Network Connection Issues: Verify your network settings with:
$ ping 8.8.8.8 -
Application Not Starting: Check the logs in the
logs/directory
For additional help, please create an issue on the GitHub repository.
Metadata
Release files for Skinnerbox-Source 0.4.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| skinnerbox_source-0.4.14.tar.gz | 15.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| skinnerbox_source-0.4.14-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.0 kB
Release files / skinnerbox_source-0.4.14.tar.gz
| Download URL | skinnerbox_source-0.4.14.tar.gz |
|---|---|
| Size | 15.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
39e1ff0bb58f153d56d2aa8abbe641f50baff154154dd3d1014b805149609964
|
|
BLAKE2b-256 checksum How to use checksums |
826191bb90b12289dd9e862f30354cd206ac0a2b6f5da4d0653445ce30e883a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 2, 2025.
Transparency logRelease files / skinnerbox_source-0.4.14-py3-none-any.whl
| Download URL | skinnerbox_source-0.4.14-py3-none-any.whl |
|---|---|
| Size | 16.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c6412b40365e1916ab69214df79dda30e223e38dec9edb96a7d45de9f49eb970
|
|
BLAKE2b-256 checksum How to use checksums |
8ddd7ac0e1dbdbb576f6c88ba3b46c8fc064352d69c8e929fb1f21f3dbe77c7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 2, 2025.
Transparency log