Tested on:Raspberry Pi 2; Raspberry Pi B+; Python 2.7
Prerequisites:Raspberry Pi with Raspbian Jessie and internet connection (see steps 1-7 in the Introduction)
0

Standard python project file setup

In the most simple case, one file script.py suffices for an application. However, as the complexity of the project grows, more sophisticated approaches become practical. A project setup like presented here is well-suited to be shared on GitHub.

Basic project structure

Basic project file structure

Basic project file structure

This basic setup contains

  • AUTHORS: all the projects authors an their email addresses
  • CHANGES: text-based changelog for all major versions
  • LICENCE: licence informations of the project
  • README.md: textfile explaining the project, usually with usage examples
  • requirements.txt: list of dependencies, can be used to automatically install them with pip
  • setup.py: a script for generating a zipped version of the application
  • TODO.txt: planned extensions, required bugfixes ect.

Download the basic python project files from GitHub onto the Raspberry Pi with

Using the sample project

Take a look at the README.md of the downloaded sample setup.

Make the project executable
First, make sure the first line of myproject.py is

Then, type in the terminal

For large applications, consider using a test-driven approach instead.

Links
GitHub introduction: http://www.knight-of-pi.org/manage-raspberry-pi-python-projects-on-github/
Pip tutorial: http://www.knight-of-pi.org/howto-install-the-python-package-manager-pip/
Python packages with setup.py: http://www.knight-of-pi.org/creating-own-python-packages-with-setup-py/
Test-driven project setup: http://www.knight-of-pi.org/python-project-setup-test-driven-development/

Knight of Pi

Johannes Bergs aka Knight of Pi. Diploma in Bioinformatics, some Webdesign and Python coding then. Living in the beautiful city of Vienna.

Comment

Time limit is exhausted. Please reload CAPTCHA.