SIGN IN SIGN UP
apache / airflow UNCLAIMED

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows

44796 0 1 Python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
---
default_stages: [pre-commit, pre-push]
default_language_version:
python: python3
node: 22.17.1
golang: 1.24.0
minimum_pre_commit_version: '3.2.0'
exclude: ^.*/.*_vendor/
repos:
- repo: meta
hooks:
- id: identity
name: Print checked files
description: Print input to the static check hooks for troubleshooting
- id: check-hooks-apply
name: Check if all hooks apply to the repository
- repo: https://github.com/thlorenz/doctoc.git
rev: v2.2.0
hooks:
- id: doctoc
name: Add TOC for Markdown and RST files
files:
(?x)
^README\.md$|
^UPDATING.*\.md$|
^chart/UPDATING.*\.md$|
^dev/.*\.md$|
^dev/.*\.rst$|
^docs/README\.md$|
^\.github/.*\.md$|
^airflow-core/tests/system/README\.md$
args:
- "--maxlevel"
- "2"
- repo: https://github.com/Lucas-C/pre-commit-hooks
# replace hash with version once PR #103 merged comes in a release
rev: abdd8b62891099da34162217ecb3872d22184a51
hooks:
- id: insert-license
name: Add license for all SQL files
files: \.sql$
exclude: |
(?x)
^\.github/
args:
- --comment-style
- "/*||*/"
- --license-filepath
- scripts/ci/license-templates/LICENSE.txt
- --fuzzy-match-generates-todo
- id: insert-license
name: Add license for all RST files
exclude: ^\.github/.*$|newsfragments/.*\.rst$
args:
- --comment-style
- "||"
- --license-filepath
- scripts/ci/license-templates/LICENSE.rst
- --fuzzy-match-generates-todo
files: \.rst$
- id: insert-license
name: Add license for CSS/JS/JSX/PUML/TS/TSX
files: \.(css|jsx?|puml|tsx?)$
exclude: ^\.github/.*$|ui/openapi-gen/|.*/dist/.*
args:
- --comment-style
- "/*!| *| */"
- --license-filepath
- scripts/ci/license-templates/LICENSE.txt
- --fuzzy-match-generates-todo
- id: insert-license
name: Add license for all Shell files
exclude: ^\.github/.*$|^dev/breeze/autocomplete/.*$
files: \.bash$|\.sh$
args:
- --comment-style
- "|#|"
- --license-filepath
- scripts/ci/license-templates/LICENSE.txt
- --fuzzy-match-generates-todo
Generate Python client in reproducible way (#36763) Client source code and package generation was done using the code generated and committed to `airflow-client-python` and while the repository with such code is useful to have, it's just a convenience repo, because all sources are (and should be) generated from the API specification which is present in the Airflow repository. This also made the reproducible builds and package generation not really possible, because we never knew if the source generated in the `airflow-client-python` repository has been generated and not tampered with. While implementing it, it turned out that there were some issues in the past that nade our client generation somewhat broken.. * In 2.7.0 python client, we added the same code twice (See https://github.com/apache/airflow-client-python/pull/93) on top of "airflow_client.client" package, we also added copy of the API client generated in "airflow_client.airflow_client" - that was likely due to bad bash scripts and tools that were used to generate it and errors during generation the clients. * We used to generate the code for "client" package and then moved the "client" package to "airflow_client.client" package, while manually modifying imports with `sed` (!?). That was likely due to limitations in some old version of the client generator. However the client generator we use now is capable of generating code directly in the "airflow_client.client" package. * We also manually (via pre-commit) added Apache Licence to the generated files. Whieh was completely unnecessary, because ASF rules do not require licence headers to be added to code automatically generated from a code that already has ASF licence. * We also generated source tarball packages from such generated code, which was completely unnecessary - because sdist packages are already fulfilling all the reqirements of such source pacakges - the code in the packages is enough to build the package from the sources and it does not contain any binary code, moreover the code is generated out of the API specificiation, which means that anyone can take the code and genearate the pacakged software from just sources in sdist. Similarly as in case of provider packages, we do not need to produce separate -source.tar.gz files. This PR fixes all of it. First of all the source that lands in the source repository `airflow-client-python` and sdist/wheel packages are generated directly from the openapi specification. They are generated using breeze release_management command from airflow source tagged with specific tag in the Airflow repo (including the source of reproducible build date that is updated together with airflow release notes. This means that any PMC member can regenerate packages (binary identical) straight from the Airflow repository - without going through "airflow-client-python" repository. No source tarball is generated - it is not needed, sdist is enough. The `test_python_client.py` has been also moved over to Airflow repo and updated with handling case when expose_config is not enabled and it is used to automatically test the API client after it has been generated.
2024-01-14 18:17:20 +01:00
- id: insert-license
name: Add license for all toml files
exclude: ^\.github/.*$|^dev/breeze/autocomplete/.*$
Generate Python client in reproducible way (#36763) Client source code and package generation was done using the code generated and committed to `airflow-client-python` and while the repository with such code is useful to have, it's just a convenience repo, because all sources are (and should be) generated from the API specification which is present in the Airflow repository. This also made the reproducible builds and package generation not really possible, because we never knew if the source generated in the `airflow-client-python` repository has been generated and not tampered with. While implementing it, it turned out that there were some issues in the past that nade our client generation somewhat broken.. * In 2.7.0 python client, we added the same code twice (See https://github.com/apache/airflow-client-python/pull/93) on top of "airflow_client.client" package, we also added copy of the API client generated in "airflow_client.airflow_client" - that was likely due to bad bash scripts and tools that were used to generate it and errors during generation the clients. * We used to generate the code for "client" package and then moved the "client" package to "airflow_client.client" package, while manually modifying imports with `sed` (!?). That was likely due to limitations in some old version of the client generator. However the client generator we use now is capable of generating code directly in the "airflow_client.client" package. * We also manually (via pre-commit) added Apache Licence to the generated files. Whieh was completely unnecessary, because ASF rules do not require licence headers to be added to code automatically generated from a code that already has ASF licence. * We also generated source tarball packages from such generated code, which was completely unnecessary - because sdist packages are already fulfilling all the reqirements of such source pacakges - the code in the packages is enough to build the package from the sources and it does not contain any binary code, moreover the code is generated out of the API specificiation, which means that anyone can take the code and genearate the pacakged software from just sources in sdist. Similarly as in case of provider packages, we do not need to produce separate -source.tar.gz files. This PR fixes all of it. First of all the source that lands in the source repository `airflow-client-python` and sdist/wheel packages are generated directly from the openapi specification. They are generated using breeze release_management command from airflow source tagged with specific tag in the Airflow repo (including the source of reproducible build date that is updated together with airflow release notes. This means that any PMC member can regenerate packages (binary identical) straight from the Airflow repository - without going through "airflow-client-python" repository. No source tarball is generated - it is not needed, sdist is enough. The `test_python_client.py` has been also moved over to Airflow repo and updated with handling case when expose_config is not enabled and it is used to automatically test the API client after it has been generated.
2024-01-14 18:17:20 +01:00
files: \.toml$
args:
- --comment-style
- "|#|"
- --license-filepath
- scripts/ci/license-templates/LICENSE.txt
- --fuzzy-match-generates-todo
- id: insert-license
name: Add license for all Python files
exclude: ^\.github/.*$|^.*/_vendor/.*$|^airflow-ctl/.*/.*generated\.py$
files: \.py$|\.pyi$
args:
- --comment-style
- "|#|"
- --license-filepath
- scripts/ci/license-templates/LICENSE.txt
- --fuzzy-match-generates-todo
- id: insert-license
name: Add license for all XML files
exclude: ^\.github/.*$
files: \.xml$
args:
- --comment-style
- "<!--||-->"
- --license-filepath
- scripts/ci/license-templates/LICENSE.txt
- --fuzzy-match-generates-todo
- id: insert-license
name: Add license for all Helm template files
files: ^chart/templates/.*
args:
- --comment-style
- "{{/*||*/}}"
- --license-filepath
- scripts/ci/license-templates/LICENSE.txt
- --fuzzy-match-generates-todo
- id: insert-license
name: Add license for all YAML files except Helm templates
exclude: >
(?x)
^\.github/.*$|^chart/templates/.*|
.*reproducible_build\.yaml$|
^.*/v2.*\.yaml$|
^.*/openapi/_private_ui.*\.yaml$|
^.*/pnpm-lock\.yaml$|
.*-generated\.yaml$
types: [yaml]
files: \.ya?ml$
args:
- --comment-style
- "|#|"
- --license-filepath
- scripts/ci/license-templates/LICENSE.txt
- --fuzzy-match-generates-todo
- id: insert-license
name: Add license for all Markdown files
files: \.md$
exclude: PROVIDER_CHANGES.*\.md$
args:
- --comment-style
- "<!--|| -->"
- --license-filepath
- scripts/ci/license-templates/LICENSE.txt
- --fuzzy-match-generates-todo
- id: insert-license
name: Add license for all other files
exclude: ^\.github/.*$
args:
- --comment-style
- "|#|"
- --license-filepath
- scripts/ci/license-templates/LICENSE.txt
- --fuzzy-match-generates-todo
files: >
\.cfg$|\.conf$|\.ini$|\.ldif$|\.properties$|\.service$|\.tf$|Dockerfile.*$
- id: insert-license
name: Add license for all Go files
types: [go]
exclude: mocks/.*\.go$
args:
- --comment-style
- "|//|"
- --license-filepath
- scripts/ci/license-templates/LICENSE.txt
- --insert-license-after-regex
# We need this 'generated by' line at the top for `golines` to not format it
- '// Code generated by .*'
- repo: local
hooks:
- id: check-min-python-version
name: Check minimum Python version
entry: ./scripts/ci/pre_commit/check_min_python_version.py
language: python
additional_dependencies: ['rich>=12.4.4']
require_serial: true
- id: update-black-version
name: Update black versions everywhere (manual)
entry: ./scripts/ci/pre_commit/update_black_version.py
stages: ['manual']
language: python
files: ^\.pre-commit-config\.yaml$
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['pyyaml>=6.0.2']
pass_filenames: false
require_serial: true
- id: update-installers-and-pre-commit
name: Update installers and pre-commit to latest (manual)
entry: ./scripts/ci/pre_commit/update_installers_and_pre_commit.py
stages: ['manual']
language: python
files: >
(?x)
^\.pre-commit-config\.yaml$|
^\.github/\.pre-commit-config\.yaml$|
^scripts/ci/pre_commit/update_installers_and_pre_commit\.py$
pass_filenames: false
require_serial: true
additional_dependencies: ['pyyaml>=6.0.2', 'rich>=12.4.4', 'requests>=2.31.0',"packaging>=25"]
- id: update-chart-dependencies
name: Update chart dependencies to latest (manual)
entry: ./scripts/ci/pre_commit/update_chart_dependencies.py
stages: ['manual']
language: python
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['pyyaml>=6.0.2', 'rich>=12.4.4', 'requests>=2.31.0']
files: ^\.pre-commit-config\.yaml$|^scripts/ci/pre_commit/update_build_dependencies\.py$
pass_filenames: false
require_serial: true
- id: check-taskinstance-tis-attrs
name: Check that TI and TIS have the same attributes
entry: ./scripts/ci/pre_commit/check_ti_vs_tis_attributes.py
language: python
additional_dependencies: ['rich>=12.4.4']
files: ^airflow-core/src/airflow/models/taskinstance\.py$|^airflow-core/src/airflow/models/taskinstancehistory\.py$
pass_filenames: false
require_serial: true
- id: check-deferrable-default
name: Check and fix default value of default_deferrable
language: python
entry: ./scripts/ci/pre_commit/check_deferrable_default.py
pass_filenames: false
# libcst doesn't have source wheels for all PY except PY3.12, excluding it
additional_dependencies: ['libcst>=1.8.1']
files: ^(providers/.*/)?airflow/.*/(sensors|operators)/.*\.py$
- repo: https://github.com/asottile/blacken-docs
rev: 1.19.1
hooks:
- id: blacken-docs
name: Run black on docs
args:
- --line-length=110
- --target-version=py310
- --target-version=py311
- --target-version=py312
alias: blacken-docs
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['black==24.10.0']
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-merge-conflict
name: Check that merge conflicts are not being committed
- id: debug-statements
name: Detect accidentally committed debug statements
- id: check-builtin-literals
name: Require literal syntax when initializing builtins
- id: detect-private-key
name: Detect if private key is added to the repository
exclude: ^providers/ssh/docs/connections/ssh\.rst$
- id: end-of-file-fixer
name: Make sure that there is an empty line at the end
exclude: >
(?x)
^airflow-core/docs/img/.*\.dot|
^airflow-core/docs/img/.*\.sha256|
.*/dist/.*|
LICENSES-ui\.txt$|
.*/openapi-gen/.*
- id: mixed-line-ending
name: Detect if mixed line ending is used (\r vs. \r\n)
- id: check-executables-have-shebangs
name: Check that executables have shebang
- id: check-xml
name: Check XML files with xmllint
Create Apache TinkerPop provider (#47446) * tests passed * narrow down CI * fix host * add drill for testing * add docker inspect * create a funtion * minor changes * change the inspect * add status condition * change host to zeros * rewrite the pipeline * push image and reuse * remove tag * rename tag * change to locally pushed image * add sha to image name * add sha to image name * add debug and login * change token name * change token name * remove login * remove login * remove login * move token to hight level * copy from ci * change to secrets * test workflow * test workflow * rerun on CI login * rerun on CI login * logout * revert logout * revert login * remove cleanup * readd cleanup * change docker pass * add login to action * move up * chage token * one job * one job * remove action * delete if condition * rename image * fix tar name * fix tar name * fix tar name * remove status * remove stdin * add logs and hostname * removed restart * add chmod * create entry sh * create entry sh * add status * remove failure * add user * revert back all ci yamls * revert back shell script * fix tinkerpop * change back to gremlin in the providers list * change docs * change docs * add conn_name_attr * move system test * change to cap * change to 1.0.0 * fix sh * removed serializer and some changes * fixing docs * update provider * change to 2.9.0 and add spell check * ran breeze release management * add doc strings * add asterisk * moved operators doc * fixed docs * fixed pyproject * minor change to docs * add conf.py * fixed docs * fix toml * changed to 2.10 * remove fab from tinkerpop * fix prov info * add close method * fix integration * change gremlin host * change gremlin host back * remove async * remove package * fix pyproject * fix test --------- Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
2025-04-24 11:19:09 +01:00
exclude: >
(?x)
^scripts/ci/docker-compose/gremlin/.
- id: trailing-whitespace
name: Remove trailing whitespace at end of line
exclude: >
(?x)
^airflow-core/docs/img/.*\.dot$|
^dev/breeze/doc/images/output.*$|
^.*/openapi-gen/.*$|
^airflow-ctl/docs/images/.*\.svg$
- id: fix-encoding-pragma
name: Remove encoding header from Python files
args:
- --remove
- id: pretty-format-json
name: Format JSON files
args:
- --autofix
- --no-sort-keys
- --indent
- "4"
files: ^chart/values\.schema\.json$|^chart/values_schema\.schema\.json$
pass_filenames: true
- repo: https://github.com/pre-commit/pygrep-hooks
Make static checks generated file more stable accross the board (#29080) There were couple of problems with static checks generating source files including generated stubs in the common.sql package: * black formatting was implemented in multiple separate scripts making it harded to fix problems in all of them * generated stub files were not formatted with is_pyi=True and black had no way to figure it out because it was working on strings * black formatting was not consistently applied in all places * EOL at the end of generated stub file was missing, leading to EOL fixer adding them after generation leading to multiple pre-commit passes needed * there was (already unused) deprecated dev dict generator that used its own black formatting. There were also couple of problems with the files generated by stubgen itself: * Union was missing in the generated stubs (this is a known issue with stubgen: https://github.com/python/mypy/issues/12929 * Intellij complained on Incomplete import from _typeshed missing This PR fixes all the problems: * black formatting is now consistenly extracted and applied everywhere * when needed, is_pyi flag is passed to black so that it knows that .pyi file is being fomratted * EOL is added at the end of file when the file is generated * Union is added to the generated stub * noqa is added to _typeshed import * the dict generator is removed As the end result, generated stub files are fully importable (no errors reported by IntelliJ IDE) and consistently formatted every time.
2023-01-23 12:48:33 +01:00
rev: v1.10.0
hooks:
- id: rst-backticks
name: Check if RST files use double backticks for code
- id: python-no-log-warn
name: Check if there are no deprecate log warn
- repo: https://github.com/adrienverge/yamllint
rev: v1.37.1
hooks:
- id: yamllint
name: Check YAML files with yamllint
entry: yamllint -c yamllint-config.yml --strict
types: [yaml]
exclude: >
(?x)
^.*airflow\.template\.yaml$|
^.*init_git_sync\.template\.yaml$|
^chart/(?:templates|files)/.*\.yaml$|
^helm-tests/tests/chart_utils/keda.sh_scaledobjects\.yaml$|
.*/v1.*\.yaml$|
^.*openapi.*\.yaml$|
^\.pre-commit-config\.yaml$|
^.*reproducible_build\.yaml$|
^.*pnpm-lock\.yaml$
- repo: https://github.com/ikamensh/flynt
2023-10-18 21:28:24 +02:00
rev: '1.0.1'
hooks:
- id: flynt
name: Run flynt string format converter for Python
2021-10-17 18:34:06 +02:00
args:
# If flynt detects too long text it ignores it. So we set a very large limit to make it easy
# to split the text by hand. Too long lines are detected by flake8 (below),
# so the user is informed to take action.
- --line-length
- '99999'
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
name: Run codespell
description: Run codespell to check for common misspellings in files
2021-10-30 15:44:20 +05:30
entry: bash -c 'echo "If you think that this failure is an error, consider adding the word(s)
to the codespell dictionary at docs/spelling_wordlist.txt.
The word(s) should be in lowercase." && exec codespell "$@"' --
language: python
types: [text]
exclude: >
(?x)
material-icons\.css$|
^images/.*$|
^RELEASE_NOTES\.txt$|
^.*package-lock\.json$|
^.*/kinglear\.txt$|
^.*pnpm-lock\.yaml$|
.*/dist/.*|
^airflow-core/src/airflow/ui/public/i18n/locales/(?!en/).+/
args:
- --ignore-words=docs/spelling_wordlist.txt
- --skip=providers/.*/src/airflow/providers/*/*.rst,providers/*/docs/changelog.rst,docs/*/commits.rst,providers/*/docs/commits.rst,providers/*/*/docs/commits.rst,docs/apache-airflow/tutorial/pipeline_example.csv,*.min.js,*.lock,INTHEWILD.md,*.svg
- --exclude-file=.codespellignorelines
2025-01-05 15:52:38 +00:00
- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.11.0
2025-01-05 15:52:38 +00:00
hooks:
- id: zizmor
name: Run zizmor to check for github workflow syntax errors
types: [yaml]
files: ^\.github/workflows/.*$|^\.github/actions/.*$
2025-01-05 15:52:38 +00:00
require_serial: true
entry: zizmor
- repo: local
# Note that this is the 2nd "local" repo group in the .pre-commit-config.yaml file. This is because
# we try to minimise the number of passes that must happen in order to apply some of the changes
# done by pre-commits. Some of the pre-commits not only check for errors but also fix them. This means
# that output from an earlier pre-commit becomes input to another pre-commit. Splitting the local
# scripts of our and adding some other non-local pre-commit in-between allows us to handle such
# changes quickly - especially when we want the early modifications from the first local group
# to be applied before the non-local pre-commits are run
hooks:
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
- id: update-providers-dependencies
name: Update dependencies for providers
entry: ./scripts/ci/pre_commit/update_providers_dependencies.py
language: python
always_run: true
pass_filenames: false
additional_dependencies: ['rich>=12.4.4', 'pyyaml>=6.0.2', 'tomli>=2.0.1']
- id: check-shared-projects
name: Check shared projects structure
entry: ./scripts/ci/pre_commit/check_shared_projects.py
language: python
additional_dependencies: ['rich>=12.4.4', 'tomli>=2.0.1']
pass_filenames: false
include: ^shared/.*$
- id: validate-operators-init
name: No templated field logic checks in operator __init__
description: Prevent templated field logic checks in operators' __init__
language: python
entry: ./scripts/ci/pre_commit/validate_operators_init.py
pass_filenames: true
files: ^providers/.*/src/airflow/providers/.*/(operators|transfers|sensors)/.*\.py$
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['rich>=12.4.4']
- id: update-providers-build-files
name: Update providers build files
entry: ./scripts/ci/pre_commit/update_providers_build_files.py
language: python
pass_filenames: true
files: |
(?x)
^providers/[^\/]*/src/airflow/providers/[^\/]*/__init__\.py$|
^providers/[^\/]*/[^\/]*/src/airflow/providers/[^\/]*/[^\/]*/__init__\.py$|
^providers/.*/pyproject\.toml$|
^providers/.*/provider\.yaml$|
^airflow_breeze/templates/PROVIDER__INIT__PY_TEMPLATE\.py\.jinja2$|
^airflow_breeze/templates/get_provider_info_TEMPLATE\.py\.jinja2$|
^airflow_breeze/templates/PROVIDER_README_TEMPLATE\.rst\.jinja2$
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['rich>=12.4.4','requests>=2.31.0']
require_serial: true
- id: check-airflow-v-imports-in-tests
name: Check AIRFLOW_V imports in tests
language: python
entry: ./scripts/ci/pre_commit/check_airflow_v_imports_in_tests.py
pass_filenames: true
files: ^providers/.*/tests/.+\.py$
additional_dependencies: ['rich>=12.4.4']
- id: ruff
name: Run 'ruff' for extremely fast Python linting
description: "Run 'ruff' for extremely fast Python linting"
entry: ruff check --force-exclude
language: python
types_or: [python, pyi]
args: [--fix]
require_serial: true
additional_dependencies: ['ruff==0.12.3']
exclude: ^airflow-core/tests/unit/dags/test_imports\.py$|^performance/tests/test_.*\.py$
- id: ruff-format
name: Run 'ruff format'
description: "Run 'ruff format' for extremely fast Python formatting"
entry: ./scripts/ci/pre_commit/ruff_format.py
language: python
types_or: [python, pyi]
args: []
require_serial: true
additional_dependencies: ['ruff==0.12.3']
exclude: ^airflow-core/tests/unit/dags/test_imports\.py$
- id: replace-bad-characters
name: Replace bad characters
entry: ./scripts/ci/pre_commit/replace_bad_characters.py
language: python
types: [file, text]
exclude: ^clients/gen/go\.sh$|^\.gitmodules$|^airflow-core/src/airflow/ui/openapi-gen/|.*/dist/.*|\.go$|/go\.(mod|sum)$
additional_dependencies: ['rich>=12.4.4']
- id: lint-dockerfile
name: Lint Dockerfile
language: python
entry: ./scripts/ci/pre_commit/lint_dockerfile.py
files: Dockerfile.*$
pass_filenames: true
require_serial: true
Move all k8S classes to cncf.kubernetes provider (#32767) * Move all k8S classes to cncf.kubernetes provider This is the big move of all Kubenetes classes to go to provider. The changes that are implemented in this move: * replaced all imports from airflow.kubernetes to cncf.kubernetes Swith PEP-563 dynamic import rediretion and deprecation messages those messages now support overriding the "replacement" hints to make K8s deprecations more accurate * pre_7_4_0_compatibility package with classes used by past providerrs have been "frozen" and stored in the package with import redirections from airflow.kubernetes(with deprecation warnings) * kubernetes configuration is moved to kubernetes provider * mypy started complaining about conf and set used in configuration. so better solution to handle deprecations and hinting conf returning AirlfowConfigParsing was added. * example_kuberntes_executor uses configuration reading not in top level but in execute method * PodMutationHookException and PodReconciliationError have been moved to cncf.kubernetes provider and they are imported from there with fallback to an airflow.exception ones in case old provider is used in Airflow 2.7.0 * k8s methods in task_instance have been deprecated and reolaced with functions in "cncf.kubernetes` template_rendering module the old way still works but raise deprecaton warnings. * added extras with versions for celery and k8s * raise AirflowOptionalProviderFeatureException in case there is attempt to use CeleryK8sExecutor and cncf.k8s is not installed. * added few "new" core utils to k8s (hashlib_wrapper etc) * both warnings and errors indicate minimum versions for both cncf.k8s and Celery providers. * Update newsfragments/32767.significant.rst Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com> --------- Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
2023-07-26 08:25:02 +02:00
- id: check-airflow-k8s-not-used
name: Check airflow.kubernetes imports are not used
language: python
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/src/airflow/.*\.py$
Move all k8S classes to cncf.kubernetes provider (#32767) * Move all k8S classes to cncf.kubernetes provider This is the big move of all Kubenetes classes to go to provider. The changes that are implemented in this move: * replaced all imports from airflow.kubernetes to cncf.kubernetes Swith PEP-563 dynamic import rediretion and deprecation messages those messages now support overriding the "replacement" hints to make K8s deprecations more accurate * pre_7_4_0_compatibility package with classes used by past providerrs have been "frozen" and stored in the package with import redirections from airflow.kubernetes(with deprecation warnings) * kubernetes configuration is moved to kubernetes provider * mypy started complaining about conf and set used in configuration. so better solution to handle deprecations and hinting conf returning AirlfowConfigParsing was added. * example_kuberntes_executor uses configuration reading not in top level but in execute method * PodMutationHookException and PodReconciliationError have been moved to cncf.kubernetes provider and they are imported from there with fallback to an airflow.exception ones in case old provider is used in Airflow 2.7.0 * k8s methods in task_instance have been deprecated and reolaced with functions in "cncf.kubernetes` template_rendering module the old way still works but raise deprecaton warnings. * added extras with versions for celery and k8s * raise AirflowOptionalProviderFeatureException in case there is attempt to use CeleryK8sExecutor and cncf.k8s is not installed. * added few "new" core utils to k8s (hashlib_wrapper etc) * both warnings and errors indicate minimum versions for both cncf.k8s and Celery providers. * Update newsfragments/32767.significant.rst Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com> --------- Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
2023-07-26 08:25:02 +02:00
require_serial: true
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
exclude: ^airflow-core/src/airflow/kubernetes/
entry: ./scripts/ci/pre_commit/check_airflow_imports.py
--pattern '^airflow\.kubernetes'
--message "You should only import kubernetes code from `airflow.providers.cncf.kubernetes`."
Move all k8S classes to cncf.kubernetes provider (#32767) * Move all k8S classes to cncf.kubernetes provider This is the big move of all Kubenetes classes to go to provider. The changes that are implemented in this move: * replaced all imports from airflow.kubernetes to cncf.kubernetes Swith PEP-563 dynamic import rediretion and deprecation messages those messages now support overriding the "replacement" hints to make K8s deprecations more accurate * pre_7_4_0_compatibility package with classes used by past providerrs have been "frozen" and stored in the package with import redirections from airflow.kubernetes(with deprecation warnings) * kubernetes configuration is moved to kubernetes provider * mypy started complaining about conf and set used in configuration. so better solution to handle deprecations and hinting conf returning AirlfowConfigParsing was added. * example_kuberntes_executor uses configuration reading not in top level but in execute method * PodMutationHookException and PodReconciliationError have been moved to cncf.kubernetes provider and they are imported from there with fallback to an airflow.exception ones in case old provider is used in Airflow 2.7.0 * k8s methods in task_instance have been deprecated and reolaced with functions in "cncf.kubernetes` template_rendering module the old way still works but raise deprecaton warnings. * added extras with versions for celery and k8s * raise AirflowOptionalProviderFeatureException in case there is attempt to use CeleryK8sExecutor and cncf.k8s is not installed. * added few "new" core utils to k8s (hashlib_wrapper etc) * both warnings and errors indicate minimum versions for both cncf.k8s and Celery providers. * Update newsfragments/32767.significant.rst Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com> --------- Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
2023-07-26 08:25:02 +02:00
additional_dependencies: ['rich>=12.4.4']
- id: check-common-compat-used-for-openlineage
name: Check common.compat is used for OL deprecated classes
language: python
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/src/airflow/.*\.py$
require_serial: true
exclude: >
(?x)
^airflow-core/src/airflow/openlineage/|
^airflow/providers/common/compat/openlineage/facet.py$
entry: ./scripts/ci/pre_commit/check_airflow_imports.py
--pattern '^openlineage\.client\.(facet|run)'
--message "You should import from `airflow.providers.common.compat.openlineage.facet` instead."
additional_dependencies: ['rich>=12.4.4']
- id: check-airflow-providers-bug-report-template
name: Sort airflow-bug-report provider list
language: python
files: ^\.github/ISSUE_TEMPLATE/3-airflow_providers_bug_report\.yml$
require_serial: true
entry: ./scripts/ci/pre_commit/check_airflow_bug_report_template.py
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['rich>=12.4.4', 'pyyaml>=6.0.2']
Move all k8S classes to cncf.kubernetes provider (#32767) * Move all k8S classes to cncf.kubernetes provider This is the big move of all Kubenetes classes to go to provider. The changes that are implemented in this move: * replaced all imports from airflow.kubernetes to cncf.kubernetes Swith PEP-563 dynamic import rediretion and deprecation messages those messages now support overriding the "replacement" hints to make K8s deprecations more accurate * pre_7_4_0_compatibility package with classes used by past providerrs have been "frozen" and stored in the package with import redirections from airflow.kubernetes(with deprecation warnings) * kubernetes configuration is moved to kubernetes provider * mypy started complaining about conf and set used in configuration. so better solution to handle deprecations and hinting conf returning AirlfowConfigParsing was added. * example_kuberntes_executor uses configuration reading not in top level but in execute method * PodMutationHookException and PodReconciliationError have been moved to cncf.kubernetes provider and they are imported from there with fallback to an airflow.exception ones in case old provider is used in Airflow 2.7.0 * k8s methods in task_instance have been deprecated and reolaced with functions in "cncf.kubernetes` template_rendering module the old way still works but raise deprecaton warnings. * added extras with versions for celery and k8s * raise AirflowOptionalProviderFeatureException in case there is attempt to use CeleryK8sExecutor and cncf.k8s is not installed. * added few "new" core utils to k8s (hashlib_wrapper etc) * both warnings and errors indicate minimum versions for both cncf.k8s and Celery providers. * Update newsfragments/32767.significant.rst Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com> --------- Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
2023-07-26 08:25:02 +02:00
- id: check-cncf-k8s-only-for-executors
name: Check cncf.kubernetes imports used for executors only
language: python
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/src/airflow/.*\.py$
Move all k8S classes to cncf.kubernetes provider (#32767) * Move all k8S classes to cncf.kubernetes provider This is the big move of all Kubenetes classes to go to provider. The changes that are implemented in this move: * replaced all imports from airflow.kubernetes to cncf.kubernetes Swith PEP-563 dynamic import rediretion and deprecation messages those messages now support overriding the "replacement" hints to make K8s deprecations more accurate * pre_7_4_0_compatibility package with classes used by past providerrs have been "frozen" and stored in the package with import redirections from airflow.kubernetes(with deprecation warnings) * kubernetes configuration is moved to kubernetes provider * mypy started complaining about conf and set used in configuration. so better solution to handle deprecations and hinting conf returning AirlfowConfigParsing was added. * example_kuberntes_executor uses configuration reading not in top level but in execute method * PodMutationHookException and PodReconciliationError have been moved to cncf.kubernetes provider and they are imported from there with fallback to an airflow.exception ones in case old provider is used in Airflow 2.7.0 * k8s methods in task_instance have been deprecated and reolaced with functions in "cncf.kubernetes` template_rendering module the old way still works but raise deprecaton warnings. * added extras with versions for celery and k8s * raise AirflowOptionalProviderFeatureException in case there is attempt to use CeleryK8sExecutor and cncf.k8s is not installed. * added few "new" core utils to k8s (hashlib_wrapper etc) * both warnings and errors indicate minimum versions for both cncf.k8s and Celery providers. * Update newsfragments/32767.significant.rst Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com> --------- Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
2023-07-26 08:25:02 +02:00
require_serial: true
exclude: >
(?x)
^providers/.*/src/airflow/providers/|
^airflow-core/src/airflow/exceptions\.py$|
^airflow-core/src/airflow/models/renderedtifields\.py$|
^airflow-core/src/airflow/serialization/serialized_objects\.py$|
^airflow-core/src/airflow/serialization/serializers/kubernetes\.py$|
^airflow-core/src/airflow/utils/sqlalchemy\.py$
entry: ./scripts/ci/pre_commit/check_airflow_imports.py
--pattern '^airflow\.providers\.cncf\.kubernetes'
--message "Only few k8s executors exceptions are allowed to use `airflow.providers.cncf.kubernetes`."
Move all k8S classes to cncf.kubernetes provider (#32767) * Move all k8S classes to cncf.kubernetes provider This is the big move of all Kubenetes classes to go to provider. The changes that are implemented in this move: * replaced all imports from airflow.kubernetes to cncf.kubernetes Swith PEP-563 dynamic import rediretion and deprecation messages those messages now support overriding the "replacement" hints to make K8s deprecations more accurate * pre_7_4_0_compatibility package with classes used by past providerrs have been "frozen" and stored in the package with import redirections from airflow.kubernetes(with deprecation warnings) * kubernetes configuration is moved to kubernetes provider * mypy started complaining about conf and set used in configuration. so better solution to handle deprecations and hinting conf returning AirlfowConfigParsing was added. * example_kuberntes_executor uses configuration reading not in top level but in execute method * PodMutationHookException and PodReconciliationError have been moved to cncf.kubernetes provider and they are imported from there with fallback to an airflow.exception ones in case old provider is used in Airflow 2.7.0 * k8s methods in task_instance have been deprecated and reolaced with functions in "cncf.kubernetes` template_rendering module the old way still works but raise deprecaton warnings. * added extras with versions for celery and k8s * raise AirflowOptionalProviderFeatureException in case there is attempt to use CeleryK8sExecutor and cncf.k8s is not installed. * added few "new" core utils to k8s (hashlib_wrapper etc) * both warnings and errors indicate minimum versions for both cncf.k8s and Celery providers. * Update newsfragments/32767.significant.rst Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com> --------- Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
2023-07-26 08:25:02 +02:00
additional_dependencies: ['rich>=12.4.4']
- id: update-local-yml-file
name: Update mounts in the local yml file
entry: ./scripts/ci/pre_commit/local_yml_mounts.py
language: python
files: ^dev/breeze/src/airflow_breeze/utils/docker_command_utils\.py$|^scripts/ci/docker_compose/local\.yml$
pass_filenames: false
additional_dependencies: ['rich>=12.4.4']
- id: check-sql-dependency-common-data-structure
name: Check dependency of SQL providers
description: Check dependency of SQL Providers with common data structure
entry: ./scripts/ci/pre_commit/check_common_sql_dependency.py
language: python
files: ^providers/.*/src/airflow/providers/.*/hooks/.*\.py$
Add Python 3.13 support for Airflow. (#46891) * Breeze changes for Python 3.13 * Pyproject.toml provider changes for Python 3.13 * README.rst changes for providers for Python 3.13 * Add Python 3.13 support for Airflow. Added Python 3.13 support across the codebase, including: * CI/CD workflow updates to handle Python 3.13. * Dockerfile and environment variable adjustments for compatibility. * Documentation updates to list Python 3.13 as supported. * Dependency and code changes for compatibility with new/changed libraries (e.g., numpy 2.x, greenlet, pendulum). * Test and plugin manager adjustments for Python 3.13-specific behaviors. * Removal or skipping of tests and features not compatible with Python 3.13. * Improved error handling and logging for unsupported plugins/providers on Python 3.13. * Updated all provider README.rst files to: * List Python 3.13 as a supported version. * Adjust dependency requirements for Python 3.13 (e.g., pandas, pyarrow, ray, etc.). * Add or update notes about excluded or conditionally supported dependencies for Python 3.13. * Document any known incompatibilities or workarounds for specific providers. * Updated all provider pyproject.toml files and automation to: * Add Python 3.13 to the supported classifiers. * Adjust requires-python and dependency constraints for Python 3.13. * Exclude Python 3.13 for providers that are not yet compatible (e.g., those depending on Flask AppBuilder). * Add conditional dependencies for new versions of libraries required by Python 3.13. * Updated Breeze and related scripts to: * Build and test with Python 3.13. * Update documentation and release scripts to include Python 3.13. * Ensure all dev tooling and test environments work with Python 3.13. * Removed remaining FAB related code from core and removed tests for older FAB provider versions (<1.3.0) * some of the tests in core still depend on FAB - but we make them optional - both for parsing (we need to skip some imports) and execution - because they test a legacy behaviour of embedding Flask plugins that is still supported in core. * k8s tests now run also with SimpleAuthManager and SimpleAuthManager is used automatically when runnin tests in Python 3.13 * migration tests had to be excluded fo Python 3.13 because we cannot migrate down on Python 3.13 without FAB tables created. The tests will be brought back when FAB is supported or when we release 3.1 and start working on 3.2, we should be able to migrate down to 3.1 * Weaviate tests have been updated to handle case where weaviate-client is > 2.10.0 - because it started to use httpx instead of requests, and Python 3.13 actually unblocks using older version of weaviate (it was previously blocked indirectly via Flask dependencies and grpcio). * Added doc change in our rules on what is the "default" Python version for airflow images - handling the case where we cannot use "newest" Python version as default where not all "regular" image providers are supported in the latest version * Connection is now flushed in `configure_git_connection_for_dag_bundle` just before `clear_db_connections` - in order to handle Python 3.13 case where FAB app is not initialized by other fixtures - performing implicit flush along the way * Cleaning db connections was added to test_dag_run and test_dags test in fast_api as the test implicitly rely on having connections cleared (no test git connections added) - this will make the tests side-effect free. * Conditionally skipping some serialization tests involving yandex and ray on Python 3.13 until they support Python 3.13
2025-07-17 16:53:49 +02:00
additional_dependencies: ['rich>=12.4.4', 'pyyaml>=6.0.2', 'packaging>=25']
Standardize airflow build process and switch to Hatchling build backend (#36537) This PR changes Airflow installation and build backend to use new standard Python ways of building Python applications. We've been trying to do it for quite a while. Airflow tranditionally has been using complex and convoluted build process based on setuptools and (extremely) custom setup.py file. It survived migration to Airflow 2.0 and splitting Airlfow monorepo into Airflow and Providers, adding pre-installed providers and switching providers to use flit (and follow build standards). So far tooling in Python ecosystme had not been able to fuflill our needs and we refrained to develop our own tooling, but finally with appearance of Hatch (managed by Python Packaging Authority) and few recent advancements there we are finally able to swtich to Python standard ways of managing project dependnecy configuration and project build setup (with a few customizations). This PR makes airflow build process follow those standard PEPs: * Airflow has all build configuration stored in pyproject.toml following PEP 518 which allows any fronted (`pip`, `poetry`, `hatch`, `flit`, or whatever other frontend is used to install required build dependendencies to install Airflow locally and to build distribution pacakges (sdist/wheel) * Hatchling backend follows PEP 517 for standard source tree and build backend implementation that allows to execute the build in a frontend-independent way * We store all project metadata in pyprooject.toml - following PEP 621 where all necessary project metadata components were defined. * We plug-in into Hatchling "editable build" hooks following PEP 660. Hatchling internally builds editable wheel that is used as ephemeral step and communication between backend and frontend (and this ephemeral wheel is used to make editable installation of the projeect - suitable for fast iteration of code without reinstalling the package. With Airflow having many provider packages in single source tree where we want to be able to install and develop airflow and providers together, this is not a small feat to implement the case wher editable installation has to behave quite a bit differently when it comes to packaging and dependencies for editable install (when you want to edit sources directly) and installable package (where you want to have separate Airflow package and provider packages). Fortunately the standardisation efforts in the Python Packaging community and tooling implementing it had finally made it possible. Some of the important ways bow this has been achieved: * We continue using provider.yaml in providers as the single source of trutgh for per-provider dependencies. We added a possibility to specify "devel-dependencies" in provider.yaml so that all per-provider dependencies in `generated/provider_dependencies.json` and `pyproject.toml` are generated from those dependencies via update-providers-dependencies pre-commit. * Pyproject.toml is generally managed manually, but the part where provider dependencies and bundle dependencies are used is automatically updated by a pre-commit whenever provider dependencies change. Those generated provider dependencies contain just dependencies of providers - not the provider packages, but in the final "standard" wheel file they are replaced with "apache-airflow-providers-PROVIDER" dependencies - so that the wheel package will only install the provider and use the dependencies of that version of provider it installs. * We are utilising custom hatchiling build hooks (PEP 660 standard) that allow to modify 'standard' wheel package on-the-fly when the wheel is being prepared by adding preinstalled package dependencies (which are not needed in editable build) and by removing all devel extras (that are not needed in the PyPI distributed wheel package). This allows to solve the conundrum of having different "editable" and "standard" behaviour while keeping the same project specification in pyproject.toml. * We added description of how `Hatch` can be employed as build frontend in order to manage local virtualenv and install Airflow in editable way easily - while keeping all properties of the installed application (including working airflow cli and package metadata discovery) as well as how to use PEP-standard ways of bulding wheel and sdist packages. * We have a custom step (following PEP-standards) to inject airflow-specific build steps - compiling www assets and generating git commit hash version to display it in the UI * We also show how all this makes it possible to make it easy to manage local virtualenvs and editable installations for Airflow contributors - without vendor lock-in of the build tools as by following standard PEPs Airflow can be locally and editably installed by anyone using any build front-end tools following the standards - whether you use `pip`, `poetry`, `Hatch`, `flit` or any other frontent build tools, Airflow local installation and package building will work the same way for all of them, where both "editable" and "standard" package prepration is managed by `hatchling` backend in the same way. * Previously our extras contained a "." which is not normalized name for extras - `pip` and other tools replaced it automatically with `_'. This change updates the extra names to contain '-' rather than '.' in the name, following PEP-685. This should be fully backwards compatible, users will still be able to use "." but it will be normalized to "-" in Airflow packages. This is also future proof as it is expected that all package managers and tools will eventually use PEP-685 applied to extras, even if currently some of the tools (pip + setuptools) might generate warnings. * Additionally, this change organizes the documentation around the extras and dependencies, explaining the reasoning behind all the different extras we have. * As a bonus (and this is what we used to test it all) we are documenting how to use Hatch frontend to: * manage multiple Python installations * manage multiple Pythob virtualenv environments * build Airflow packages for release management
2024-01-10 21:19:02 +01:00
- id: check-extra-packages-references
name: Checks setup extra packages
Turn optional-dependencies in pyproject.toml into dynamic property (#38437) While currently hatchling and pip nicely supports dynamic replacement of the dependencies even if they are statically defined, this is not proper according to EP 621. When property of the project is set to be dynamic, it also contains static values. It's either static or dynamic. This is not a problem for wheel packages when installed, by any standard tool, because the wheel package has all the metadata added to wheel (and does not contain pyproject.toml) but in various cases (such as installing airflow via Github URL or from sdist, it can make a difference - depending whether the tool installing airflow will use directly pyproject.toml for optimization, or whether it will run build hooks to prepare the dependencies). This change makes all optional dependencies dynamici - rather than bake them in the pyproject.toml, we mark them as dynamic, so that any tool that uses pyproject.toml or sdist PKG-INFO will know that it has to run build hooks to get the actual optional dependencies. There are a few consequences of that: * our pyproject.toml will not contain automatically generated part - which is actually good, as it caused some confusion * all dynamic optional dependencies of ours are either present in hatch_build.py or calculated there - this is a bit new but sounds reasonable - and those dynamic dependencies are not really updated often, so thish is not an issue to maintain them there * the pre-commits that manage the optional dependencies got a lot simpler now - a lot of code has been removed.
2024-03-24 21:50:28 +01:00
description: Checks if all the extras defined in hatch_build.py are listed in extra-packages-ref.rst file
Standardize airflow build process and switch to Hatchling build backend (#36537) This PR changes Airflow installation and build backend to use new standard Python ways of building Python applications. We've been trying to do it for quite a while. Airflow tranditionally has been using complex and convoluted build process based on setuptools and (extremely) custom setup.py file. It survived migration to Airflow 2.0 and splitting Airlfow monorepo into Airflow and Providers, adding pre-installed providers and switching providers to use flit (and follow build standards). So far tooling in Python ecosystme had not been able to fuflill our needs and we refrained to develop our own tooling, but finally with appearance of Hatch (managed by Python Packaging Authority) and few recent advancements there we are finally able to swtich to Python standard ways of managing project dependnecy configuration and project build setup (with a few customizations). This PR makes airflow build process follow those standard PEPs: * Airflow has all build configuration stored in pyproject.toml following PEP 518 which allows any fronted (`pip`, `poetry`, `hatch`, `flit`, or whatever other frontend is used to install required build dependendencies to install Airflow locally and to build distribution pacakges (sdist/wheel) * Hatchling backend follows PEP 517 for standard source tree and build backend implementation that allows to execute the build in a frontend-independent way * We store all project metadata in pyprooject.toml - following PEP 621 where all necessary project metadata components were defined. * We plug-in into Hatchling "editable build" hooks following PEP 660. Hatchling internally builds editable wheel that is used as ephemeral step and communication between backend and frontend (and this ephemeral wheel is used to make editable installation of the projeect - suitable for fast iteration of code without reinstalling the package. With Airflow having many provider packages in single source tree where we want to be able to install and develop airflow and providers together, this is not a small feat to implement the case wher editable installation has to behave quite a bit differently when it comes to packaging and dependencies for editable install (when you want to edit sources directly) and installable package (where you want to have separate Airflow package and provider packages). Fortunately the standardisation efforts in the Python Packaging community and tooling implementing it had finally made it possible. Some of the important ways bow this has been achieved: * We continue using provider.yaml in providers as the single source of trutgh for per-provider dependencies. We added a possibility to specify "devel-dependencies" in provider.yaml so that all per-provider dependencies in `generated/provider_dependencies.json` and `pyproject.toml` are generated from those dependencies via update-providers-dependencies pre-commit. * Pyproject.toml is generally managed manually, but the part where provider dependencies and bundle dependencies are used is automatically updated by a pre-commit whenever provider dependencies change. Those generated provider dependencies contain just dependencies of providers - not the provider packages, but in the final "standard" wheel file they are replaced with "apache-airflow-providers-PROVIDER" dependencies - so that the wheel package will only install the provider and use the dependencies of that version of provider it installs. * We are utilising custom hatchiling build hooks (PEP 660 standard) that allow to modify 'standard' wheel package on-the-fly when the wheel is being prepared by adding preinstalled package dependencies (which are not needed in editable build) and by removing all devel extras (that are not needed in the PyPI distributed wheel package). This allows to solve the conundrum of having different "editable" and "standard" behaviour while keeping the same project specification in pyproject.toml. * We added description of how `Hatch` can be employed as build frontend in order to manage local virtualenv and install Airflow in editable way easily - while keeping all properties of the installed application (including working airflow cli and package metadata discovery) as well as how to use PEP-standard ways of bulding wheel and sdist packages. * We have a custom step (following PEP-standards) to inject airflow-specific build steps - compiling www assets and generating git commit hash version to display it in the UI * We also show how all this makes it possible to make it easy to manage local virtualenvs and editable installations for Airflow contributors - without vendor lock-in of the build tools as by following standard PEPs Airflow can be locally and editably installed by anyone using any build front-end tools following the standards - whether you use `pip`, `poetry`, `Hatch`, `flit` or any other frontent build tools, Airflow local installation and package building will work the same way for all of them, where both "editable" and "standard" package prepration is managed by `hatchling` backend in the same way. * Previously our extras contained a "." which is not normalized name for extras - `pip` and other tools replaced it automatically with `_'. This change updates the extra names to contain '-' rather than '.' in the name, following PEP-685. This should be fully backwards compatible, users will still be able to use "." but it will be normalized to "-" in Airflow packages. This is also future proof as it is expected that all package managers and tools will eventually use PEP-685 applied to extras, even if currently some of the tools (pip + setuptools) might generate warnings. * Additionally, this change organizes the documentation around the extras and dependencies, explaining the reasoning behind all the different extras we have. * As a bonus (and this is what we used to test it all) we are documenting how to use Hatch frontend to: * manage multiple Python installations * manage multiple Pythob virtualenv environments * build Airflow packages for release management
2024-01-10 21:19:02 +01:00
language: python
files: ^airflow-core/docs/extra-packages-ref\.rst$|^hatch_build\.py$
Standardize airflow build process and switch to Hatchling build backend (#36537) This PR changes Airflow installation and build backend to use new standard Python ways of building Python applications. We've been trying to do it for quite a while. Airflow tranditionally has been using complex and convoluted build process based on setuptools and (extremely) custom setup.py file. It survived migration to Airflow 2.0 and splitting Airlfow monorepo into Airflow and Providers, adding pre-installed providers and switching providers to use flit (and follow build standards). So far tooling in Python ecosystme had not been able to fuflill our needs and we refrained to develop our own tooling, but finally with appearance of Hatch (managed by Python Packaging Authority) and few recent advancements there we are finally able to swtich to Python standard ways of managing project dependnecy configuration and project build setup (with a few customizations). This PR makes airflow build process follow those standard PEPs: * Airflow has all build configuration stored in pyproject.toml following PEP 518 which allows any fronted (`pip`, `poetry`, `hatch`, `flit`, or whatever other frontend is used to install required build dependendencies to install Airflow locally and to build distribution pacakges (sdist/wheel) * Hatchling backend follows PEP 517 for standard source tree and build backend implementation that allows to execute the build in a frontend-independent way * We store all project metadata in pyprooject.toml - following PEP 621 where all necessary project metadata components were defined. * We plug-in into Hatchling "editable build" hooks following PEP 660. Hatchling internally builds editable wheel that is used as ephemeral step and communication between backend and frontend (and this ephemeral wheel is used to make editable installation of the projeect - suitable for fast iteration of code without reinstalling the package. With Airflow having many provider packages in single source tree where we want to be able to install and develop airflow and providers together, this is not a small feat to implement the case wher editable installation has to behave quite a bit differently when it comes to packaging and dependencies for editable install (when you want to edit sources directly) and installable package (where you want to have separate Airflow package and provider packages). Fortunately the standardisation efforts in the Python Packaging community and tooling implementing it had finally made it possible. Some of the important ways bow this has been achieved: * We continue using provider.yaml in providers as the single source of trutgh for per-provider dependencies. We added a possibility to specify "devel-dependencies" in provider.yaml so that all per-provider dependencies in `generated/provider_dependencies.json` and `pyproject.toml` are generated from those dependencies via update-providers-dependencies pre-commit. * Pyproject.toml is generally managed manually, but the part where provider dependencies and bundle dependencies are used is automatically updated by a pre-commit whenever provider dependencies change. Those generated provider dependencies contain just dependencies of providers - not the provider packages, but in the final "standard" wheel file they are replaced with "apache-airflow-providers-PROVIDER" dependencies - so that the wheel package will only install the provider and use the dependencies of that version of provider it installs. * We are utilising custom hatchiling build hooks (PEP 660 standard) that allow to modify 'standard' wheel package on-the-fly when the wheel is being prepared by adding preinstalled package dependencies (which are not needed in editable build) and by removing all devel extras (that are not needed in the PyPI distributed wheel package). This allows to solve the conundrum of having different "editable" and "standard" behaviour while keeping the same project specification in pyproject.toml. * We added description of how `Hatch` can be employed as build frontend in order to manage local virtualenv and install Airflow in editable way easily - while keeping all properties of the installed application (including working airflow cli and package metadata discovery) as well as how to use PEP-standard ways of bulding wheel and sdist packages. * We have a custom step (following PEP-standards) to inject airflow-specific build steps - compiling www assets and generating git commit hash version to display it in the UI * We also show how all this makes it possible to make it easy to manage local virtualenvs and editable installations for Airflow contributors - without vendor lock-in of the build tools as by following standard PEPs Airflow can be locally and editably installed by anyone using any build front-end tools following the standards - whether you use `pip`, `poetry`, `Hatch`, `flit` or any other frontent build tools, Airflow local installation and package building will work the same way for all of them, where both "editable" and "standard" package prepration is managed by `hatchling` backend in the same way. * Previously our extras contained a "." which is not normalized name for extras - `pip` and other tools replaced it automatically with `_'. This change updates the extra names to contain '-' rather than '.' in the name, following PEP-685. This should be fully backwards compatible, users will still be able to use "." but it will be normalized to "-" in Airflow packages. This is also future proof as it is expected that all package managers and tools will eventually use PEP-685 applied to extras, even if currently some of the tools (pip + setuptools) might generate warnings. * Additionally, this change organizes the documentation around the extras and dependencies, explaining the reasoning behind all the different extras we have. * As a bonus (and this is what we used to test it all) we are documenting how to use Hatch frontend to: * manage multiple Python installations * manage multiple Pythob virtualenv environments * build Airflow packages for release management
2024-01-10 21:19:02 +01:00
pass_filenames: false
entry: ./scripts/ci/pre_commit/check_extra_packages_ref.py
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['rich>=12.4.4', 'hatchling==1.27.0', 'tabulate>=0.9.0']
- id: check-extras-order
name: Check order of extras in Dockerfile
entry: ./scripts/ci/pre_commit/check_order_dockerfile_extras.py
language: python
files: ^Dockerfile$
pass_filenames: false
additional_dependencies: ['rich>=12.4.4']
- id: generate-airflow-diagrams
name: Generate airflow diagrams
entry: ./scripts/ci/pre_commit/generate_airflow_diagrams.py
language: python
files: >
(?x)
^airflow-core/docs/.*/diagram_[^/]*\.py$|
^docs/images/.*\.py$
Improve pre-commit to generate Airflow diagrams as a code (#36333) Since we are getting more diagrams generated in Airflow using the "diagram as a code" approach, this PR improves the pre-commit to be more suitable to support generation of more of the images coming from different sources, placed in different directories and generated independently, so that the whole process is more distributed and easy for whoever creates diagrams to add their own diagram. The changes implemented in this PR: * the code to generate the diagrams is now next to the diagram they generate. It has the same name as the diagram, but it has the .py extension. This way it is immediately visible where is the source of each diagram (right next to each diagram) * each of the .py diagram Python files is runnable on its own. This way you can easily regenerate the diagrams by running corresponding Python file or even automate it by running "save" action and generate the diagrams automatically by running the Python code every time the file is saved. That makes a very nice workflow on iterating on each diagram, independently from each othere * the pre-commit script is given a set of folders which should be scanned and it finds and run the diagrams on pre-commmit. It also creates and verifies the md5sum hash of the source Python file separately for each diagram and only runs diagram generation when the source file changed vs. last time the hash was saved and committed. The hash sum is stored next to the image and sources with .md5sum extension Also updated documentation in the CONTRIBUTING.rst explaining how to generate the diagrams and what is the mechanism of that generation.
2023-12-20 19:44:33 +01:00
pass_filenames: true
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['rich>=12.4.4', 'diagrams>=0.23.4']
- id: generate-volumes-for-sources
name: Generate volumes for docker compose
entry: ./scripts/ci/pre_commit/generate_volumes_for_sources.py
language: python
files: ^providers/.*/provider\.yaml$
pass_filenames: false
require_serial: true
additional_dependencies: ['rich>=12.4.4']
- id: prevent-deprecated-sqlalchemy-usage
name: Prevent deprecated sqlalchemy usage
entry: ./scripts/ci/pre_commit/prevent_deprecated_sqlalchemy_usage.py
language: python
additional_dependencies: ['rich>=12.4.4']
files: >
(?x)
^airflow-ctl.*\.py$|
^task_sdk.*\.py$
pass_filenames: true
- id: update-supported-versions
name: Updates supported versions in documentation
entry: ./scripts/ci/pre_commit/supported_versions.py
language: python
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/docs/installation/supported-versions\.rst$|^scripts/ci/pre_commit/supported_versions\.py$|^README\.md$
pass_filenames: false
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['tabulate>=0.9.0']
- id: check-revision-heads-map
name: Check that the REVISION_HEADS_MAP is up-to-date
language: python
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
entry: ./scripts/ci/pre_commit/check_revision_heads_map.py
pass_filenames: false
files: >
(?x)
^scripts/ci/pre_commit/version_heads_map\.py$|
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
^airflow-core/src/airflow/migrations/versions/.*$|^airflow-core/src/airflow/migrations/versions|
^providers/fab/src/airflow/providers/fab/migrations/versions/.*$|^providers/fab/src/airflow/providers/fab/migrations/versions|
^airflow-core/src/airflow/utils/db\.py$|
^providers/fab/src/airflow/providers/fab/auth_manager/models/db\.py$
Add Python 3.13 support for Airflow. (#46891) * Breeze changes for Python 3.13 * Pyproject.toml provider changes for Python 3.13 * README.rst changes for providers for Python 3.13 * Add Python 3.13 support for Airflow. Added Python 3.13 support across the codebase, including: * CI/CD workflow updates to handle Python 3.13. * Dockerfile and environment variable adjustments for compatibility. * Documentation updates to list Python 3.13 as supported. * Dependency and code changes for compatibility with new/changed libraries (e.g., numpy 2.x, greenlet, pendulum). * Test and plugin manager adjustments for Python 3.13-specific behaviors. * Removal or skipping of tests and features not compatible with Python 3.13. * Improved error handling and logging for unsupported plugins/providers on Python 3.13. * Updated all provider README.rst files to: * List Python 3.13 as a supported version. * Adjust dependency requirements for Python 3.13 (e.g., pandas, pyarrow, ray, etc.). * Add or update notes about excluded or conditionally supported dependencies for Python 3.13. * Document any known incompatibilities or workarounds for specific providers. * Updated all provider pyproject.toml files and automation to: * Add Python 3.13 to the supported classifiers. * Adjust requires-python and dependency constraints for Python 3.13. * Exclude Python 3.13 for providers that are not yet compatible (e.g., those depending on Flask AppBuilder). * Add conditional dependencies for new versions of libraries required by Python 3.13. * Updated Breeze and related scripts to: * Build and test with Python 3.13. * Update documentation and release scripts to include Python 3.13. * Ensure all dev tooling and test environments work with Python 3.13. * Removed remaining FAB related code from core and removed tests for older FAB provider versions (<1.3.0) * some of the tests in core still depend on FAB - but we make them optional - both for parsing (we need to skip some imports) and execution - because they test a legacy behaviour of embedding Flask plugins that is still supported in core. * k8s tests now run also with SimpleAuthManager and SimpleAuthManager is used automatically when runnin tests in Python 3.13 * migration tests had to be excluded fo Python 3.13 because we cannot migrate down on Python 3.13 without FAB tables created. The tests will be brought back when FAB is supported or when we release 3.1 and start working on 3.2, we should be able to migrate down to 3.1 * Weaviate tests have been updated to handle case where weaviate-client is > 2.10.0 - because it started to use httpx instead of requests, and Python 3.13 actually unblocks using older version of weaviate (it was previously blocked indirectly via Flask dependencies and grpcio). * Added doc change in our rules on what is the "default" Python version for airflow images - handling the case where we cannot use "newest" Python version as default where not all "regular" image providers are supported in the latest version * Connection is now flushed in `configure_git_connection_for_dag_bundle` just before `clear_db_connections` - in order to handle Python 3.13 case where FAB app is not initialized by other fixtures - performing implicit flush along the way * Cleaning db connections was added to test_dag_run and test_dags test in fast_api as the test implicitly rely on having connections cleared (no test git connections added) - this will make the tests side-effect free. * Conditionally skipping some serialization tests involving yandex and ray on Python 3.13 until they support Python 3.13
2025-07-17 16:53:49 +02:00
additional_dependencies: ['packaging>=25', 'rich>=12.4.4']
- id: update-version
name: Update versions in docs
entry: ./scripts/ci/pre_commit/update_versions.py
language: python
files: ^docs|^airflow-core/src/airflow/__init__\.py$|.*/pyproject\.toml$
pass_filenames: false
Add common code and utils to implement ER pre-commit in a clearer way (#35875) * Add common code and utils to implement ER pre-commit in a clearer way Extracts comon initialization code for pre-commits that allows to use a simpler way of running pre-commits with breeze ci image. Rather than running a custom `docker` command, we are using the `breeze shell` command to run the command inside the image. We are also fixing a problem where the ER diagram was generated using random backend - we force it now to use Postgres as backend. There are few small problems solved as part of it as well: * We are also switching the console used to be the standard colored one so that the output will use colors also in git hook and CI. * When image needs update we are going to warn about it in the builds that are "serial" (i.e. do not run in parallell) that the image should be upgraded. We are not doing it for checks that use parallelism because it would pollute the output too much (and those are usually not run with images anyway). * There was an error where pre-commit run with breeze would also start port-forwarding if database was started together with it, so pre-commit project no longer adds port forwarding for backends. * If there was a database stated as part of pre-commit project, it would continue running after pre-commit completed, which is undesireable. The pre-commit will now stop pre-commit project after completion. * Update dev/breeze/src/airflow_breeze/utils/md5_build_check.py Co-authored-by: Pankaj Koti <pankajkoti699@gmail.com> --------- Co-authored-by: Pankaj Koti <pankajkoti699@gmail.com>
2023-11-27 03:37:28 +01:00
additional_dependencies: ['rich>=12.4.4']
- id: check-pydevd-left-in-code
language: pygrep
name: Check for pydevd debug statements accidentally left
entry: "pydevd.*settrace\\("
pass_filenames: true
files: \.py$
- id: check-pytest-mark-db-test-in-providers
language: pygrep
name: Check pytest.mark.db_test use in providers
entry: pytest\.mark\.db_test
pass_filenames: true
# Here we should add providers that are already free from the pytest.mark.db_test
# and we want to keep them clean and only use non-db-tests
files: >
(?x)
^providers/airbyte/.*\.py$|
^providers/apache/beam/.*\.py$|
^providers/apache/flink/.*\.py$|
^providers/apache/iceberg/.*\.py$|
^providers/apache/kafka/.*\.py$|
^providers/arangodb/.*\.py$|
^providers/asana/.*\.py$|
^providers/cloudant/.*\.py$|
^providers/cohere/.*\.py$|
^providers/common/compat/.*\.py$|
^providers/common/messaging/.*\.py$|
^providers/datadog/.*\.py$|
^providers/dingding/.*\.py$|
^providers/discord/.*\.py$|
^providers/exasol/.*\.py$|
^providers/facebook/.*\.py$|
^providers/ftp/.*\.py$|
^providers/grpc/.*\.py$|
^providers/hashicorp/.*\.py$|
^providers/imap/.*\.py$|
^providers/influxdb/.*\.py$|
^providers/jdbc/.*\.py$|
^providers/jenkins/.*\.py$|
^providers/mongo/.*\.py$|
^providers/microsoft/psrp/.*\.py$|
^providers/microsoft/winrm/.*\.py$|
^providers/neo4j/.*\.py$|
^providers/odbc/.*\.py$|
^providers/openai/.*\.py$|
^providers/openfaas/.*\.py$|
^providers/oracle/.*\.py$|
^providers/pagerduty/.*\.py$|
^providers/pgvector/.*\.py$|
^providers/pinecone/.*\.py$|
^providers/postgres/.*\.py$|
^providers/presto/.*\.py$|
^providers/segment/.*\.py$|
^providers/sendgrid/.*\.py$|
^providers/singularity/.*\.py$|
^providers/tableau/.*\.py$|
^providers/teradata/.*\.py$|
^providers/trino/.*\.py$|
^providers/vertica/.*\.py$|
^providers/yandex/.*\.py$|
^providers/zendesk/.*\.py$
- id: check-links-to-example-dags-do-not-use-hardcoded-versions
name: Verify no hard-coded version in example dags
description: The links to example dags should use |version| as version specification
language: pygrep
entry: >
(?i)
.*https://github.*/main/providers/.*/src/airflow/providers/.*/example_dags/|
.*https://github.*/master/providers/.*/src/airflow/providers/.*/example_dags/
pass_filenames: true
files: ^providers/.*/docs/.*\.rst
- id: check-safe-filter-usage-in-html
language: pygrep
name: Don't use safe in templates
description: the Safe filter is error-prone, use Markup() in code instead
entry: "\\|\\s*safe"
files: \.html$
pass_filenames: true
- id: check-no-providers-in-core-examples
language: pygrep
name: No providers imports in core example DAGs
description: The core example DAGs have no dependencies other than standard provider or core Airflow
entry: "^\\s*from airflow\\.providers.(?!standard.)"
pass_filenames: true
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/src/airflow/example_dags/.*\.py$
- id: check-no-airflow-deprecation-in-providers
language: pygrep
name: Do not use DeprecationWarning in providers
description: Use AirflowProviderDeprecationWarning in providers
entry: "^\\s*DeprecationWarning*"
pass_filenames: true
files: ^providers/.*/src/airflow/providers/.*\.py$
- id: check-urlparse-usage-in-code
language: pygrep
name: Don't use urlparse in code
description: urlparse is not recommended, use urlsplit() in code instead
entry: "^\\s*from urllib\\.parse import ((\\|, )(urlparse\\|urlunparse))+$"
pass_filenames: true
files: \.py$
- id: check-only-new-session-with-provide-session
name: Check NEW_SESSION is only used with @provide_session
language: python
entry: ./scripts/ci/pre_commit/new_session_in_provide_session.py
pass_filenames: true
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/src/airflow/.+\.py$
exclude: ^airflow-core/src/airflow/serialization/pydantic/.*
- id: check-for-inclusive-language
language: pygrep
name: Check for language that we do not accept as community
description: Please use more appropriate words for community documentation.
entry: >
(?ix)
(black|white)[_-]?list|
\bshe\b|
\bhe\b|
\bher\b|
\bhis\b|
\bmaster\b|
\bslave\b|
\bsanity\b|
\bdummy\b
pass_filenames: true
exclude: >
(?x)
^airflow-core/src/airflow/ui/src/i18n/config\.ts$|
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
^airflow-core/src/airflow/ui/openapi-gen/|
^airflow-core/src/airflow/ui/public/i18n/locales/de/README\.md$|
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
^airflow-core/src/airflow/cli/commands/local_commands/fastapi_api_command\.py$|
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
^airflow-core/src/airflow/config_templates/|
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
^airflow-core/src/airflow/models/baseoperator\.py$|
^airflow-core/src/airflow/operators/__init__\.py$|
^providers/common/sql/tests/provider_tests/common/sql/operators/test_sql_execute\.py$|
^providers/amazon/src/airflow/providers/amazon/aws/hooks/emr\.py$|
^providers/amazon/src/airflow/providers/amazon/aws/operators/emr\.py$|
^providers/apache/cassandra/src/airflow/providers/apache/cassandra/hooks/cassandra\.py$|
^providers/apache/hive/src/airflow/providers/apache/hive/operators/hive_stats\.py$|
^providers/apache/hive/src/airflow/providers/apache/hive/transfers/vertica_to_hive\.py$|
^providers/apache/spark/src/airflow/providers/apache/spark/decorators/|
^providers/apache/spark/src/airflow/providers/apache/spark/hooks/|
^providers/apache/spark/src/airflow/providers/apache/spark/operators/|
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
^providers/exasol/src/airflow/providers/exasol/hooks/exasol\.py$|
^providers/fab/src/airflow/providers/fab/auth_manager/security_manager/|
^providers/fab/src/airflow/providers/fab/www/static/|
^providers/fab/src/airflow/providers/fab/www/templates/|
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
^providers/google/src/airflow/providers/google/cloud/hooks/bigquery\.py$|
^providers/google/src/airflow/providers/google/cloud/operators/cloud_build\.py$|
^providers/google/src/airflow/providers/google/cloud/operators/dataproc\.py$|
^providers/google/src/airflow/providers/google/cloud/operators/mlengine\.py$|
^providers/keycloak/src/airflow/providers/keycloak/auth_manager/cli/definition.py|
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
^providers/microsoft/azure/src/airflow/providers/microsoft/azure/hooks/cosmos\.py$|
^providers/microsoft/winrm/src/airflow/providers/microsoft/winrm/hooks/winrm\.py$|
^airflow-core/docs/.*commits\.rst$|
^providers/microsoft/winrm/src/airflow/providers/microsoft/winrm/operators/winrm\.py$|
^providers/opsgenie/src/airflow/providers/opsgenie/hooks/opsgenie\.py$|
^providers/redis/src/airflow/providers/redis/provider\.yaml$|
^airflow-core/src/airflow/serialization/serialized_objects\.py$|
^airflow-core/src/airflow/api_fastapi/auth/managers/simple/ui/pnpm-lock\.yaml$|
^airflow-core/src/airflow/ui/pnpm-lock\.yaml$|
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
^airflow-core/src/airflow/utils/db\.py$|
^airflow-core/src/airflow/utils/trigger_rule\.py$|
^chart/values.schema\.json$|
^helm-tests/tests/chart_utils/helm_template_generator\.py$|
^helm-tests/tests/chart_utils/ingress-networking-v1beta1\.json$|
^dev/|
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
^devel-common/src/docs/README\.rst$|
^docs/apache-airflow-providers-amazon/secrets-backends/aws-ssm-parameter-store\.rst$|
^providers/apache/kafka/docs/connections/kafka\.rst$|
^providers/apache/hdfs/docs/connections\.rst$|
^providers/apache/spark/docs/decorators/pyspark\.rst$|
^providers/microsoft/azure/docs/connections/azure_cosmos\.rst$|
^providers/fab/docs/auth-manager/webserver-authentication\.rst$|
^providers/google/docs/operators/cloud/kubernetes_engine\.rst$|
^providers/cncf/kubernetes/docs/operators\.rst$|
^.*/conf\.py$|
^.*/conf_constants\.py$|
^.*/provider_conf\.py$|
^devel-common/src/sphinx_exts/removemarktransform\.py|
^devel-common/src/tests_common/test_utils/db\.py|
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
^airflow-core/newsfragments/41761.significant\.rst$|
^scripts/ci/pre_commit/vendor_k8s_json_schema\.py$|
^scripts/ci/docker-compose/integration-keycloak\.yml$|
^scripts/ci/docker-compose/keycloak/keycloak-entrypoint\.sh$|
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
^airflow-core/tests/|
^providers/.*/tests/|
^\.pre-commit-config\.yaml$|
^.*CHANGELOG\.(rst|txt)$|
^.*changelog\.(rst|txt)$|
^.*commits\.(rst|txt)$|
^.*RELEASE_NOTES\.rst$|
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
^contributing-docs/03_contributors_quick_start\.rst$|
^.*\.(png|gif|jp[e]?g|svg|tgz|lock)$|
git|
^airflow-core/newsfragments/43349\.significant\.rst$|
^airflow-core/newsfragments/41368\.significant\.rst$|
.*/dist/.*|
package-lock\.json$
- id: check-base-operator-partial-arguments
name: Check BaseOperator and partial() arguments
language: python
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
entry: ./scripts/ci/pre_commit/check_base_operator_partial_arguments.py
pass_filenames: false
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/src/airflow/models/(?:base|mapped)operator\.py$
additional_dependencies: ['rich>=12.4.4']
- id: check-init-decorator-arguments
name: Sync model __init__ and decorator arguments
language: python
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
entry: ./scripts/ci/pre_commit/check_init_decorator_arguments.py
pass_filenames: false
files: ^task-sdk/src/airflow/sdk/definitions/dag\.py$|^task-sdk/src/airflow/sdk/definitions/decorators/task_group\.py$
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
additional_dependencies: ['rich>=12.4.4']
- id: check-template-context-variable-in-sync
name: Sync template context variable refs
language: python
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
entry: ./scripts/ci/pre_commit/check_template_context_variable_in_sync.py
files: ^airflow-core/src/airflow/models/taskinstance\.py$|^task-sdk/src/airflow/sdk/definitions/context\.py$|^airflow-core/docs/templates-ref\.rst$
additional_dependencies: ['rich>=12.4.4']
- id: check-base-operator-usage
language: pygrep
name: Check BaseOperator core imports
description: Make sure BaseOperator is imported from airflow.models.baseoperator in core
entry: "from airflow\\.models import.* BaseOperator\\b"
files: \.py$
pass_filenames: true
exclude: >
(?x)
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
^airflow-core/src/airflow/decorators/.*$|
^airflow-core/src/airflow/hooks/.*$|
^airflow-core/src/airflow/operators/.*$|
^providers/.*$
- id: check-base-operator-usage
language: pygrep
name: Check BaseOperatorLink core imports
description: Make sure BaseOperatorLink is not imported from airflow.models in core
entry: "^\\s*from airflow\\.models\\.baseoperatorlink import BaseOperatorLink\\b"
files: \.py$
pass_filenames: true
exclude: >
(?x)
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
^airflow-core/src/airflow/decorators/.*$|
^airflow-core/src/airflow/hooks/.*$|
^airflow-core/src/airflow/operators/.*$|
^providers/.*/src/airflow/providers/.*$|
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
^providers/.*/src/airflow/providers/standard/sensors/.*$
- id: check-base-operator-usage
language: pygrep
name: Check BaseOperator other imports
description: Make sure BaseOperator is imported from airflow.models outside of core
entry: "from airflow\\.models\\.baseoperator import.* BaseOperator"
pass_filenames: true
files: >
(?x)
^providers/.*/src/airflow/providers/.*\.py$
exclude: ^providers/standard/.*/.*\.py$
- id: check-get-lineage-collector-providers
language: python
name: Check providers import hook lineage code from compat
description: Make sure you import from airflow.provider.common.compat.lineage.hook instead of
airflow.lineage.hook.
entry: ./scripts/ci/pre_commit/check_airflow_imports.py
--pattern '^airflow\.lineage\.hook'
--message "Only TYPE_CHECKING imports from `airflow.lineage.hook` are allowed in providers."
--only_top_level
files: ^providers/.*/src/airflow/providers/.*\.py$
2025-01-27 15:15:57 +05:30
exclude: ^providers/common/compat/src/airflow/providers/common/compat/.*\.py$
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['rich>=12.4.4']
- id: check-decorated-operator-implements-custom-name
name: Check @task decorator implements custom_operator_name
language: python
entry: ./scripts/ci/pre_commit/decorator_operator_implements_custom_name.py
pass_filenames: true
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/src/airflow/.*\.py$
- id: check-core-deprecation-classes
language: pygrep
name: Verify usage of Airflow deprecation classes in core
entry: category=DeprecationWarning|category=PendingDeprecationWarning
files: \.py$
exclude: ^airflow-core/src/airflow/configuration\.py$|^airflow-core/tests/.*$|^providers/.*/src/airflow/providers/|^scripts/in_container/verify_providers\.py$|^providers/.*/tests/.*$|^devel-common/
pass_filenames: true
- id: check-provide-create-sessions-imports
language: pygrep
name: Check session util imports
description: NEW_SESSION, provide_session, and create_session should be imported from airflow.utils.session to avoid import cycles.
entry: "from airflow\\.utils\\.db import.* (NEW_SESSION|provide_session|create_session)"
files: \.py$
pass_filenames: true
- id: check-incorrect-use-of-LoggingMixin
language: pygrep
name: Make sure LoggingMixin is not used alone
entry: "LoggingMixin\\(\\)"
files: \.py$
pass_filenames: true
- id: check-start-date-not-used-in-defaults
language: pygrep
name: start_date not in default_args
entry: "default_args\\s*=\\s*{\\s*(\"|')start_date(\"|')|(\"|')start_date(\"|'):"
files: \.*example_dags.*\.py$
pass_filenames: true
- id: check-apache-license-rat
name: Check if licenses are OK for Apache
entry: ./scripts/ci/pre_commit/check_license.py
language: python
files: ^LICENSE$
pass_filenames: false
- id: check-aiobotocore-optional
name: Check if aiobotocore is an optional dependency only
entry: ./scripts/ci/pre_commit/check_aiobotocore_optional.py
language: python
files: ^providers/.*/provider\.yaml$
pass_filenames: true
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['click>=8.1.8', 'rich>=12.4.4', 'pyyaml>=6.0.2']
require_serial: true
- id: check-boring-cyborg-configuration
name: Checks for Boring Cyborg configuration consistency
language: python
entry: ./scripts/ci/pre_commit/boring_cyborg.py
pass_filenames: false
require_serial: true
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['pyyaml>=6.0.2', 'termcolor==2.5.0', 'wcmatch==8.2']
- id: update-in-the-wild-to-be-sorted
name: Sort INTHEWILD.md alphabetically
entry: ./scripts/ci/pre_commit/sort_in_the_wild.py
language: python
files: ^\.pre-commit-config\.yaml$|^INTHEWILD\.md$
pass_filenames: false
require_serial: true
- id: update-installed-providers-to-be-sorted
name: Sort and uniquify installed_providers.txt
entry: ./scripts/ci/pre_commit/sort_installed_providers.py
language: python
files: ^\.pre-commit-config\.yaml$|^.*_installed_providers\.txt$
pass_filenames: false
require_serial: true
- id: update-spelling-wordlist-to-be-sorted
name: Sort spelling_wordlist.txt
entry: ./scripts/ci/pre_commit/sort_spelling_wordlist.py
language: python
files: ^\.pre-commit-config\.yaml$|^docs/spelling_wordlist\.txt$
require_serial: true
pass_filenames: false
- id: lint-helm-chart
name: Lint Helm Chart
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
entry: ./scripts/ci/pre_commit/lint_helm.py
language: python
pass_filenames: false
files: ^chart
require_serial: true
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['rich>=12.4.4','requests>=2.31.0']
- id: validate-chart-annotations
name: Validate chart annotations
entry: ./scripts/ci/pre_commit/validate_chart_annotations.py
language: python
pass_filenames: false
files: ^chart/Chart\.yaml$
additional_dependencies: ['pyyaml>=6.0.2', 'rich>=12.4.4']
- id: kubeconform
name: Kubeconform check on our helm chart
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
entry: ./scripts/ci/pre_commit/check_kubeconform.py
language: python
pass_filenames: false
files: ^chart
require_serial: true
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['rich>=12.4.4','requests>=2.31.0']
- id: shellcheck
name: Check Shell scripts syntax correctness
language: docker_image
2022-05-04 00:37:30 +02:00
entry: koalaman/shellcheck:v0.8.0 -x -a
files: \.(bash|sh)$|^hooks/build$|^hooks/push$
exclude: ^dev/breeze/autocomplete/.*$
- id: compile-ui-assets
name: Compile ui assets (manual)
language: node
stages: ['manual']
types_or: [javascript, ts, tsx]
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/src/airflow/ui/|^airflow-core/src/airflow/api_fastapi/auth/managers/simple/ui/
entry: ./scripts/ci/pre_commit/compile_ui_assets.py
pass_filenames: false
additional_dependencies: ['pnpm@9.7.1']
- id: compile-fab-assets
name: Compile FAB provider assets
language: node
files: ^providers/fab/.*/www/
entry: ./scripts/ci/pre_commit/compile_fab_assets.py
pass_filenames: false
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['yarn@1.22.21']
- id: compile-ui-assets-dev
name: Compile ui assets in dev mode (manual)
language: node
stages: ['manual']
types_or: [javascript, ts, tsx]
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/src/airflow/ui/|^airflow-core/src/airflow/api_fastapi/auth/managers/simple/ui/
entry: ./scripts/ci/pre_commit/compile_ui_assets_dev.py
pass_filenames: false
additional_dependencies: ['pnpm@9.7.1']
- id: check-providers-subpackages-init-file-exist
name: Provider subpackage init files are there
pass_filenames: false
always_run: true
entry: ./scripts/ci/pre_commit/check_providers_subpackages_all_have_init.py
language: python
require_serial: true
Removed the unused provider's distribution (#46608) This is a set of cleanup steps (first stage) that allow us to remove the "intermediate" provider's distribution from Airlfow code and replace it fully with individual provider's distributions - already with own `pyproject.toml` files and basically being (when we complete) a completely separate distributions from Airflow and without implicit dependencies between unrelated distributions. There are a number of other changes needed but that one is only focusing on removing all references to the "umbrella" `providers` distribution and consequences of removing it. Those are the changes implemented in this PR: * There are no separate "providers" system tests - each provider has own system tests and there are no common "generic" providers empty system test * Integration tests are moved to respective providers under the `integration` package inside `tests` directory * (nearly) empty __init__.py files are added in `tests` directories of providers - this way "tests" becomes just a directory and root for all tests per provider, rather than a Python package on its own. That allows to use "from integration.PROVIDER import" and "from system.PROVIDER" rather than importing them from the root of the whole airflow project. The (nearly) is because we need to handle multiple "system", "system.apache" and other import locations. * Removed references to "providers/" generic package which were scheduled for removal after all providers are moved to the new structure * Few remaining references / links referring to old "providers/src" and "providers/test" have been fixed. * The "conftest.py" files in all providers are trimmed down - the code to store ignored deprecation warnings have been moved to the test_common pytest_plugin. That allows to remove 90+ duplicated snippets of deprecation_warnings retrieval while keeping the warnings per-provider in the provider's distribution. * The "moving_providers" scripts are removed. They've done their job and are not needed any more - we keep them in history * The __init__.py files are automatically checked and properly updated in provider folders - in order to properly handle path extension mechanisms * The www tests that were using FAB permisssion model are moved to the FAB provider tests.
2025-02-15 17:44:24 +01:00
additional_dependencies: ['rich>=12.4.4']
- id: check-pre-commit-information-consistent
name: Validate hook IDs & names and sync with docs
entry: ./scripts/ci/pre_commit/check_pre_commit_hooks.py
args:
- --max-length=53
language: python
files: ^\.pre-commit-config\.yaml$|^scripts/ci/pre_commit/check_pre_commit_hooks\.py$
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['pyyaml>=6.0.2', 'jinja2', 'black==24.10.0', 'tabulate>=0.9.0', 'rich>=12.4.4']
require_serial: true
pass_filenames: false
- id: check-integrations-list-consistent
name: Sync integrations list with docs
entry: ./scripts/ci/pre_commit/check_integrations_list.py
language: python
files: ^scripts/ci/docker-compose/integration-.*\.yml$|^contributing-docs/testing/integration_tests\.rst$
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['black==24.10.0', 'tabulate>=0.9.0', 'rich>=12.4.4', 'pyyaml>=6.0.2']
require_serial: true
pass_filenames: false
- id: update-breeze-readme-config-hash
name: Update Breeze README.md with config files hash
language: python
entry: ./scripts/ci/pre_commit/update_breeze_config_hash.py
files: ^dev/breeze/pyproject\.toml$|^dev/breeze/README\.md$
pass_filenames: false
require_serial: true
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
additional_dependencies: ['rich>=12.4.4']
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
- id: update-pyproject-toml
name: Update Airflow's meta-package pyproject.toml
language: python
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
entry: ./scripts/ci/pre_commit/update_airflow_pyproject_toml.py
Add Python 3.13 support for Airflow. (#46891) * Breeze changes for Python 3.13 * Pyproject.toml provider changes for Python 3.13 * README.rst changes for providers for Python 3.13 * Add Python 3.13 support for Airflow. Added Python 3.13 support across the codebase, including: * CI/CD workflow updates to handle Python 3.13. * Dockerfile and environment variable adjustments for compatibility. * Documentation updates to list Python 3.13 as supported. * Dependency and code changes for compatibility with new/changed libraries (e.g., numpy 2.x, greenlet, pendulum). * Test and plugin manager adjustments for Python 3.13-specific behaviors. * Removal or skipping of tests and features not compatible with Python 3.13. * Improved error handling and logging for unsupported plugins/providers on Python 3.13. * Updated all provider README.rst files to: * List Python 3.13 as a supported version. * Adjust dependency requirements for Python 3.13 (e.g., pandas, pyarrow, ray, etc.). * Add or update notes about excluded or conditionally supported dependencies for Python 3.13. * Document any known incompatibilities or workarounds for specific providers. * Updated all provider pyproject.toml files and automation to: * Add Python 3.13 to the supported classifiers. * Adjust requires-python and dependency constraints for Python 3.13. * Exclude Python 3.13 for providers that are not yet compatible (e.g., those depending on Flask AppBuilder). * Add conditional dependencies for new versions of libraries required by Python 3.13. * Updated Breeze and related scripts to: * Build and test with Python 3.13. * Update documentation and release scripts to include Python 3.13. * Ensure all dev tooling and test environments work with Python 3.13. * Removed remaining FAB related code from core and removed tests for older FAB provider versions (<1.3.0) * some of the tests in core still depend on FAB - but we make them optional - both for parsing (we need to skip some imports) and execution - because they test a legacy behaviour of embedding Flask plugins that is still supported in core. * k8s tests now run also with SimpleAuthManager and SimpleAuthManager is used automatically when runnin tests in Python 3.13 * migration tests had to be excluded fo Python 3.13 because we cannot migrate down on Python 3.13 without FAB tables created. The tests will be brought back when FAB is supported or when we release 3.1 and start working on 3.2, we should be able to migrate down to 3.1 * Weaviate tests have been updated to handle case where weaviate-client is > 2.10.0 - because it started to use httpx instead of requests, and Python 3.13 actually unblocks using older version of weaviate (it was previously blocked indirectly via Flask dependencies and grpcio). * Added doc change in our rules on what is the "default" Python version for airflow images - handling the case where we cannot use "newest" Python version as default where not all "regular" image providers are supported in the latest version * Connection is now flushed in `configure_git_connection_for_dag_bundle` just before `clear_db_connections` - in order to handle Python 3.13 case where FAB app is not initialized by other fixtures - performing implicit flush along the way * Cleaning db connections was added to test_dag_run and test_dags test in fast_api as the test implicitly rely on having connections cleared (no test git connections added) - this will make the tests side-effect free. * Conditionally skipping some serialization tests involving yandex and ray on Python 3.13 until they support Python 3.13
2025-07-17 16:53:49 +02:00
files: >
(?x)
^.*/pyproject\.toml$|
^scripts/ci/pre_commit/update_airflow_pyproject_toml\.py$|
^providers/.*/pyproject\.toml$|
^providers/.*/provider\.yaml$
pass_filenames: false
require_serial: true
Add Python 3.13 support for Airflow. (#46891) * Breeze changes for Python 3.13 * Pyproject.toml provider changes for Python 3.13 * README.rst changes for providers for Python 3.13 * Add Python 3.13 support for Airflow. Added Python 3.13 support across the codebase, including: * CI/CD workflow updates to handle Python 3.13. * Dockerfile and environment variable adjustments for compatibility. * Documentation updates to list Python 3.13 as supported. * Dependency and code changes for compatibility with new/changed libraries (e.g., numpy 2.x, greenlet, pendulum). * Test and plugin manager adjustments for Python 3.13-specific behaviors. * Removal or skipping of tests and features not compatible with Python 3.13. * Improved error handling and logging for unsupported plugins/providers on Python 3.13. * Updated all provider README.rst files to: * List Python 3.13 as a supported version. * Adjust dependency requirements for Python 3.13 (e.g., pandas, pyarrow, ray, etc.). * Add or update notes about excluded or conditionally supported dependencies for Python 3.13. * Document any known incompatibilities or workarounds for specific providers. * Updated all provider pyproject.toml files and automation to: * Add Python 3.13 to the supported classifiers. * Adjust requires-python and dependency constraints for Python 3.13. * Exclude Python 3.13 for providers that are not yet compatible (e.g., those depending on Flask AppBuilder). * Add conditional dependencies for new versions of libraries required by Python 3.13. * Updated Breeze and related scripts to: * Build and test with Python 3.13. * Update documentation and release scripts to include Python 3.13. * Ensure all dev tooling and test environments work with Python 3.13. * Removed remaining FAB related code from core and removed tests for older FAB provider versions (<1.3.0) * some of the tests in core still depend on FAB - but we make them optional - both for parsing (we need to skip some imports) and execution - because they test a legacy behaviour of embedding Flask plugins that is still supported in core. * k8s tests now run also with SimpleAuthManager and SimpleAuthManager is used automatically when runnin tests in Python 3.13 * migration tests had to be excluded fo Python 3.13 because we cannot migrate down on Python 3.13 without FAB tables created. The tests will be brought back when FAB is supported or when we release 3.1 and start working on 3.2, we should be able to migrate down to 3.1 * Weaviate tests have been updated to handle case where weaviate-client is > 2.10.0 - because it started to use httpx instead of requests, and Python 3.13 actually unblocks using older version of weaviate (it was previously blocked indirectly via Flask dependencies and grpcio). * Added doc change in our rules on what is the "default" Python version for airflow images - handling the case where we cannot use "newest" Python version as default where not all "regular" image providers are supported in the latest version * Connection is now flushed in `configure_git_connection_for_dag_bundle` just before `clear_db_connections` - in order to handle Python 3.13 case where FAB app is not initialized by other fixtures - performing implicit flush along the way * Cleaning db connections was added to test_dag_run and test_dags test in fast_api as the test implicitly rely on having connections cleared (no test git connections added) - this will make the tests side-effect free. * Conditionally skipping some serialization tests involving yandex and ray on Python 3.13 until they support Python 3.13
2025-07-17 16:53:49 +02:00
additional_dependencies: ['rich>=12.4.4', 'tomli>=2.0.1', 'packaging>=25' ]
- id: update-reproducible-source-date-epoch
name: Update Source Date Epoch for reproducible builds
language: python
entry: ./scripts/ci/pre_commit/update_source_date_epoch.py
files: ^RELEASE_NOTES\.rst$|^chart/RELEASE_NOTES\.rst$
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['rich>=12.4.4', 'pyyaml>=6.0.2']
pass_filenames: false
require_serial: true
- id: check-breeze-top-dependencies-limited
name: Check top-level breeze deps
description: Breeze should have small number of top-level dependencies
language: python
entry: ./scripts/tools/check_if_limited_dependencies.py
files: ^dev/breeze/.*$
pass_filenames: false
require_serial: true
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['click>=8.1.8', 'rich>=12.4.4', 'pyyaml>=6.0.2']
- id: check-tests-in-the-right-folders
name: Check if tests are in the right folders
entry: ./scripts/ci/pre_commit/check_tests_in_right_folders.py
language: python
files: ^airflow-core/tests/.*\.py$
pass_filenames: true
require_serial: true
additional_dependencies: ['rich>=12.4.4']
- id: check-system-tests-present
name: Check if system tests have required segments of code
entry: ./scripts/ci/pre_commit/check_system_tests.py
language: python
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^.*/tests/system/.*/example_[^/]*\.py$
pass_filenames: true
additional_dependencies: ['rich>=12.4.4']
- id: generate-pypi-readme
name: Generate PyPI README
entry: ./scripts/ci/pre_commit/generate_pypi_readme.py
language: python
files: ^README\.md$
pass_filenames: false
- id: lint-markdown
name: Run markdownlint
description: Checks the style of Markdown files.
entry: markdownlint
language: node
types: [markdown]
files: \.(md|mdown|markdown)$
additional_dependencies: ['markdownlint-cli@0.38.0']
- id: lint-json-schema
name: Lint JSON Schema files
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
entry: ./scripts/ci/pre_commit/lint_json_schema.py
args:
- --spec-file
- scripts/ci/pre_commit/draft7_schema.json
language: python
pass_filenames: true
files: .*\.schema\.json$
require_serial: true
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['jsonschema>=3.2.0,<5.0', 'pyyaml>=6.0.2', 'requests==2.32.3', 'rich>=12.4.4']
- id: lint-json-schema
name: Lint NodePort Service
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
entry: ./scripts/ci/pre_commit/lint_json_schema.py
args:
- --spec-url
2021-11-24 23:29:46 +01:00
- https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.20.2-standalone/service-v1.json
language: python
pass_filenames: true
files: ^scripts/ci/kubernetes/nodeport\.yaml$
require_serial: true
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['jsonschema>=3.2.0,<5.0', 'pyyaml>=6.0.2', 'requests==2.32.3', 'rich>=12.4.4']
- id: lint-json-schema
name: Lint Docker compose files
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
entry: ./scripts/ci/pre_commit/lint_json_schema.py
args:
- --spec-url
- https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json
language: python
pass_filenames: true
files: ^scripts/ci/docker-compose/.+\.ya?ml$|docker-compose\.ya?ml$
exclude: >
(?x)
^scripts/ci/docker-compose/grafana/.|
Create Apache TinkerPop provider (#47446) * tests passed * narrow down CI * fix host * add drill for testing * add docker inspect * create a funtion * minor changes * change the inspect * add status condition * change host to zeros * rewrite the pipeline * push image and reuse * remove tag * rename tag * change to locally pushed image * add sha to image name * add sha to image name * add debug and login * change token name * change token name * remove login * remove login * remove login * move token to hight level * copy from ci * change to secrets * test workflow * test workflow * rerun on CI login * rerun on CI login * logout * revert logout * revert login * remove cleanup * readd cleanup * change docker pass * add login to action * move up * chage token * one job * one job * remove action * delete if condition * rename image * fix tar name * fix tar name * fix tar name * remove status * remove stdin * add logs and hostname * removed restart * add chmod * create entry sh * create entry sh * add status * remove failure * add user * revert back all ci yamls * revert back shell script * fix tinkerpop * change back to gremlin in the providers list * change docs * change docs * add conn_name_attr * move system test * change to cap * change to 1.0.0 * fix sh * removed serializer and some changes * fixing docs * update provider * change to 2.9.0 and add spell check * ran breeze release management * add doc strings * add asterisk * moved operators doc * fixed docs * fixed pyproject * minor change to docs * add conf.py * fixed docs * fix toml * changed to 2.10 * remove fab from tinkerpop * fix prov info * add close method * fix integration * change gremlin host * change gremlin host back * remove async * remove package * fix pyproject * fix test --------- Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
2025-04-24 11:19:09 +01:00
^scripts/ci/docker-compose/gremlin/.|
^scripts/ci/docker-compose/.+-config\.ya?ml$
require_serial: true
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['jsonschema>=3.2.0,<5.0', 'pyyaml>=6.0.2', 'requests==2.32.3', 'rich>=12.4.4']
- id: lint-json-schema
name: Lint chart/values.schema.json
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
entry: ./scripts/ci/pre_commit/lint_json_schema.py
args:
- --spec-file
- chart/values_schema.schema.json
- chart/values.schema.json
language: python
pass_filenames: false
files: ^chart/values\.schema\.json$|^chart/values_schema\.schema\.json$
require_serial: true
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['jsonschema>=3.2.0,<5.0', 'pyyaml>=6.0.2', 'requests==2.32.3', 'rich>=12.4.4']
- id: update-vendored-in-k8s-json-schema
name: Vendor k8s definitions into values.schema.json
entry: ./scripts/ci/pre_commit/vendor_k8s_json_schema.py
language: python
files: ^chart/values\.schema\.json$
additional_dependencies: ['requests==2.32.3']
- id: lint-json-schema
name: Lint chart/values.yaml
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
entry: ./scripts/ci/pre_commit/lint_json_schema.py
args:
- --enforce-defaults
- --spec-file
- chart/values.schema.json
- chart/values.yaml
language: python
pass_filenames: false
files: ^chart/values\.yaml$|^chart/values\.schema\.json$
require_serial: true
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['jsonschema>=3.2.0,<5.0', 'pyyaml>=6.0.2', 'requests==2.32.3', 'rich>=12.4.4']
- id: lint-json-schema
name: Lint config_templates/config.yml
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
entry: ./scripts/ci/pre_commit/lint_json_schema.py
args:
- --spec-file
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
- airflow-core/src/airflow/config_templates/config.yml.schema.json
language: python
pass_filenames: true
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/src/airflow/config_templates/config\.yml$
require_serial: true
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['jsonschema>=3.2.0,<5.0', 'pyyaml>=6.0.2', 'requests==2.32.3', 'rich>=12.4.4']
- id: check-persist-credentials-disabled-in-github-workflows
name: Check persistent creds in workflow files
description: Check that workflow files have persist-credentials disabled
entry: ./scripts/ci/pre_commit/checkout_no_credentials.py
language: python
pass_filenames: true
files: ^\.github/workflows/.*\.yml$
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['pyyaml>=6.0.1', 'rich>=12.4.4']
- id: check-docstring-param-types
name: Check that docstrings do not specify param types
entry: ./scripts/ci/pre_commit/docstring_param_type.py
language: python
pass_filenames: true
files: \.py$
additional_dependencies: ['rich>=12.4.4']
- id: check-zip-file-is-not-committed
name: Check no zip files are committed
description: Zip files are not allowed in the repository
language: fail
entry: |
Zip files are not allowed in the repository as they are hard to
track and have security implications. Please remove the zip file from the repository.
files: \.zip$
- id: check-code-deprecations
name: Check deprecations categories in decorators
entry: ./scripts/ci/pre_commit/check_deprecations.py
language: python
pass_filenames: true
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/src/airflow/.*\.py$
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['rich>=12.4.4', 'python-dateutil>=2.9.0']
- id: lint-chart-schema
name: Lint chart/values.schema.json file
entry: ./scripts/ci/pre_commit/chart_schema.py
language: python
pass_filenames: false
files: ^chart/values\.schema\.json$
require_serial: true
- id: update-inlined-dockerfile-scripts
Converts Dockerfiles to be standalone (#22492) This change is one of the biggest optimizations to the Dockerfiles that from the very beginning was a goal, but it has been enabled by switching to buildkit and recent relase of support for the 1.4 dockerfile syntax. This syntax introduced two features: * heredocs * links for COPY commands Both changes allows to solve multiple problems: * COPY for build scripts suffer from permission problems. Depending on umask setting of the host, the scripts could have different group permissions and invalidate docker cache. Inlining the scripts (automatically by pre-commit) gets rid of the problem completely * COPY --link allows to optimize and parallelize builds for Dockerfile.ci embedded source code. This should speed up not only building the images locally but also it will allow to use more efficiently cache for the CI builds (in case no source code change, the builds will use pre-cached layers from the cache more efficiently (and in parallel) * The PROD Dockerfile is now completely standalone. You do not need to have any folders or files to build Airlfow image. At the same time the versatility and support for multiple ways on how you can build the image (as described in https://airflow.apache.org/docs/docker-stack/build.html is maintained (this was a goal from the very beginning of the PROD Dockerfile but it was not easily achievable - heredocs allow to inline scripts that are used for the build and the pre-commits will make sure that there is one source of truth and nicely editable scripts for both PROD and CI Dockerfile. The last point is really cool, because it allows our users to build custom dockerfiles without checking out the code of Airflow, it is enough to download the latest released Dockerfile and they can easily build the image. Overall - this change will vastly optimize build speed for both PROD and CI images in multiple scenarios.
2022-03-27 19:19:02 +02:00
name: Inline Dockerfile and Dockerfile.ci scripts
entry: ./scripts/ci/pre_commit/inline_scripts_in_docker.py
Converts Dockerfiles to be standalone (#22492) This change is one of the biggest optimizations to the Dockerfiles that from the very beginning was a goal, but it has been enabled by switching to buildkit and recent relase of support for the 1.4 dockerfile syntax. This syntax introduced two features: * heredocs * links for COPY commands Both changes allows to solve multiple problems: * COPY for build scripts suffer from permission problems. Depending on umask setting of the host, the scripts could have different group permissions and invalidate docker cache. Inlining the scripts (automatically by pre-commit) gets rid of the problem completely * COPY --link allows to optimize and parallelize builds for Dockerfile.ci embedded source code. This should speed up not only building the images locally but also it will allow to use more efficiently cache for the CI builds (in case no source code change, the builds will use pre-cached layers from the cache more efficiently (and in parallel) * The PROD Dockerfile is now completely standalone. You do not need to have any folders or files to build Airlfow image. At the same time the versatility and support for multiple ways on how you can build the image (as described in https://airflow.apache.org/docs/docker-stack/build.html is maintained (this was a goal from the very beginning of the PROD Dockerfile but it was not easily achievable - heredocs allow to inline scripts that are used for the build and the pre-commits will make sure that there is one source of truth and nicely editable scripts for both PROD and CI Dockerfile. The last point is really cool, because it allows our users to build custom dockerfiles without checking out the code of Airflow, it is enough to download the latest released Dockerfile and they can easily build the image. Overall - this change will vastly optimize build speed for both PROD and CI images in multiple scenarios.
2022-03-27 19:19:02 +02:00
language: python
pass_filenames: false
files: ^Dockerfile$|^Dockerfile\.ci$|^scripts/docker/.*$
Converts Dockerfiles to be standalone (#22492) This change is one of the biggest optimizations to the Dockerfiles that from the very beginning was a goal, but it has been enabled by switching to buildkit and recent relase of support for the 1.4 dockerfile syntax. This syntax introduced two features: * heredocs * links for COPY commands Both changes allows to solve multiple problems: * COPY for build scripts suffer from permission problems. Depending on umask setting of the host, the scripts could have different group permissions and invalidate docker cache. Inlining the scripts (automatically by pre-commit) gets rid of the problem completely * COPY --link allows to optimize and parallelize builds for Dockerfile.ci embedded source code. This should speed up not only building the images locally but also it will allow to use more efficiently cache for the CI builds (in case no source code change, the builds will use pre-cached layers from the cache more efficiently (and in parallel) * The PROD Dockerfile is now completely standalone. You do not need to have any folders or files to build Airlfow image. At the same time the versatility and support for multiple ways on how you can build the image (as described in https://airflow.apache.org/docs/docker-stack/build.html is maintained (this was a goal from the very beginning of the PROD Dockerfile but it was not easily achievable - heredocs allow to inline scripts that are used for the build and the pre-commits will make sure that there is one source of truth and nicely editable scripts for both PROD and CI Dockerfile. The last point is really cool, because it allows our users to build custom dockerfiles without checking out the code of Airflow, it is enough to download the latest released Dockerfile and they can easily build the image. Overall - this change will vastly optimize build speed for both PROD and CI images in multiple scenarios.
2022-03-27 19:19:02 +02:00
require_serial: true
- id: check-changelog-has-no-duplicates
name: Check changelogs for duplicate entries
language: python
files: changelog\.(rst|txt)$
entry: ./scripts/ci/pre_commit/changelog_duplicates.py
pass_filenames: true
- id: check-changelog-format
name: Check changelog format
language: python
files: changelog\.(rst|txt)$
entry: ./scripts/ci/pre_commit/check_changelog_format.py
pass_filenames: true
- id: check-newsfragments-are-valid
name: Check newsfragments are valid
language: python
files: newsfragments/.*\.rst$
entry: ./scripts/ci/pre_commit/newsfragments.py
pass_filenames: true
# We sometimes won't have newsfragments in the repo, so always run it so `check-hooks-apply` passes
# This is fast, so not too much downside
always_run: true
- id: check-significant-newsfragments-are-valid
name: Check significant newsfragments are valid
# Significant newsfragments follows a special format so that we can group information easily.
language: python
files: ^airflow-core/newsfragments/.*\.rst$
entry: ./scripts/ci/pre_commit/significant_newsfragments_checker.py
pass_filenames: false
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['docutils>=0.21.2', 'pygments>=2.19.1', 'jinja2>=3.1.5']
# We sometimes won't have newsfragments in the repo, so always run it so `check-hooks-apply` passes
# This is fast, so not too much downside
always_run: true
- id: update-breeze-cmd-output
name: Update breeze docs
description: Update output of breeze commands in Breeze documentation
entry: ./scripts/ci/pre_commit/breeze_cmd_line.py
language: python
Add mechanism to suspend providers (#30422) As agreed in https://lists.apache.org/thread/g8b3k028qhzgw6c3yz4jvmlc67kcr9hj we introduce mechanism to suspend providers from our suite of providers when they are holding us back to older version of dependencies. Provider's suspension is controlled from a single `suspend` flag in `provider.yaml` - this flag is used to generate providers_dependencies.json in generated folders (provider is skipped if it has `suspended` flag set to `true`. This is enough to exclude provider from the extras of airflow and (automatically) from being used when CI image is build and constraints are being generated, as well as from provider documentation/generation. Also several parts of the CI build use the flag to filter out such suspended provider from: * verification of provider.yaml files in pre-commit is skipped in terms of importing and checking if classes are defined and listed in the provider.yaml * the "tests" folders for providers are skipped automatically if the provider has "suspend" = true set * in case of PR that is aimed to modify suspended providers directory tree (when it is not a global provider refactor) selective checks will detect it and fail such PR with appropriate message suggesting to fix the reason for suspention first * documentation build is skipped for suspended providers * mypy static checks will skip suspended provider folders while we will still run ruff checks on them (unlike mypy ruff does not expect the libraries that it imports to be available and we are running ruff in a separate environment where no airflow dependencies are installed anyway
2023-04-04 23:00:08 +02:00
files: >
(?x)
^dev/breeze/.*$|
Add mechanism to suspend providers (#30422) As agreed in https://lists.apache.org/thread/g8b3k028qhzgw6c3yz4jvmlc67kcr9hj we introduce mechanism to suspend providers from our suite of providers when they are holding us back to older version of dependencies. Provider's suspension is controlled from a single `suspend` flag in `provider.yaml` - this flag is used to generate providers_dependencies.json in generated folders (provider is skipped if it has `suspended` flag set to `true`. This is enough to exclude provider from the extras of airflow and (automatically) from being used when CI image is build and constraints are being generated, as well as from provider documentation/generation. Also several parts of the CI build use the flag to filter out such suspended provider from: * verification of provider.yaml files in pre-commit is skipped in terms of importing and checking if classes are defined and listed in the provider.yaml * the "tests" folders for providers are skipped automatically if the provider has "suspend" = true set * in case of PR that is aimed to modify suspended providers directory tree (when it is not a global provider refactor) selective checks will detect it and fail such PR with appropriate message suggesting to fix the reason for suspention first * documentation build is skipped for suspended providers * mypy static checks will skip suspended provider folders while we will still run ruff checks on them (unlike mypy ruff does not expect the libraries that it imports to be available and we are running ruff in a separate environment where no airflow dependencies are installed anyway
2023-04-04 23:00:08 +02:00
^\.pre-commit-config\.yaml$|
^scripts/ci/pre_commit/breeze_cmd_line\.py$|
^generated/provider_dependencies\.json$
require_serial: true
pass_filenames: false
additional_dependencies: ['rich>=12.4.4']
- id: check-example-dags-urls
name: Check that example dags url include provider versions
entry: ./scripts/ci/pre_commit/update_example_dags_paths.py
language: python
pass_filenames: true
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/docs/.*example-dags\.rst$|^docs/.*index\.rst$^airflow-core/docs/.*index\.rst$
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['rich>=12.4.4', 'pyyaml>=6.0.2']
always_run: true
- id: check-system-tests-tocs
name: Check that system tests is properly added
entry: ./scripts/ci/pre_commit/check_system_tests_hidden_in_index.py
language: python
pass_filenames: true
files: ^providers/.*/docs/index\.rst$
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['rich>=12.4.4', 'pyyaml>=6.0.2']
- id: check-lazy-logging
name: Check that all logging methods are lazy
entry: ./scripts/ci/pre_commit/check_lazy_logging.py
language: python
pass_filenames: true
files: \.py$
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['rich>=12.4.4', 'astor>=0.8.1']
- id: create-missing-init-py-files-tests
name: Create missing init.py files in tests
entry: ./scripts/ci/pre_commit/check_init_in_tests.py
language: python
additional_dependencies: ['rich>=12.4.4']
pass_filenames: false
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/tests/.*\.py$
- id: check-tests-unittest-testcase
name: Unit tests do not inherit from unittest.TestCase
description: Check that unit tests do not inherit from unittest.TestCase
entry: ./scripts/ci/pre_commit/unittest_testcase.py
language: python
pass_filenames: true
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/tests/.*\.py$
- id: check-provider-docs-valid
name: Validate provider doc files
entry: ./scripts/ci/pre_commit/check_provider_docs.py
language: python
files: ^providers/.*/provider\.yaml$|^.*/docs/.*
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['rich>=12.4.4', 'pyyaml>=6.0.2', 'jinja2']
require_serial: true
pass_filenames: false
- id: bandit
name: bandit
description: "Bandit is a tool for finding common security issues in Python code"
entry: bandit
language: python
language_version: python3
types: [python]
additional_dependencies: ['bandit==1.7.6']
require_serial: true
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/src/airflow/.*
exclude:
airflow/example_dags/.*
args:
- "--skip"
- "B101,B301,B324,B403,B404,B603"
- "--severity-level"
- "high" # TODO: remove this line when we fix all the issues
- id: pylint
name: pylint
description: "Pylint is a static code analyser for Python 2 or 3."
entry: pylint
language: python
language_version: python3
types: [python]
additional_dependencies: ['pylint==3.1.0']
require_serial: true
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/src/airflow/.*
exclude:
airflow/example_dags/.*
args:
# Use pylint only for the specific check, which are not available into the ruff
- "--disable=all"
# W0133: "Exception statement has no effect"
# see: https://github.com/astral-sh/ruff/issues/10145
- "--enable=W0133"
- id: check-fab-migrations
language: pygrep
name: Check no migration is done on FAB related table
description: >
FAB tables are no longer used in core Airflow but in FAB provider.
As such, it is forbidden to create migrations related to FAB tables in core Airflow.
Such migrations should be in FAB provider. To achieve this, a new capability must be implemented:
support migrations for providers. In other words, providers need to be able to specify migrations
so that, any FAB related migration (besides the legacy ones) is defined in FAB provider.
See https://github.com/apache/airflow/issues/32210
entry: >
(?ix)
\bab_permission\b|
\bab_view_menu\b|
\bab_role\b|
\bab_permission_view\b|
\bab_permission_view_role\b|
\bab_user\b|
\bab_user_role\b|
\bab_register_user\b
pass_filenames: true
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/src/airflow/migrations/versions/.*\.py$
exclude:
^airflow-core/src/airflow/migrations/versions/0028_3_0_0_drop_ab_user_id_foreign_key.py$
- id: go-mockery
name: Generate mocks for go
entry: -w /src/go-sdk vektra/mockery:3
files: ^go-sdk/
exclude: mocks/.*\.go$
types: [go]
pass_filenames: false
language: docker_image
- id: go-mod-tidy
name: Run go mod tidy
entry: bash -c "cd go-sdk && go mod tidy"
files: ^go-sdk/
exclude: mocks/.*\.go$
pass_filenames: false
language: system
- id: gofmt
name: Format go code
entry: golines --base-formatter=gofumpt --write-output --max-len=100 --chain-split-dots
additional_dependencies: [github.com/segmentio/golines@latest, mvdan.cc/gofumpt@v0.8.0]
files: ^go-sdk/
types: [go]
language: golang
- id: gci
name: Consistent import ordering for Go files
# Since this is invoked from the root folder, not go-sdk/, gci can't auto-detect the prefix
entry: gci write --skip-generated -s standard -s default -s "prefix(github.com/apache/airflow)"
additional_dependencies: [github.com/daixiang0/gci@v0.13.6]
files: ^go-sdk/
types: [go]
language: golang
- id: ts-compile-lint-ui
name: Compile / format / lint UI
description: TS types generation / ESLint / Prettier new UI files
language: node
files: |
(?x)
^airflow-core/src/airflow/ui/.*\.(js|ts|tsx|yaml|css|json)$|
^airflow-core/src/airflow/api_fastapi/core_api/openapi/.*\.yaml$|
^airflow-core/src/airflow/api_fastapi/auth/managers/simple/openapi/v1.*\.yaml$
exclude: |
(?x)
^airflow-core/src/airflow/ui/node-modules/.*|
^airflow-core/src/airflow/ui/.pnpm-store
entry: ./scripts/ci/pre_commit/ts_compile_lint_ui.py
additional_dependencies: ['pnpm@9.7.1']
pass_filenames: true
require_serial: true
- id: ts-compile-lint-simple-auth-manager-ui
name: Compile / format / lint simple auth manager UI
description: TS types generation / ESLint / Prettier new UI files
language: node
files: |
(?x)
^airflow-core/src/airflow/api_fastapi/auth/managers/simple/ui/.*\.(js|ts|tsx|yaml|css|json)$|
^airflow-core/src/airflow/api_fastapi/core_api/openapi/.*\.yaml$|
2025-07-24 21:13:27 +09:00
^airflow-core/src/airflow/api_fastapi/auth/managers/simple/openapi/.*\.yaml$
exclude: |
(?x)
^airflow-core/src/airflow/api_fastapi/node-modules/.*|
^airflow-core/src/airflow/api_fastapi/.pnpm-store
entry: ./scripts/ci/pre_commit/ts_compile_lint_simple_auth_manager_ui.py
additional_dependencies: ['pnpm@9.7.1']
pass_filenames: true
require_serial: true
## ADD MOST PRE-COMMITS ABOVE THAT LINE
# The below pre-commits are those requiring CI image to be built
- id: mypy-dev
name: Run mypy for dev
language: python
entry: ./scripts/ci/pre_commit/mypy.py
files: ^dev/.*\.py$|^scripts/.*\.py$
require_serial: true
additional_dependencies: ['rich>=12.4.4']
- id: mypy-dev
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
stages: ['manual']
name: Run mypy for dev (manual)
language: python
entry: ./scripts/ci/pre_commit/mypy_folder.py dev
pass_filenames: false
files: ^.*\.py$
require_serial: true
additional_dependencies: ['rich>=12.4.4']
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
- id: mypy-airflow-core
name: Run mypy for airflow-core
language: python
entry: ./scripts/ci/pre_commit/mypy.py
files: ^airflow-core/.*\.py$
require_serial: true
additional_dependencies: ['rich>=12.4.4']
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
- id: mypy-airflow-core
stages: ['manual']
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
name: Run mypy for airflow-core (manual)
language: python
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
entry: ./scripts/ci/pre_commit/mypy_folder.py airflow-core
pass_filenames: false
files: ^airflow-core/.*\.py$
require_serial: true
additional_dependencies: ['rich>=12.4.4']
- id: mypy-providers
name: Run mypy for providers
language: python
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
entry: ./scripts/ci/pre_commit/mypy.py
files: ^providers/.*\.py$
require_serial: true
additional_dependencies: ['rich>=12.4.4']
- id: mypy-providers
stages: ['manual']
name: Run mypy for providers (manual)
language: python
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
entry: ./scripts/ci/pre_commit/mypy_folder.py providers
pass_filenames: false
files: ^.*\.py$
require_serial: true
additional_dependencies: ['rich>=12.4.4']
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
- id: mypy-task-sdk
name: Run mypy for task-sdk
language: python
entry: ./scripts/ci/pre_commit/mypy.py
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
files: ^task-sdk/.*\.py$
require_serial: true
additional_dependencies: ['rich>=12.4.4']
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
- id: mypy-task-sdk
Run mypy checks for full packages in CI (#36638) MyPy as used in our static checks has slightly different heuristics when running on on individual files and whole packages. This sometimes causes semi-random failures when different set of files is produced when pre-commits split the files between parallel processes. The regular `mypy-*` pre-commits work by passing filenames to mypy checks, and when `--all-files` flag is passed to mypy, this means that 2700 files are passed. In this case pre-commit will split such long list of files to several sequential muypy executions. This is not very good because depending on the list of files passed, mypy can split the list diferently and results will be different when just list of files changes - so mypy might start detecting problems that were not present before. This PR introduces new `mypy` check that runs mypy for packages rather than individual files. We cannot run them for local pre-commit runs, because in many cases, such package based mypy check will run for minutes when a single file changes, due to cache invalidation rules - and we do not want to penalise commits that are changing common airflow code (because such PRs would invalidate a lot of mypy cache every time such common file changes). So we still want to run file-based mypy for local commits. But we do not want to pass 2700 files in CI, rather than that on CI we want to run mypy checks "per package". This PR introduces a new "manual" stage mypy pre-commit check that will run "package" based mypy checks and adds selective check rules that will decide properly when to run such tests and separate, matrix-based CI job that will run such mypy checks - separately for each of the packages: "airflow", "providers", "docs", "dev". Also this job will skip providers checks in non-main branch and will run all tests when "full tests needed" are requested. This PR ignores some errors resulted from 3rd-party libraries used that are randomply appearing when some files are modified (and fixes the current main failures)
2024-01-07 13:53:23 +01:00
stages: ['manual']
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
name: Run mypy for task-sdk (manual)
Run mypy checks for full packages in CI (#36638) MyPy as used in our static checks has slightly different heuristics when running on on individual files and whole packages. This sometimes causes semi-random failures when different set of files is produced when pre-commits split the files between parallel processes. The regular `mypy-*` pre-commits work by passing filenames to mypy checks, and when `--all-files` flag is passed to mypy, this means that 2700 files are passed. In this case pre-commit will split such long list of files to several sequential muypy executions. This is not very good because depending on the list of files passed, mypy can split the list diferently and results will be different when just list of files changes - so mypy might start detecting problems that were not present before. This PR introduces new `mypy` check that runs mypy for packages rather than individual files. We cannot run them for local pre-commit runs, because in many cases, such package based mypy check will run for minutes when a single file changes, due to cache invalidation rules - and we do not want to penalise commits that are changing common airflow code (because such PRs would invalidate a lot of mypy cache every time such common file changes). So we still want to run file-based mypy for local commits. But we do not want to pass 2700 files in CI, rather than that on CI we want to run mypy checks "per package". This PR introduces a new "manual" stage mypy pre-commit check that will run "package" based mypy checks and adds selective check rules that will decide properly when to run such tests and separate, matrix-based CI job that will run such mypy checks - separately for each of the packages: "airflow", "providers", "docs", "dev". Also this job will skip providers checks in non-main branch and will run all tests when "full tests needed" are requested. This PR ignores some errors resulted from 3rd-party libraries used that are randomply appearing when some files are modified (and fixes the current main failures)
2024-01-07 13:53:23 +01:00
language: python
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
entry: ./scripts/ci/pre_commit/mypy_folder.py task-sdk
Run mypy checks for full packages in CI (#36638) MyPy as used in our static checks has slightly different heuristics when running on on individual files and whole packages. This sometimes causes semi-random failures when different set of files is produced when pre-commits split the files between parallel processes. The regular `mypy-*` pre-commits work by passing filenames to mypy checks, and when `--all-files` flag is passed to mypy, this means that 2700 files are passed. In this case pre-commit will split such long list of files to several sequential muypy executions. This is not very good because depending on the list of files passed, mypy can split the list diferently and results will be different when just list of files changes - so mypy might start detecting problems that were not present before. This PR introduces new `mypy` check that runs mypy for packages rather than individual files. We cannot run them for local pre-commit runs, because in many cases, such package based mypy check will run for minutes when a single file changes, due to cache invalidation rules - and we do not want to penalise commits that are changing common airflow code (because such PRs would invalidate a lot of mypy cache every time such common file changes). So we still want to run file-based mypy for local commits. But we do not want to pass 2700 files in CI, rather than that on CI we want to run mypy checks "per package". This PR introduces a new "manual" stage mypy pre-commit check that will run "package" based mypy checks and adds selective check rules that will decide properly when to run such tests and separate, matrix-based CI job that will run such mypy checks - separately for each of the packages: "airflow", "providers", "docs", "dev". Also this job will skip providers checks in non-main branch and will run all tests when "full tests needed" are requested. This PR ignores some errors resulted from 3rd-party libraries used that are randomply appearing when some files are modified (and fixes the current main failures)
2024-01-07 13:53:23 +01:00
pass_filenames: false
files: ^.*\.py$
require_serial: true
additional_dependencies: ['rich>=12.4.4']
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
- id: mypy-devel-common
name: Run mypy for devel-common
language: python
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
entry: ./scripts/ci/pre_commit/mypy.py
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
files: ^devel-common/.*\.py$
require_serial: true
additional_dependencies: ['rich>=12.4.4']
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
- id: mypy-devel-common
stages: ['manual']
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
name: Run mypy for devel-common (manual)
language: python
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
entry: ./scripts/ci/pre_commit/mypy_folder.py devel-common
pass_filenames: false
files: ^.*\.py$
require_serial: true
additional_dependencies: ['rich>=12.4.4']
AIP-81 airflowctl Include CI/breeze unit-testing and distribution commands (#48099) * Include unit-testing into CI and breeze, add distribution pieces * Merge task-sdk and airflow-ctl test workflow and can be extended for each non-core distro, update release management doc packages to distributions * Remove no needed comment * Remove duplicate ISSUE_MATCH_IN_BODY definition, unify non-core release logic and include airflowctl release method in release_management_commands.py, create DistributionPackageBuildType for identifying dist name * Update dev/breeze/doc/05_test_commands.rst Co-authored-by: LIU ZHE YOU <68415893+jason810496@users.noreply.github.com> * Fix dash problem * Remove not used vars from ci.yml * Update breeze selective check tests * Update breeze selective check tests, fix typo in release_management_commands.py, fix pre-commit naming in mypy, fix dist naming * Fix pre-commit hook, fix dist path for release_management_commands.py, fix breeze test * add airflowctl to mypy_folder.py, include __init__.py to airflowctl, include into missing scripts for installation and release, pre-commit adjustment, files are moved to src/airflow/ctl structure to fit into generic structure, include airflow-ctl into .dockerignore, * Remove uv workspaces for now which preventing ci image to be built * Fix airflow-ctl workspace and include devel-common again along with pytest_plugins to make breeze testing work * Revert provider yaml workspace changes * Remove bespoke handle of provider.toml and remove airflow-ctl from provider.toml template * Move back distribution name to airflowctl, update CI logic to more dynamic via inputs for non-core distributions * Fix path in mypy, remove not needed __init__.py and duplicate conftest in tests * Remove airflow-ctl from providers test --------- Co-authored-by: LIU ZHE YOU <68415893+jason810496@users.noreply.github.com>
2025-03-31 10:54:10 +02:00
- id: mypy-airflow-ctl
name: Run mypy for airflow-ctl
language: python
entry: ./scripts/ci/pre_commit/mypy.py
files: ^airflow-ctl/src/airflowctl/.*\.py$|^airflow-ctl/tests/.*\.py$
exclude: .*generated.py
require_serial: true
additional_dependencies: ['rich>=12.4.4']
AIP-81 airflowctl Include CI/breeze unit-testing and distribution commands (#48099) * Include unit-testing into CI and breeze, add distribution pieces * Merge task-sdk and airflow-ctl test workflow and can be extended for each non-core distro, update release management doc packages to distributions * Remove no needed comment * Remove duplicate ISSUE_MATCH_IN_BODY definition, unify non-core release logic and include airflowctl release method in release_management_commands.py, create DistributionPackageBuildType for identifying dist name * Update dev/breeze/doc/05_test_commands.rst Co-authored-by: LIU ZHE YOU <68415893+jason810496@users.noreply.github.com> * Fix dash problem * Remove not used vars from ci.yml * Update breeze selective check tests * Update breeze selective check tests, fix typo in release_management_commands.py, fix pre-commit naming in mypy, fix dist naming * Fix pre-commit hook, fix dist path for release_management_commands.py, fix breeze test * add airflowctl to mypy_folder.py, include __init__.py to airflowctl, include into missing scripts for installation and release, pre-commit adjustment, files are moved to src/airflow/ctl structure to fit into generic structure, include airflow-ctl into .dockerignore, * Remove uv workspaces for now which preventing ci image to be built * Fix airflow-ctl workspace and include devel-common again along with pytest_plugins to make breeze testing work * Revert provider yaml workspace changes * Remove bespoke handle of provider.toml and remove airflow-ctl from provider.toml template * Move back distribution name to airflowctl, update CI logic to more dynamic via inputs for non-core distributions * Fix path in mypy, remove not needed __init__.py and duplicate conftest in tests * Remove airflow-ctl from providers test --------- Co-authored-by: LIU ZHE YOU <68415893+jason810496@users.noreply.github.com>
2025-03-31 10:54:10 +02:00
- id: mypy-airflow-ctl
stages: ['manual']
AIP-81 airflowctl Include CI/breeze unit-testing and distribution commands (#48099) * Include unit-testing into CI and breeze, add distribution pieces * Merge task-sdk and airflow-ctl test workflow and can be extended for each non-core distro, update release management doc packages to distributions * Remove no needed comment * Remove duplicate ISSUE_MATCH_IN_BODY definition, unify non-core release logic and include airflowctl release method in release_management_commands.py, create DistributionPackageBuildType for identifying dist name * Update dev/breeze/doc/05_test_commands.rst Co-authored-by: LIU ZHE YOU <68415893+jason810496@users.noreply.github.com> * Fix dash problem * Remove not used vars from ci.yml * Update breeze selective check tests * Update breeze selective check tests, fix typo in release_management_commands.py, fix pre-commit naming in mypy, fix dist naming * Fix pre-commit hook, fix dist path for release_management_commands.py, fix breeze test * add airflowctl to mypy_folder.py, include __init__.py to airflowctl, include into missing scripts for installation and release, pre-commit adjustment, files are moved to src/airflow/ctl structure to fit into generic structure, include airflow-ctl into .dockerignore, * Remove uv workspaces for now which preventing ci image to be built * Fix airflow-ctl workspace and include devel-common again along with pytest_plugins to make breeze testing work * Revert provider yaml workspace changes * Remove bespoke handle of provider.toml and remove airflow-ctl from provider.toml template * Move back distribution name to airflowctl, update CI logic to more dynamic via inputs for non-core distributions * Fix path in mypy, remove not needed __init__.py and duplicate conftest in tests * Remove airflow-ctl from providers test --------- Co-authored-by: LIU ZHE YOU <68415893+jason810496@users.noreply.github.com>
2025-03-31 10:54:10 +02:00
name: Run mypy for airflow-ctl (manual)
language: python
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
entry: ./scripts/ci/pre_commit/mypy_folder.py airflow-ctl
pass_filenames: false
files: ^.*\.py$
require_serial: true
additional_dependencies: ['rich>=12.4.4']
- id: generate-openapi-spec
name: Generate the FastAPI API spec
language: python
entry: ./scripts/ci/pre_commit/generate_openapi_spec.py
pass_filenames: false
files: ^airflow-core/src/airflow/api_fastapi/.*\.py$|^airflow-core/src/airflow/api_fastapi/auth/managers/simple/.*\.py$|^providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/.*\.py$
exclude: ^airflow-core/src/airflow/api_fastapi/execution_api/.*
additional_dependencies: ['rich>=12.4.4', 'openapi-spec-validator>=0.7.1']
- id: generate-openapi-spec-fab
name: Generate the FastAPI API spec for FAB
language: python
entry: ./scripts/ci/pre_commit/generate_openapi_spec_fab.py
pass_filenames: false
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/src/airflow/api_fastapi/.*\.py$|^airflow-core/src/airflow/api_fastapi/auth/managers/simple/.*\.py$|^providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/.*\.py$
exclude: ^airflow-core/src/airflow/api_fastapi/execution_api/.*
additional_dependencies: ['rich>=12.4.4', 'openapi-spec-validator>=0.7.1']
- id: check-i18n-json
name: Check i18n files validity
description: Check i18n files are valid json, have no TODOs, and auto-format them
language: python
files: ^airflow-core/src/airflow/ui/public/i18n/locales/.*\.json$
entry: ./scripts/ci/pre_commit/check_i18n_json.py
additional_dependencies: ['rich>=12.4.4']
pass_filenames: false
- id: check-provider-yaml-valid
name: Validate provider.yaml files
entry: ./scripts/ci/pre_commit/check_provider_yaml_files.py
language: python
files: ^providers/.*/provider\.yaml$
exclude: ^providers/.*/.venv/.*$
additional_dependencies: ['rich>=12.4.4']
require_serial: true
- id: check-template-fields-valid
name: Check templated fields mapped in operators/sensors
language: python
entry: ./scripts/ci/pre_commit/check_template_fields.py
files: ^(providers/.*/)?airflow-core/.*/(sensors|operators)/.*\.py$
Simplify tooling by switching completely to uv (#48223) The lazy consensus decision has been made at the devlist to switch entirely to `uv` as development tool: link: https://lists.apache.org/thread/6xxdon9lmjx3xh8zw09xc5k9jxb2n256 This PR implements that decision and removes a lot of baggage connected to using `pip` additionally to uv to install and sync the environment. It also introduces more consistency in the way how distribution packages are used in airflow sources - basicaly switching all internal distributions to use `pyproject.toml` approach and linking them all together via `uv`'s workspace feature. This enables much more streamlined development workflows, where any part of airflow development is manageable using `uv sync` in the right distribution - opening the way to moving more of the "sub-worfklows" from the CI image to local virtualenv environment. Unfortunately, such change cannot be done incrementally, really, because any change in the project layout drags with itself a lot of changes in the test/CI/management scripts, so we have to implement one big PR covering the move. This PR is "safe" in terms of the airflow and provider's code - it does not **really** (except occasional imports and type hint changes resulting from better isolation of packages) change Airflow code nor it should not affect any airflow or provider code, because it does not move any of the folder where airflow or provider's code is modified. It does move the test code - in a number of "auxiliary" distributions we have. It also moves the `docs` generation code to `devel-common` and introduces separate conf.py files for every doc package. What is still NOT done after that move and will be covered in the follow-up changes: * isolating docs-building to have separate configuraiton for docs building per distribution - allowing to run doc build locally with it's own conf.py file * moving some of the tests and checks out from breeze container image up to the local environment (for example mypy checks) and likely isolating them per-provider * Constraints are still generated using `pip freeze` and automatically managed by our custom scripts in `canary` builds - this will be replaced later by switching to `uv.lock` mechanism. * potentially, we could merge `devel-common` and `dev` - to be considered as a follow-up. * PROD image is stil build with `pip` by default when using `PyPI` or distribution packages - but we do not support building the source image with `pip` - when building from sources, uv is forced internally to install packages. Currently we have no plans to change default PROD building to use `uv`. This is the detailed list of changes implemented in this PR: * uv is now mandatory to install as pre-requisite in order to develop airflow. We do not support installing airflow for development with `pip` - there will be a lot of cases where it will not work for development - including development dependencies and installing several distributions together. * removed meta-package `hatch_build.py' and replacing it with pre-commit automatically modifying declarative pyproject.toml * stripped down `hatch_build_airflow_core.py` to only cover custom git and asset build hooks (and renaming the file to `hatch_build.py` and moving all airflow dependencies to `pyproject.toml` * converted "loose" packages in airflow repo into distributions: * docker-tests * kubernetes-tests * helm-tests * dev (here we do not have `src` subfolder - sources are directly in the distribution, which is for-now inconsistent with other distributions). The names of the `_tests` distribution folders have been renamed to the `-tests` convention to make sure the imports are always referring to base of each distribution and are not used from the content root. * Each eof the distributions (on top of already existing airflow-core, task-sdk, devel-common and 90+providers has it's own set of dependencies, and the top-level meta-package workspace root brings those distributions together allowing to install them all tegether with a simple `uv sync --all-packages` command and come up with consistent set of dependencies that are good for all those packages (yay!). This is used to build CI image with single common environment to run the tests (with some quirks due to constraints use where we have to manually list all distributions until we switch to `uv.lock` mechanism) * `doc` code is moved to `devel-common` distribution. The `doc` folder only keeps README informing where the other doc code is, the spelling_wordlist.txt and start_docs_server.sh. The documentation is generated in `generated/generated-docs/` folder which is entirely .gitignored. * the documentation is now fully moved to: * `airflow-core/docs` - documentation for Airflow Core * `providers/**/docs` - documentation for Providers * `chart/docs` - documentation for Helm Chart * `task-sdk/docs` - documentation for Task SDK (new format not yet published) * `docker-stack-docs` - documentation for Docker Stack' * `providers-summary-docs` - documentation for provider summary page * `versions` are not dynamically retrieved from `__init__.py` all of them are synchronized directly to pyproject.toml files - this way - except the custom build hook - we have no dynamic components in our `pyproject.toml` properties. * references to extras were removed from INSTALL and other places, the only references to extras remains in the user documentation - we stop using extras for local development, we switch to using dependency groups. * backtracking command was removed from breeze - we did not need it since we started using `uv` * internal commands (except constraint generation) have been moved to `uv` from `pip` * breeze requires `uv` to be installed and expects to be installed by `uv tool install -e ./dev/breeze` * pyproject.tomls are dynamically modified when we add a version suffix dynamically (`--version-suffix-for-pypi`) - only for the time of building the versions with updated suffix * `mypy` checks are now consistently used across all the different distributions and for consistency (and to fix some of the issues with namespace packages) rather than using "folder" approach when running mypy checks, even if we run mypy for whole distribution, we run check on individual files rather than on a folder. That adds consistency in execution of mypy heursistics. Rather than using in-container mypy script all the logic of selection and parameters passed to mypy are in pre-commit code. For now we are still using CI image to run mypy because mypy is very sensitive to version of dependencies installed, we should be able to switch to running mypy locally once we have the `uv.lock` mechanism incorporated in our workflows. * lower bounds for dependencies have been set consistently across all the distributions. With `uv sync` and dependabot, those should be generally kept consistently for the future * the `devel-common` dependencies have been groupped together in `devel-common` extras - including `basic`, `doc`, `doc-gen`, and `all` which will make it easier to install them for some OS-es (basic is used as default set of dependencies to cover most common set of development dependencies to be used for development) * generated/provider_dependencies.json are not committed to the repository any longer. They are .gitignored and geberated on-the-flight as needed (breeze will generate them automatically when empty and pre-commit will always regenerate them to be consistent with provider's pyproject.toml files. * `chart-utils` have been noved to `helm-tests` from `devel-common` as they were only used there. * for k8s tests we are using the `uv` main `.venv` environment rather than creating our own `.build` environment and we use `uv sync` to keep it in sync * Updated `uv` version to 0.6.10 * We are using `uv sync` to perform "upgrade to newer depencies" in `canary` builds and locally * leveldb has been turned into "dependency group" and removed from apache-airflow and apache-airflow-core extras, it is now only available by google provider's leveldb optional extra to install with `pip`
2025-04-02 13:11:13 +02:00
additional_dependencies: ['rich>=12.4.4']
require_serial: true
- id: update-migration-references
name: Update migration ref doc
language: python
entry: ./scripts/ci/pre_commit/migration_reference.py
pass_filenames: false
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/src/airflow/migrations/versions/.*\.py$|^airflow-core/docs/migrations-ref\.rst$
additional_dependencies: ['rich>=12.4.4']
- id: generate-tasksdk-datamodels
name: Generate Datamodels for TaskSDK client
language: python
entry: uv run -p 3.12 --no-dev --no-progress --active --group codegen --project apache-airflow-task-sdk --directory task-sdk -s dev/generate_task_sdk_models.py
pass_filenames: false
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/src/airflow/api_fastapi/execution_api/.*\.py$
require_serial: true
- id: generate-airflowctl-datamodels
name: Generate Datamodels for AirflowCTL
language: python
entry: >
bash -c '
uv run -p 3.12 --no-dev --no-progress --active --group codegen --project apache-airflow-ctl --directory airflow-ctl/ datamodel-codegen &&
uv run -p 3.12 --no-dev --no-progress --active --group codegen --project apache-airflow-ctl --directory airflow-ctl/ datamodel-codegen --input="../airflow-core/src/airflow/api_fastapi/auth/managers/simple/openapi/v2-simple-auth-manager-generated.yaml" --output="src/airflowctl/api/datamodels/auth_generated.py"'
pass_filenames: false
files: ^airflow-core/src/airflow/api_fastapi/core_api/datamodels/.*\.py$|^airflow-core/src/airflow/api_fastapi/auth/managers/simple/(datamodels|routes|services|openapi)/.*\.py$
require_serial: true
- id: update-er-diagram
name: Update ER diagram
language: python
entry: ./scripts/ci/pre_commit/update_er_diagram.py
pass_filenames: false
Move airflow sources to airflow-core package (#47798) This is continuation of the separation of the Airflow codebase into separate distributions. This one splits airflow into two of them: * apache-airflow - becomes an empty, meta no-code distribution that only has dependencies to apache-airflow-core and task-sdk distributions and it has preinstalled provider distributions added in standard "wheel" distribution. All "extras" lead either to "apache-airflow-core" extras or to providers - the dependencies and optional dependencies are calculated differently depending on "editable" or "standard" mode - in editable mode, just provider dependencies are installed for preinstalled providers in standard mode - those preinstalled providers are dependencies. * the apache-airflow-core distribution contains all airflow core sources (previously in apache-airflow) and it has no provider extras. Thanks to that apache-airflow distribution does not have any dynamically calculated dependencies. * the apache-airflow-core distribution hs "hatch_build_airflow_core.py" build hooks that add custom build target and implement custom cleanup in order to implement compiling assets as part of the build. * During the move, the following changes were applied for consistency: * packages when used in context of distribution packages have been renamed to "distributions" - including all documentations and commands in breeze to void confusion with import packages (see https://packaging.python.org/en/latest/discussions/distribution-package-vs-import-package/) * all tests in `airflow-core` follow now the same convention where tests are in `unit`, `system` and `integration` package. no extra package has been as second level, because all the provider tests have "<PROVIDER>" there, so we just have to avoid naming airflow unit."<PROVIDER>" with the same name as provider. * all tooling in CI/DEV have been updated to follow the new structure. We should always build to packages now when we are building them using `breeze`.
2025-03-21 14:25:26 +01:00
files: ^airflow-core/src/airflow/migrations/versions/.*\.py$|^airflow-core/docs/migrations-ref\.rst$
Add common code and utils to implement ER pre-commit in a clearer way (#35875) * Add common code and utils to implement ER pre-commit in a clearer way Extracts comon initialization code for pre-commits that allows to use a simpler way of running pre-commits with breeze ci image. Rather than running a custom `docker` command, we are using the `breeze shell` command to run the command inside the image. We are also fixing a problem where the ER diagram was generated using random backend - we force it now to use Postgres as backend. There are few small problems solved as part of it as well: * We are also switching the console used to be the standard colored one so that the output will use colors also in git hook and CI. * When image needs update we are going to warn about it in the builds that are "serial" (i.e. do not run in parallell) that the image should be upgraded. We are not doing it for checks that use parallelism because it would pollute the output too much (and those are usually not run with images anyway). * There was an error where pre-commit run with breeze would also start port-forwarding if database was started together with it, so pre-commit project no longer adds port forwarding for backends. * If there was a database stated as part of pre-commit project, it would continue running after pre-commit completed, which is undesireable. The pre-commit will now stop pre-commit project after completion. * Update dev/breeze/src/airflow_breeze/utils/md5_build_check.py Co-authored-by: Pankaj Koti <pankajkoti699@gmail.com> --------- Co-authored-by: Pankaj Koti <pankajkoti699@gmail.com>
2023-11-27 03:37:28 +01:00
additional_dependencies: ['rich>=12.4.4']
- id: check-default-configuration
name: Check the default configuration
entry: ./scripts/ci/pre_commit/check_default_configuration.py
language: python
additional_dependencies: ['rich>=12.4.4']
require_serial: true
pass_filenames: false
files: ^airflow-core/src/airflow/config_templates/config\.yml$
- id: generate-airflowctl-help-images
name: Generate SVG from Airflow CTL Commands
entry: ./scripts/ci/pre_commit/capture_airflowctl_help.py
language: python
pass_filenames: false
files:
^airflow-ctl/src/airflowctl/api/operations.py|airflow-ctl/src/airflowctl/ctl/commands/.*\.py$
additional_dependencies: ['rich>=12.4.4', 'argcomplete>=1.10']
- id: check-imports-in-providers
name: Check imports in providers
entry: ./scripts/ci/pre_commit/check_imports_in_providers.py
language: python
additional_dependencies: ['rich>=12.4.4', 'ruff==0.12.3']
files: ^providers/.*/src/airflow/providers/.*version_compat.*\.py$
require_serial: true
- id: provider-version-compat
name: Check for correct version_compat imports in providers
entry: ./scripts/ci/pre_commit/check_provider_version_compat.py
language: python
types: [python]
files: ^providers/.*/src/airflow/providers/.*\.py$
require_serial: true
- id: check-sdk-imports
name: Check for SDK imports in core files
entry: ./scripts/ci/pre_commit/check_sdk_imports.py
language: python
types: [python]
files: ^airflow-core/src/airflow/
exclude: |
(?x)
# Allow SDK imports in these legitimate locations
^airflow-core/src/airflow/example_dags/.*\.py$|
# TODO: These files need to be refactored to remove SDK coupling
^airflow-core/src/airflow/__init__\.py$|
^airflow-core/src/airflow/models/__init__\.py$|
^airflow-core/src/airflow/api/common/mark_tasks\.py$|
^airflow-core/src/airflow/api_fastapi/core_api/datamodels/assets\.py$|
^airflow-core/src/airflow/api_fastapi/core_api/datamodels/hitl\.py$|
^airflow-core/src/airflow/api_fastapi/core_api/datamodels/variables\.py$|
^airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid\.py$|
^airflow-core/src/airflow/api_fastapi/core_api/routes/ui/structure\.py$|
^airflow-core/src/airflow/api_fastapi/core_api/services/ui/connections\.py$|
^airflow-core/src/airflow/api_fastapi/core_api/services/ui/grid\.py$|
^airflow-core/src/airflow/api_fastapi/execution_api/routes/hitl\.py$|
^airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances\.py$|
^airflow-core/src/airflow/api_fastapi/logging/decorators\.py$|
^airflow-core/src/airflow/assets/evaluation\.py$|
^airflow-core/src/airflow/assets/manager\.py$|
^airflow-core/src/airflow/cli/commands/connection_command\.py$|
^airflow-core/src/airflow/cli/commands/task_command\.py$|
^airflow-core/src/airflow/configuration\.py$|
^airflow-core/src/airflow/dag_processing/collection\.py$|
^airflow-core/src/airflow/dag_processing/manager\.py$|
^airflow-core/src/airflow/dag_processing/processor\.py$|
^airflow-core/src/airflow/datasets/metadata\.py$|
^airflow-core/src/airflow/exceptions\.py$|
^airflow-core/src/airflow/executors/local_executor\.py$|
^airflow-core/src/airflow/jobs/triggerer_job_runner\.py$|
^airflow-core/src/airflow/lineage/hook\.py$|
^airflow-core/src/airflow/listeners/spec/asset\.py$|
^airflow-core/src/airflow/listeners/spec/taskinstance\.py$|
^airflow-core/src/airflow/logging/remote\.py$|
^airflow-core/src/airflow/models/asset\.py$|
^airflow-core/src/airflow/models/baseoperator\.py$|
^airflow-core/src/airflow/models/connection\.py$|
^airflow-core/src/airflow/models/dag\.py$|
^airflow-core/src/airflow/models/dagbag\.py$|
^airflow-core/src/airflow/models/dagrun\.py$|
^airflow-core/src/airflow/models/mappedoperator\.py$|
^airflow-core/src/airflow/models/operator\.py$|
^airflow-core/src/airflow/models/param\.py$|
^airflow-core/src/airflow/models/serialized_dag\.py$|
^airflow-core/src/airflow/models/taskinstance\.py$|
^airflow-core/src/airflow/models/taskinstancekey\.py$|
^airflow-core/src/airflow/models/taskmap\.py$|
^airflow-core/src/airflow/models/taskreschedule\.py$|
^airflow-core/src/airflow/models/variable\.py$|
^airflow-core/src/airflow/operators/subdag\.py$|
^airflow-core/src/airflow/serialization/dag\.py$|
^airflow-core/src/airflow/serialization/enums\.py$|
^airflow-core/src/airflow/serialization/serialized_objects\.py$|
^airflow-core/src/airflow/task/task_runner/bash_task_runner\.py$|
^airflow-core/src/airflow/task/task_runner/standard_task_runner\.py$|
^airflow-core/src/airflow/utils/dag_cycle_tester\.py$|
^airflow-core/src/airflow/utils/dag_parsing_context\.py$|
^airflow-core/src/airflow/utils/decorators\.py$|
^airflow-core/src/airflow/utils/operator_helpers\.py$|
^airflow-core/src/airflow/utils/session\.py$|
^airflow-core/src/airflow/utils/task_group\.py$|
^airflow-core/src/airflow/utils/trigger_rule\.py$|
^airflow-core/src/airflow/utils/xcom\.py$|
^airflow-core/src/airflow/providers_manager\.py$|
^airflow-core/src/airflow/timetables/assets\.py$|
^airflow-core/src/airflow/ti_deps/deps/prev_dagrun_dep\.py$|
^airflow-core/src/airflow/utils/context\.py$|
^airflow-core/src/airflow/models/taskmixin\.py$|
^airflow-core/src/airflow/utils/edgemodifier\.py$|
^airflow-core/src/airflow/utils/email\.py$|
^airflow-core/src/airflow/ti_deps/deps/trigger_rule_dep\.py$|
^airflow-core/src/airflow/utils/helpers\.py$|
^airflow-core/src/airflow/ti_deps/deps/mapped_task_upstream_dep\.py$|
^airflow-core/src/airflow/utils/types\.py$|
^airflow-core/src/airflow/utils/dag_edges\.py$|
^airflow-core/src/airflow/utils/cli\.py$|
^airflow-core/src/airflow/timetables/base\.py$|
^airflow-core/src/airflow/utils/dot_renderer\.py$|
^airflow-core/src/airflow/models/xcom_arg\.py$|
^airflow-core/src/airflow/plugins_manager\.py$|
^airflow-core/src/airflow/models/xcom\.py$|
^airflow-core/src/airflow/timetables/simple\.py$|
^airflow-core/src/airflow/settings\.py$|
^airflow-core/src/airflow/models/renderedtifields\.py$|
^airflow-core/src/airflow/serialization/helpers\.py$|
^airflow-core/src/airflow/models/expandinput\.py$
additional_dependencies: ['rich>=12.4.4']
## ONLY ADD PRE-COMMITS HERE THAT REQUIRE CI IMAGE