diff --git a/dev/AGENTS.md b/dev/AGENTS.md new file mode 100644 index 0000000000000..947e0ac9e8e42 --- /dev/null +++ b/dev/AGENTS.md @@ -0,0 +1,44 @@ + + + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [dev/ directory guidelines](#dev-directory-guidelines) + - [Scripts](#scripts) + + + +# dev/ directory guidelines + +## Scripts + +New scripts in `dev/` must be standalone Python scripts (not bash). Each script must include +[inline script metadata](https://packaging.python.org/en/latest/specifications/inline-script-metadata/) +placed **after** the Apache License header, so that `uv run` can execute it without any prior +installation: + +```python +#!/usr/bin/env python3 +# Licensed to the Apache Software Foundation (ASF) ... +# http://www.apache.org/licenses/LICENSE-2.0 +# ... +# /// script +# requires-python = ">=3.9" +# dependencies = [ +# "some-package", +# ] +# /// +``` + +If the script only uses the standard library, omit the `dependencies` key but keep the +`requires-python` line. + +Run scripts with: + +```shell +uv run dev/my_script.py [args...] +``` + +Document `uv run` (not `python`) as the invocation method in READMEs and instructions. diff --git a/scripts/ci/prek/AGENTS.md b/scripts/ci/prek/AGENTS.md new file mode 100644 index 0000000000000..2b36b334f7307 --- /dev/null +++ b/scripts/ci/prek/AGENTS.md @@ -0,0 +1,31 @@ + + +# scripts/ci/prek/ guidelines + +## Overview + +This directory contains prek (pre-commit) hook scripts. Shared utilities live in +`common_prek_utils.py` — always check there before duplicating logic. + +## Breeze CI image scripts + +Some prek scripts require the Breeze CI Docker image to run (e.g. mypy checks, OpenAPI spec +generation, provider validation). These scripts use the `run_command_via_breeze_shell` helper +from `common_prek_utils.py` to execute commands inside the container. + +When adding a new breeze-dependent hook: + +1. Import and use `run_command_via_breeze_shell` from `common_prek_utils` — do not shell out + to `breeze` directly. +2. Register the hook at the **end** of the relevant `.pre-commit-config.yaml` file (breeze + hooks are slow and should run after fast, local checks). + +## Adding new hooks + +- Scripts must be Python (not bash). +- Use helpers from `common_prek_utils.py` for path constants, console output, and breeze + execution. +- Register the script in the appropriate `.pre-commit-config.yaml` (`/.pre-commit-config.yaml` + for repo-wide hooks, `/airflow-core/.pre-commit-config.yaml` for core-specific hooks, or a + provider-level config).