forked from apache/airflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
185 lines (168 loc) · 6.38 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# 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 = ['py38', 'py39', 'py310', 'py311']
# Editable installs are currently broken using setuptools 64.0.0 and above. The problem is tracked in
# https://github.com/pypa/setuptools/issues/3548. We're also discussing how we could potentially fix
# this problem on our end in issue https://github.com/apache/airflow/issues/30764. Until then we need
# to use one of the following workarounds locally for editable installs:
# 1) Pin setuptools <= 63.4.3 below in the [build-system] section.
# 2) Include your airflow source code directory in PYTHONPATH.
[build-system]
requires = ['setuptools==67.2.0']
build-backend = "setuptools.build_meta"
[tool.ruff]
target-version = "py38"
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",
"airflow/migrations/versions/*.py",
"tests/dags/test_imports.py",
]
extend-select = [
"I", # Missing required import (auto-fixable)
"UP", # Pyupgrade
"RUF100", # Unused noqa (auto-fixable)
# We ignore more pydocstyle than we enable, so be more selective at what we enable
"D101",
"D106",
"D2",
"D3",
"D400",
# "D401", # Not enabled by ruff, but we don't want it
"D402",
"D403",
"D412",
"D419",
"TCH001", # typing-only-first-party-import
"TCH002", # typing-only-third-party-import
"TID251", # Specific modules or module members that may not be imported or accessed
"TID253", # Ban certain modules from being imported at module level
]
extend-ignore = [
"D203",
"D212",
"D213",
"D214",
"D215",
"E731",
]
namespace-packages = ["airflow/providers"]
[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 = [
"test_*.py",
"example_*.py",
]
testpaths = [
"tests",
]
[tool.ruff.isort]
required-imports = ["from __future__ import annotations"]
combine-as-imports = true
[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
# Pydantic also require models to be imported during execution
"airflow/serialization/pydantic/*.py" = ["I002", "UP007", "TCH001"]
# Ignore pydoc style from these
"*.pyi" = ["D"]
"scripts/*" = ["D"]
"docs/*" = ["D"]
"provider_packages/*" = ["D"]
"*/example_dags/*" = ["D"]
"chart/*" = ["D"]
# In addition ignore top level imports, e.g. pandas, numpy in tests and dev
"dev/*" = ["D", "TID253"]
"tests/*" = ["D", "TID253"]
"docker_tests/*" = ["D", "TID253"]
"kubernetes_tests/*" = ["D", "TID253"]
# 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"]
[tool.ruff.flake8-tidy-imports.banned-api]
"airflow.AirflowException".msg = "Use airflow.exceptions.AirflowException instead."
"airflow.Dataset".msg = "Use airflow.datasets.Dataset instead."
[tool.ruff.flake8-tidy-imports]
# Ban certain modules from being imported at module level, instead requiring
# that they're imported lazily (e.g., within a function definition).
banned-module-level-imports = ["numpy", "pandas"]
[tool.ruff.flake8-type-checking]
exempt-modules = ["typing", "typing_extensions"]
[tool.coverage.run]
branch = true
relative_files = true
source = ["airflow"]
omit = [
"airflow/_vendor/**",
"airflow/contrib/**",
"airflow/example_dags/**",
"airflow/migrations/**",
"airflow/providers/**/example_dags/**",
"airflow/www/node_modules/**",
"airflow/providers/google/ads/_vendor/**",
]
[tool.coverage.report]
skip_empty = true
exclude_also = [
"def __repr__",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"@(abc\\.)?abstractmethod",
"@(typing(_extensions)?\\.)?overload",
"if (typing(_extensions)?\\.)?TYPE_CHECKING:"
]