| # 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. |
| [tool.black] |
| line-length = 110 |
| target-version = ['py37', 'py38', 'py39', 'py310'] |
| # The build system section is needed in order to workaround the side-effect introduced by recent |
| # setup tools version. The recent setuptools version update (64.0.0) broke paths of editable installations |
| # and we have to pin it to 63.4.3 version |
| # The problem is tracked (and this limitation might be removed if it is solved) in: |
| # https://github.com/pypa/setuptools/issues/3548 |
| [build-system] |
| requires = ['setuptools==67.2.0'] |
| build-backend = "setuptools.build_meta" |
| |
| [tool.ruff] |
| typing-modules = ["airflow.typing_compat"] |
| line-length = 110 |
| extend-exclude = [ |
| ".eggs", |
| "airflow/_vendor/*", |
| "airflow/providers/google/ads/_vendor/*", |
| # The files generated by stubgen aren't 100% valid syntax it turns out, and we don't ship them, so we can |
| # ignore them in ruff |
| "airflow/providers/common/sql/*/*.pyi" |
| ] |
| |
| # TODO: Bump to Python 3.8 when support for Python 3.7 is dropped in Airflow. |
| target-version = "py37" |
| |
| extend-select = [ |
| "I", # Missing required import (auto-fixable) |
| "UP", # Pyupgrade |
| "RUF100", # Unused noqa (auto-fixable) |
| |
| # implicit single-line string concatenation |
| "ISC001", |
| # We ignore more pydocstyle than we enable, so be more selective at what we enable |
| "D101", |
| "D106", |
| "D2", |
| "D3", |
| # "D400", WIP: see #31135 |
| # "D401", # Not enabled by ruff, but we don't want it |
| "D402", |
| "D403", |
| "D412", |
| "D419" |
| ] |
| extend-ignore = [ |
| "D203", |
| "D205", |
| "D212", |
| "D213", |
| "D214", |
| "D215", |
| "E731", |
| ] |
| |
| [tool.pytest.ini_options] |
| # * Disable `flaky` plugin for pytest. This plugin conflicts with `rerunfailures` because provide same marker. |
| # * Disable `nose` builtin plugin for pytest. This feature deprecated in 7.2 and will be removed in pytest>=8 |
| # * And we focus on use native pytest capabilities rather than adopt another frameworks. |
| addopts = "-rasl --verbosity=2 -p no:flaky -p no:nose --asyncio-mode=strict" |
| norecursedirs = [ |
| ".eggs", |
| "airflow", |
| "tests/dags_with_system_exit", |
| "tests/test_utils", |
| "tests/dags_corrupted", |
| "tests/dags", |
| "tests/system/providers/google/cloud/dataproc/resources", |
| "tests/system/providers/google/cloud/gcs/resources", |
| ] |
| log_level = "INFO" |
| filterwarnings = [ |
| "error::pytest.PytestCollectionWarning", |
| "ignore::DeprecationWarning:flask_appbuilder.filemanager", |
| "ignore::DeprecationWarning:flask_appbuilder.widgets", |
| # https://github.com/dpgaspar/Flask-AppBuilder/pull/1940 |
| "ignore::DeprecationWarning:flask_sqlalchemy", |
| # https://github.com/dpgaspar/Flask-AppBuilder/pull/1903 |
| "ignore::DeprecationWarning:apispec.utils", |
| ] |
| python_files = [ |
| "*.py", |
| ] |
| testpaths = [ |
| "tests", |
| ] |
| |
| [tool.ruff.isort] |
| known-first-party = ["airflow", "airflow_breeze", "docker_tests", "docs", "kubernetes_tests", "tests"] |
| required-imports = ["from __future__ import annotations"] |
| combine-as-imports = true |
| |
| # TODO: for now, https://github.com/charliermarsh/ruff/issues/1817 |
| known-third-party = [ |
| "asana", |
| "atlassian", |
| "celery", |
| "cloudant", |
| "databricks", |
| "datadog", |
| "docker", |
| "elasticsearch", |
| "github", |
| "google", |
| "grpc", |
| "jenkins", |
| "mysql", |
| "neo4j", |
| "papermill", |
| "redis", |
| "sendgrid", |
| "snowflake", |
| "telegram", |
| "trino", |
| ] |
| |
| [tool.ruff.per-file-ignores] |
| "airflow/models/__init__.py" = ["F401"] |
| "airflow/models/sqla_models.py" = ["F401"] |
| |
| |
| # The test_python.py is needed because adding __future__.annotations breaks runtime checks that are |
| # needed for the test to work |
| "tests/decorators/test_python.py" = ["I002"] |
| |
| # The Pydantic representations of SqlAlchemy Models are not parsed well with Pydantic |
| # when __future__.annotations is used so we need to skip them from upgrading |
| "airflow/serialization/pydantic/*.py" = ["I002"] |
| |
| # Ignore pydoc style from these |
| "*.pyi" = ["D"] |
| "tests/*" = ["D"] |
| "scripts/*" = ["D"] |
| "dev/*" = ["D"] |
| "docs/*" = ["D"] |
| "provider_packages/*" = ["D"] |
| "docker_tests/*" = ["D"] |
| "kubernetes_tests/*" = ["D"] |
| "*/example_dags/*" = ["D"] |
| "chart/*" = ["D"] |
| |
| # All of the modules which have an extra license header (i.e. that we copy from another project) need to |
| # ignore E402 -- module level import not at top level |
| "airflow/api/auth/backend/kerberos_auth.py" = ["E402"] |
| "airflow/security/kerberos.py" = ["E402"] |
| "airflow/security/utils.py" = ["E402"] |
| "tests/providers/elasticsearch/log/elasticmock/__init__.py" = ["E402"] |
| "tests/providers/elasticsearch/log/elasticmock/utilities/__init__.py" = ["E402"] |