This guide consolidates all the steps needed to get the Data Sources App running locally.
- Python 3.12 (specifically 3.12.8 for CI parity)
- Docker — for the local test database (install)
- Git
git clone https://github.com/Police-Data-Accessibility-Project/data-sources-app.git
cd data-sources-appThe project uses uv for package management (matching CI and Docker builds):
# Install uv if you don't have it
pip install uv
# Install all dependencies from the lockfile
uv sync --locked --all-extras --devAlternative (pip): If you prefer pip, you can use virtualenv:
pip install virtualenv
virtualenv -p python3.12 venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
pip install "psycopg[binary,pool]"pre-commit install
# Optionally run against all files
pre-commit run --all-filesCreate a .env file in the project root. See ENV.md for the full list.
Minimum required for local development:
# Database connection (see step 5 for local DB, or use sandbox)
DO_DATABASE_URL="postgresql+psycopg://test_data_sources_app_user:[email protected]:5432/test_data_sources_app_db"
# Auth (can be dummy values for local development)
JWT_SECRET_KEY="myLocalJwtSecretKey"
FLASK_APP_COOKIE_ENCRYPTION_KEY="myLocalCookieKey"
RESET_PASSWORD_SECRET_KEY="myLocalResetKey"
VALIDATE_EMAIL_SECRET_KEY="myLocalValidateKey"
# GitHub OAuth (get real values from the team, or use dummies if not testing OAuth)
GH_CLIENT_ID="GithubProvidedClientId"
GH_CLIENT_SECRET="GithubProvidedClientSecret"
GH_CALLBACK_URL="http://localhost:8000/api/v2/auth/callback"For full access to all secrets, reach out to [email protected] or ask in Discord.
You have two options:
This creates an empty local PostgreSQL instance, useful for testing migrations and schema changes.
# From the repository root
cd local_database
python setup.pyOr manually:
cd local_database
docker compose -f docker_compose.yml up -dThen set your .env:
DO_DATABASE_URL="postgresql+psycopg://test_data_sources_app_user:[email protected]:5432/test_data_sources_app_db"Run migrations to create the schema:
uv run alembic upgrade headTo populate with data, see the DataDumper instructions.
To stop the database:
docker compose -f docker_compose.yml downThe sandbox is a remote database refreshed daily from production (with sensitive data excluded). Get connection credentials from the team — see CONTRIBUTING.md for details.
Set DO_DATABASE_URL in your .env to the sandbox connection string.
python app.pyThis starts uvicorn on 127.0.0.1:8000 by default.
# The execute.sh script runs gunicorn with uvicorn workers
docker build -t data-sources-app .
docker run -p 8080:8080 --env-file .env data-sources-app ./execute.sh- v2 Swagger: http://localhost:8000/api/v2/
- v3 OpenAPI: http://localhost:8000/api/v3/docs
If you need to run the pdap.io client against your local API:
- Set
VITE_VUE_API_BASE_URL=http://localhost:8000in the client's environment. - Reach out to @maxachis or @joshuagraber in Discord for help with full-stack local development.
Generally, local API development can be verified using curl or the Swagger UI without running the client.