|
| 1 | +## Contributing |
| 2 | + |
| 3 | +Thanks for helping improve fastapi-cloudflow! This guide explains how to develop locally, run tests, and the project structure expectations so contributions stay consistent. |
| 4 | + |
| 5 | +### Prerequisites |
| 6 | +- Python 3.13 |
| 7 | +- [uv](https://github.com/astral-sh/uv) for env/install |
| 8 | + |
| 9 | +### Setup |
| 10 | +``` |
| 11 | +uv sync |
| 12 | +``` |
| 13 | + |
| 14 | +### Commands (local) |
| 15 | +- Lint: `uv run ruff check --fix .` |
| 16 | +- Types: `uv run ty check` |
| 17 | +- Unit tests: `uv run pytest -q tests/unit` |
| 18 | +- Codegen tests (snapshots): `uv run pytest -q tests/codegen` |
| 19 | + - First run creates snapshots under `tests/codegen/fixtures/yaml` if missing; commit them |
| 20 | +- Full test suite: `uv run pytest -q` |
| 21 | + |
| 22 | +### Smoke tests |
| 23 | +Run end-to-end against deployed Workflows (requires Google Cloud project and a deployed example app): |
| 24 | +``` |
| 25 | +export GOOGLE_CLOUD_PROJECT=<your-project> |
| 26 | +uv run -q python tests/smoke/run_smoke.py --region us-central1 |
| 27 | +``` |
| 28 | + |
| 29 | +### Project structure |
| 30 | +- `src/fastapi_cloudflow/` |
| 31 | + - The reusable library (FastAPI-first) and CLI. Includes a FastAPI runtime (`attach_to_fastapi`) plus codegen/CLI. Keep it typed and well-tested |
| 32 | + |
| 33 | +- `examples/app/` |
| 34 | + - A realistic FastAPI app showcasing multi-step, playful workflows |
| 35 | + - Naming: files should reflect the workflow domain (e.g., `echo_name.py`, `post_story.py`, `jokes.py`) |
| 36 | + - Every workflow is multi-step and demonstrates transformations; avoid duplicates covering the exact same feature |
| 37 | + |
| 38 | +- `tests/` |
| 39 | + - `unit/`: FastAPI TestClient calls each step endpoint (`/steps/<name>`). Scope: step contracts (Pydantic I/O), route registration, and runtime error paths (422s for malformed/missing body, wrapper support) |
| 40 | + - `codegen/`: Runs the CLI to generate YAML and compares full-file snapshots under `tests/codegen/fixtures/yaml`. Scope: codegen stability and header/auth/timeout/ArgExpr emission |
| 41 | + - `smoke/`: Python runner that deploys Workflows and invokes them via gcloud, asserting final outputs. Scope: end-to-end validation of the example app + generated Workflows |
0 commit comments