Open
Conversation
Pull Request Test Coverage Report for Build 7fbd087c-0308-4fa9-af77-861aba9664f4Details
💛 - Coveralls |
e7a8b5c to
362196a
Compare
Replace the Dockerfile-centric project definition with pyproject.toml (PEP 621) for Airflow 3 projects. This aligns with the Python ecosystem, enables the uv-based standalone runtime, and lays the groundwork for multi-target compilation. Parser and detection (airflow/project.go): - ReadProject(), IsPyProject(), DetectProjectFormat(), PinRuntimeVersion() - Detection requires [tool.astro] to avoid false positives from ruff/pytest pyproject.toml files astro dev init --format pyproject: - Scaffolds pyproject.toml projects with no Dockerfile or requirements.txt - Resolves airflow-version and runtime-version from the API - Validates: AF3 only, mutual exclusion with --from-template Standalone mode reads pyproject.toml: - Reads versions and dependencies from [tool.astro] and [project] - Falls back to Dockerfile parsing for legacy projects Docker mode generates Dockerfile from pyproject.toml: - GenerateDockerfile() produces FROM + optional apt-get for system packages - EnsureDockerfile() called at build time so pyproject.toml edits are always picked up - Generated file written to .astro/Dockerfile.pyproject (gitignored) - System package names validated against Debian naming rules Runtime version resolution: - runtime-version is optional in pyproject.toml — resolved from airflow-version on first start/build and pinned back to pyproject.toml - Mismatch between airflow-version and runtime-version triggers a warning - Warns users that multiple runtimes exist per Airflow version to prevent accidental upgrades on deploy
362196a to
06d03a2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the Dockerfile-centric project definition with
pyproject.toml(PEP 621) for Airflow 3 projects. An Airflow project is a Python project — this aligns with the ecosystem, enables the uv-based standalone runtime, and lays the groundwork for multi-target compilation.pyproject.toml parser and project format detection
New
airflow/project.gowithReadProject(),IsPyProject(),DetectProjectFormat(), andPinRuntimeVersion(). Parses[project]and[tool.astro]sections. Detection requires the[tool.astro]key — a pyproject.toml from ruff or pytest won't trigger new behavior.astro dev init --format pyprojectNew
--formatflag:pyproject(AF3 only) ordockerfile(default, unchanged). Scaffolds a clean project withpyproject.toml,dags/,tests/,.env,airflow_settings.yaml. Resolves airflow-version and runtime-version from the API. Includespackages.txtandrequirements.txtstubs needed by the runtime ONBUILD for Docker mode.Standalone mode reads pyproject.toml
astro dev start --standalonedetects pyproject format and reads versions frompyproject.tomlinstead of parsing the Dockerfile. User dependencies from[project.dependencies]installed viauv pip install. Legacy Dockerfile path completely unchanged.Docker mode generates Dockerfile from pyproject.toml
astro dev start --docker(orastro dev startwithmode = "docker"in pyproject.toml) generates a Dockerfile at.astro/Dockerfile.pyprojectfrom the project definition. IncludesFROMline from runtime-version,USER root/apt-get install/USER astrofor system packages. Generated on every build so pyproject.toml edits are always picked up. System package names validated against Debian naming rules.Runtime version resolution
runtime-versionis optional in pyproject.toml. On firstdev startordocker build, the CLI resolves the latest runtime for the givenairflow-version, pins it back to pyproject.toml, and warns that multiple runtimes may exist per Airflow version (to prevent accidental upgrades on deploy). Mismatches betweenairflow-versionandruntime-versionproduce a warning.Mode from pyproject.toml
[tool.astro].mode("standalone"or"docker") is respected byastro dev startwithout needing--standaloneor--dockerflags. CLI flags still take precedence.Hand-written Dockerfile escape hatch
If a
Dockerfileexists in the project root alongsidepyproject.toml, the CLI uses it instead of generating one. This supports users who need custom Docker steps beyond what pyproject.toml can express.Schema
runtime-versionis auto-resolved and pinned on first run. Users only need to specifyairflow-version.Design rationale
[tool.astro]detection, not just pyproject.toml existence? Projects often have pyproject.toml for ruff, pytest, or mypy config. We only activate new behavior when[tool.astro]is explicitly present.[[tool.uv.index]]in the template? The Astronomer index is already controlled by the CLI via--index-urlin standalone mode and baked into the Docker image via/etc/uv/uv.toml. Users who need private indexes can add their own[[tool.uv.index]]entries.dev startcould silently resolve to a different runtime between runs, causing inconsistencies between local dev and deployed environments.Dockerfilein the project root. The CLI detects it and skips generation.--format pyprojecton init or manual creation of pyproject.toml with[tool.astro].Linear: AI-77