Skip to content

Contributing

How to set up a local environment, run the same lint, test and migration checks as CI, and land a change in fredgar-ai.

Thanks for contributing to Fredgar AI (FRED + EDGAR, with AI) — a Django + DRF backend and Vite/React UI for SEC EDGAR company data and FRED macro series, with AI-assisted analysis. Repo: fredgar-ai.

Prerequisites

  • Python 3.12+
  • Node.js 20+ (for the Vite frontend)
  • Optional: Docker with Compose (matches CI-style checks)

Python environment

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt -r requirements-dev.txt
cp src/.env.example src/.env
# Set USER_AGENT_EMAIL for any command that calls SEC.
# src/.env is loaded automatically by config/settings.py (python-dotenv);
# real environment variables already set take precedence.

Dependencies

Runtime deps are managed with pip-tools: edit requirements.in (bounded ranges) and regenerate the pinned lock:

pip-compile requirements.in            # rewrites requirements.txt
pip-compile --upgrade-package django requirements.in   # bump one package

Common tasks are wrapped in the Makefile: make lint, make test, make typecheck, make migrations, make all.

Run Django from src/:

cd src
python manage.py migrate
python manage.py runserver

PYTHONPATH and DJANGO_SETTINGS_MODULE are set automatically when using cd src and the project layout; tests use config.settings_test via pyproject.toml [tool.pytest.ini_options].

Lint and tests

From the repository root:

ruff check src tests
ruff format src tests
pytest -q

Coverage thresholds apply in Docker CI (docker compose --profile ci); local pytest runs without the coverage gate unless you pass the same flags as docker/ci.sh.

Frontend

cd frontend
npm ci
npm run lint
npm run build

Migrations

After model changes:

cd src
python manage.py makemigrations
python manage.py makemigrations --check --dry-run   # CI-style

Documentation

Security

Never report a vulnerability in a public issue or pull request. Follow SECURITY.md to report it privately, and keep live tokens out of the report.

SEC usage

Identify your application with a valid contact in User-Agent (USER_AGENT_EMAIL / SEC_USER_AGENT_EMAIL per settings). Follow SEC fair access guidance.