- To develop Python 3 applications directly on a Raspberry Pi 4 using your own development machine.
- To provide a template project to connect remotely to a Raspberry Pi 4 and for building Python Applications for Raspberry Pi 4 using Visual Studio Code, along with the associated tools.
- A containerized development environment using the Remote-Containers extension.
- Docker (Docker In Docker)
- Git
- Python 3.7
- PipEnv
- Ruby
- Curl, Vim
- Clone this repository or copy just the
.devcontainer
and.vscode
folder into your own local git repository folder. You can also run the following script in your terminal.
bash <(wget -qO- https://raw.githubusercontent.com/senglin/python-rpi4-workspace/master/install.sh)
- Start VS Code.
- Modify
.vscode/settings.json
with the username and location of the Raspberry Pi 4 device, accessible from your development machine. - In a new window, click on the quick actions Status Bar item in the lower left corner.
- Select Remote-Containers:Reopen in Container.
- From the menu, select Terminal -> New Terminal. You can now use the installed tools to clone, develop and build in your RPi4 device.
- As an example, you can try out this Hello World project for the Raspberry Pi 4.
For projects that has Pipfile
, you may execute the following line to create a virtual environment
$ pipenv install --dev
Set VS Code to use the created Python Virtual Environment. Use .venv/bin/python
which should be in the current project folder.
VS Code will have access to all modules that were installed using pipenv
.
- The container app reuses ssh private key configuration from the host. SSH-AGENT settings are forwarded to the container application.
PIPENV_VENV_IN_PROJECT
has been set so that the commandpipenv install
will install / create virtual environments in the current project folder, rather than the user home folder on the Raspberry Pi.