File size: 4,106 Bytes
e59d91d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
title: Python Packaging Map
description: Which dependency manifest to use β€” the canonical uv workspace vs the runtime requirements.txt vs the optional environment-specific requirements-*.txt extras.
---

# Python Packaging Map

The repo carries several dependency manifests for historical and
environment-specific reasons. They are **not interchangeable** β€” this page is the
authoritative map of what each one is for. If you are onboarding, read the
[**Canonical path**](#canonical-path) first; everything else is an opt-in extra.

## Canonical path

- **`pyproject.toml` + `uv.lock` β€” the source of truth for the `packages/*` workspace.**
  This is a [uv](https://docs.astral.sh/uv/) workspace (`[tool.uv.workspace] members =
  ["packages/*"]`). The root `pyproject.toml` is *virtual* (not itself buildable). Install
  the workspace with:

  ```bash
  uv sync
  ```

  New Python belongs in `packages/` as a proper library β€” see `CLAUDE.md` and the
  [Cleanup Roadmap](./cleanup-roadmap.md).

- **`requirements.txt` β€” the application runtime dependency set.** This is what the
  Docker images, CI (`ci-build-test.yml`), and the `install.sh` / `install.ps1`
  bootstrap scripts install for the FastAPI app + ingestion/scraping runtime. It predates
  the uv workspace and still backs the deploy/runtime paths, so **it is load-bearing β€”
  do not delete or rename it** without rewiring those consumers (Dockerfile,
  Dockerfile.huggingface, CI, install scripts, deployment docs).

## Optional / environment-specific extras

Each `requirements-*.txt` is a deliberately-separate, self-documented extra (see the
header comment in each file). Install **on top of** the base only when you need that
workflow:

| File | Purpose | Install |
|---|---|---|
| `requirements-dbt.txt` | dbt-postgres for the dbt project. Pulls protobuf 6.x / pathspec that **conflict** with the main `.venv`, so it lives in a **separate** `.venv-dbt`. | `./packages/scrapers/scripts/openstates_setup_dbt_venv.sh` |
| `requirements-gemini-api.txt` | `google-genai` for transcript policy analysis (`meeting_transcript_policy.py`). | `pip install -r requirements-gemini-api.txt` |
| `requirements-transcript-diarize.txt` | Optional WhisperX speaker diarization (`--diarize`); pins `numpy<2`; needs `HF_TOKEN`. | `.venv/bin/pip install -r requirements-transcript-diarize.txt` |
| `requirements-spark.txt` | Spark / Delta Lake (~300 MB, needs a JDK). Only the discovery batch workflows use it. | `pip install -r requirements-spark.txt` |
| `requirements-ollama-scraping.txt` | Local Ollama + LangChain structured scraping. | `.venv/bin/pip install -r requirements.txt -r requirements-ollama-scraping.txt` |
| `requirements-cpu.txt` | CPU-only variant of the runtime (no CUDA), used by `Dockerfile.app` + the databricks/local install scripts. | `pip install -r requirements-cpu.txt` |
| `requirements-intel.txt` | Intel Arc / NPU-optimized ML stack (`intel-extension-for-pytorch`). | `pip install -r requirements-intel.txt` |

## Virtual environments

There is intentionally **more than one** venv:

- **`.venv`** β€” the main app/runtime + the uv workspace.
- **`.venv-dbt`** β€” isolated dbt environment (protobuf/pathspec pins conflict with
  `.venv`; see `requirements-dbt.txt`). The dbt project under `dbt_project/` is a
  standalone uv project for the same reason.

## Known cleanup follow-ups

These are **deferred** (each needs its own change + verification), tracked here so the
state is explicit rather than surprising:

- **`setup.py`** is legacy `setuptools` metadata, still referenced by the HuggingFace
  deploy script (`packages/hosting/scripts/huggingface/deploy-huggingface.sh`) and a
  rename-repo doc. It is a removal candidate **once that script is migrated** to the uv
  workspace β€” not before.
- **Consolidating the runtime onto uv** (so `requirements.txt` / `requirements-cpu.txt`
  are generated via `uv export` rather than hand-maintained) requires rewiring the
  Dockerfiles, CI, and install scripts together. It is a deliberate, scoped effort
  (Theme 4 of the repo-wide refactor & tech-debt plan).