3.5 KiB
3.5 KiB
Repository Guidelines
Project Structure & Module Organization
airflow/dags/— Airflow DAGs (e.g.,airflow/dags/kafka_to_greenplum.py).airflow/requirements.txt— Python deps installed inside Airflow containers.sql/— database DDL and helpers (e.g.,sql/ddl_gp.sql).docker-compose.yml— Greenplum, Kafka, Airflow, Postgres (metadata DB).Makefile— local DX commands; see targets below..env(.example)— runtime configuration; never commit real secrets.
Build, Test, and Development Commands
make up— start the full stack.make airflow-init— migrate metadata DB and create admin user.make logs— follow webserver and scheduler logs.make ddl-gp— apply DDL to Greenplum.make gp-psql— openpsqlin the GP container.make down— stop stack and remove volumes. Example:make up && make airflow-initthen openhttp://localhost:8080.
Локальное Python-окружение
- Окружением управляет
uv:uv python install 3.11иuv python pin 3.11скачивают и фиксируют версию Python для проекта. uv sync(илиmake dev-setup/make dev-sync) создаёт.venvи ставит dev-зависимости изpyproject.toml/uv.lock.- Команды разработчика:
make test,make lint,make fmt(под капотом выполняются черезuv run). - Не используем
pip install --user; если пакеты попали в user-site, удаляем черезpip uninstall <package>и проверяемpip list --user. - В IDE выбираем интерпретатор из
.venv(.venv\Scripts\python.exeна Windows,.venv/bin/pythonна Linux/macOS).
Coding Style & Naming Conventions
- Python: PEP 8, 4-space indents,
snake_casefor functions/vars, DAG IDs lower_snake_case. - Imports: stdlib → third-party → local; prefer one module per line.
- SQL: uppercase keywords,
snake_caseidentifiers, end statements with;. - Filenames: DAGs as
<source>_to_<target>.py(e.g.,kafka_to_greenplum.py). - Formatting: if available, use
black(88 cols) andisort; otherwise keep existing style. - Language: комментарии, docstrings и документацию (README, описания PR/Issues) пишем на русском; имена идентификаторов и код — на английском.
Testing Guidelines
- No test suite yet. If adding tests, use
pytestundertests/withtest_*.py. - Prefer unit tests for Python callables used by tasks; mock env vars and external systems.
- Run locally with
pytest -q.
Commit & Pull Request Guidelines
- Use Conventional Commits:
feat:,fix:,docs:,chore:,refactor:etc. Example:feat(dags): load orders to Greenplum. - Keep PRs focused; include a description, run steps, and relevant screenshots (e.g., DAG graph or task logs).
- Link issues; update
README.mdand DDL when behavior or schema changes.
Security & Configuration Tips
- Configure via
.env; do not hardcode credentials. Common vars:GP_USER,GP_PASSWORD,GP_DB,GP_PORT,PG_*,AIRFLOW_*. - Be cautious with
make down(removes volumes). Pin images/deps; prefer digests for critical images.
Agent-Specific Notes
- Keep changes minimal and localized; do not rename Make targets without updating docs.
- Validate by running
make up,make airflow-init, and inspecting the DAG in Airflow.