Setting up a dev environment
protohaven_api
To setup development of protohaven_api repository:
# Clone the repository
git clone git@github.com:protohaven/protohaven_api.git
# Install dependencies
cd protohaven_api
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Set up pre-commit validation hooks
pip install pre-commit
pre-commit install
For this next step, you'll need to download mock_data.pkl to have some sanitized test data to operate on. Place this file in the root of the repository.
# Test your setup - you should see a YAML formatted message about proposed classes
python3 -m protohaven_api.cli class_proposals
Run Tests
To run all python tests: pytest -vv
, optionally with -k test_substring
to run a specific test.
Run API Flask server / Svelte frontend
# In one console, run this to start a "minimal" Flask server without enforced access control:
cd protohaven_api
source venv/bin/activate
MQTT=false CORS=true UNSAFE_NO_RBAC=true flask --app protohaven_api.main run
# In another console, run this to start a hot-reloading Svelte dev instance:
cd protohaven_api/svelte
npm install
npm run dev
Run Bookstack