You'll need to install:
Python >= 3.11
Node.js
and npm
redis-server
nim >=2.0.0
(https://nim-lang.org/install.html)
(Note that Debian distros have only packaged 1.6.x
as of Jan 2024)
Start a redis server if not running
redis-server --daemonize yes
Installing deps
cd backend
python3 -m venv env
source env/bin/activate
uv pip install -r requirements.txt
DEBUG=1 alembic ugprade head
cd ../frontend
npm install
cd ../frameos
nimble install -d
nimble setup
cd ..
To run all services at once:
cd frontend
npm run dev &
cd ../backend
bin/dev
To run all of these separately:
# start the frontend
cd frontend
npm run dev
cd ..
# apply any migrations
cd backend
DEBUG=1 python -m alembic upgrade head
# start the backend
cd backend
DEBUG=1 python -m app.fastapi
# start the job queue
cd backend
DEBUG=1 arq app.tasks.worker
cd backend
# create migration after changing a model
DEBUG=1 python -m alembic revision --autogenerate -m "name of migration"
# run pending migrations
DEBUG=1 python -m alembic upgrade head
# run linter on files changes in every commit
pre-commit install
# run linter on all files
pre-commit run --all-files
# uninstall if causing problems
pre-commit uninstall
cd backend
pytest
Running it natively on a Mac will fail with
spidev_module.c:33:10: fatal error: 'linux/spi/spidev.h' file not found
#include <linux/spi/spidev.h>
So we use Docker:
cd frameos
docker build -t frameos-frame . && docker run -t -i frameos python3 test.py
Tracked here: #1