Local Development Setup¶
Set up a local development environment for GreenThumb.
Prerequisites¶
- Python 3.11+
- Docker and Docker Compose
- Git
- (Optional) Raspberry Pi 5 for hardware testing
Clone Repositories¶
# Create workspace
mkdir greenthumb && cd greenthumb
# Clone repositories
git clone https://github.com/GreenThumbProject/rasp5.git
git clone https://github.com/GreenThumbProject/greenthumb-core.git
git clone https://github.com/GreenThumbProject/docs.git
greenthumb-core Development¶
Setup¶
cd greenthumb-core
python -m venv .venv
source .venv/bin/activate # Linux/Mac
# .venv\Scripts\activate # Windows
pip install -e .
With Hardware Support¶
Note
Hardware dependencies only work on Raspberry Pi with I2C enabled.
Testing¶
# Test database utilities
from greenthumb_core.db import get_engine
engine = get_engine()
print("Database connected!")
# Test models
from greenthumb_core.models import Device
print(Device.__tablename__)
rasp5 Development¶
Setup¶
Run with Docker¶
Run API Locally (without sensors)¶
cd microcontroller-api
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
# Need greenthumb-core
pip install git+https://${GH_PAT}@github.com/GreenThumbProject/greenthumb-core.git
# Start PostgreSQL
docker compose up -d db
# Run API
uvicorn app:app --reload --port 8080
docs Development¶
Setup¶
Preview¶
Build¶
Testing on Raspberry Pi¶
SSH Setup¶
Deploy for Testing¶
View Logs¶
IDE Setup¶
VS Code Extensions¶
- Python
- Pylance
- Docker
- YAML
- Markdown All in One
settings.json¶
{
"python.defaultInterpreterPath": ".venv/bin/python",
"python.formatting.provider": "black",
"editor.formatOnSave": true,
"[python]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
}
}
Environment Variables¶
Create .env files as needed: