forked from Teradata/airbyte
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
279 lines (252 loc) · 7.84 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
[tool.poetry]
name = "airbyte"
version = "0.1.0"
description = "Airbyte open source connector code"
authors = ["Airbyte <contact@airbyte.io>"]
[tool.poetry.dependencies]
python = "~3.10"
jsonschema = "^4.22.0"
[tool.poetry.group.dev.dependencies]
isort = "5.6.4"
black = "~22.3.0"
ruff = "^0.4"
poethepoet = "^0.26.1"
[tool.poe.tasks]
isort = { cmd = "poetry run isort --settings-file pyproject.toml ." }
black = { cmd = "poetry run black --config pyproject.toml ." }
format = { sequence = [
"isort",
"black",
], help = "Format Python code in the repository. This command is invoked in airbyte-ci format." }
[tool.black]
line-length = 140
target-version = ["py310"]
extend-exclude = """
/(
build
| integration_tests
| unit_tests
| generated
| airbyte-cdk/python/airbyte_cdk/sources/declarative/models
| invalid
| non_formatted_code
| airbyte-integrations/connectors/destination-duckdb
| airbyte-integrations/connectors/destination-snowflake-cortex
)/
"""
[tool.flake8]
extend-exclude = [
"*/lib/*/site-packages",
".venv",
"build",
"models",
".eggs",
"**/__init__.py",
"**/generated/*",
"**/declarative/models/*",
]
max-complexity = 20
max-line-length = 140
extend-ignore = [
"E203", # whitespace before ':' (conflicts with Black)
"E231", # Bad trailing comma (conflicts with Black)
"E501", # line too long (conflicts with Black)
"W503", # line break before binary operator (conflicts with Black)
"F811", # TODO: ella fix after pflake8 version update
]
[tool.coverage.report]
fail_under = 0
skip_empty = true
sort = "-cover"
omit = [
".venv/*",
"main.py",
"setup.py",
"unit_tests/*",
"integration_tests/*",
"**/generated/*",
]
# TODO: This will be removed in favor of the section below.
[tool.isort]
profile = "black"
color_output = false
# skip_gitignore = true
line_length = 140
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
skip_glob = [
"airbyte-cdk/python/airbyte_cdk/sources/declarative/models/**",
"**/invalid/**",
"**/non_formatted_code/**",
"**/connector_builder/generated/**",
# TODO: Remove this after we move to Ruff. Ruff is mono-repo-aware and
# correctly handles first-party imports in subdirectories.
# Migrated to Ruff:
"airbyte-integrations/connectors/destination-duckdb/**",
"airbyte-integrations/connectors/destination-snowflake-cortex/**"
]
[tool.ruff.pylint]
max-args = 8 # Relaxed from default of 5
max-branches = 15 # Relaxed from default of 12
[tool.ruff]
target-version = "py310"
select = [
# For rules reference, see https://docs.astral.sh/ruff/rules/
"A", # flake8-builtins
"ANN", # flake8-annotations
"ARG", # flake8-unused-arguments
"ASYNC", # flake8-async
"B", # flake8-bugbear
"FBT", # flake8-boolean-trap
"BLE", # Blind except
"C4", # flake8-comprehensions
"C90", # mccabe (complexity)
"COM", # flake8-commas
"CPY", # missing copyright notice
# "D", # pydocstyle # TODO: Re-enable when adding docstrings
"DTZ", # flake8-datetimez
"E", # pycodestyle (errors)
"ERA", # flake8-eradicate (commented out code)
"EXE", # flake8-executable
"F", # Pyflakes
"FA", # flake8-future-annotations
"FIX", # flake8-fixme
"FLY", # flynt
"FURB", # Refurb
"I", # isort
"ICN", # flake8-import-conventions
"INP", # flake8-no-pep420
"INT", # flake8-gettext
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
"LOG", # flake8-logging
"N", # pep8-naming
"PD", # pandas-vet
"PERF", # Perflint
"PIE", # flake8-pie
"PGH", # pygrep-hooks
"PL", # Pylint
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"PYI", # flake8-pyi
"Q", # flake8-quotes
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # Ruff-specific rules
"SIM", # flake8-simplify
"SLF", # flake8-self
"SLOT", # flake8-slots
"T10", # debugger calls
# "T20", # flake8-print # TODO: Re-enable once we have logging
"TCH", # flake8-type-checking
"TD", # flake8-todos
"TID", # flake8-tidy-imports
"TRY", # tryceratops
"TRY002", # Disallow raising vanilla Exception. Create or use a custom exception instead.
"TRY003", # Disallow vanilla string passing. Prefer kwargs to the exception constructur.
"UP", # pyupgrade
"W", # pycodestyle (warnings)
"YTT", # flake8-2020
]
ignore = [
# For rules reference, see https://docs.astral.sh/ruff/rules/
# These we don't agree with or don't want to prioritize to enforce:
"ANN003", # kwargs missing type annotations
"ANN101", # Type annotations for 'self' args
"ANN102", # Type annotations for 'cls' args
"COM812", # Because it conflicts with ruff auto-format
"EM", # flake8-errmsgs (may reconsider later)
"DJ", # Django linting
"G", # flake8-logging-format
"ISC001", # Conflicts with ruff auto-format
"NPY", # NumPy-specific rules
"PIE790", # Allow unnecssary 'pass' (sometimes useful for readability)
"PERF203", # exception handling in loop
"S", # flake8-bandit (noisy, security related)
"SIM910", # Allow "None" as second argument to Dict.get(). "Explicit is better than implicit."
"TD002", # Require author for TODOs
"TRIO", # flake8-trio (opinionated, noisy)
"INP001", # Dir 'examples' is part of an implicit namespace package. Add an __init__.py.
# TODO: Consider re-enabling these before release:
"A003", # Class attribute 'type' is shadowing a Python builtin
"BLE001", # Do not catch blind exception: Exception
"ERA001", # Remove commented-out code
"FIX002", # Allow "TODO:" until release (then switch to requiring links via TDO003)
"PLW0603", # Using the global statement to update _cache is discouraged
"TD003", # Require links for TODOs # TODO: Re-enable when we disable FIX002
"UP007", # Allow legacy `Union[a, b]` and `Optional[a]` for Pydantic, until we drop Python 3.9 (Pydantic doesn't like it)
]
fixable = ["ALL"]
unfixable = [
"ERA001", # Commented-out code (avoid silent loss of code)
"T201", # print() calls (avoid silent loss of code / log messages)
]
line-length = 140
extend-exclude = ["docs", "test", "tests"]
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.isort]
force-sort-within-sections = false
lines-after-imports = 2
known-first-party = [
"airbyte",
"airbyte_cdk",
"airbyte_protocol",
"airbyte_api_client",
"connector_ops",
"pipelines",
]
known-local-folder = ["airbyte"]
required-imports = ["from __future__ import annotations"]
known-third-party = []
section-order = [
"future",
"standard-library",
"third-party",
"first-party",
"local-folder",
]
[tool.ruff.mccabe]
max-complexity = 24
[tool.ruff.pycodestyle]
ignore-overlong-task-comments = true
[tool.ruff.pydocstyle]
convention = "google"
[tool.ruff.flake8-annotations]
allow-star-arg-any = false
ignore-fully-untyped = false
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
preview = false
docstring-code-format = true
[tool.mypy]
platform = "linux"
exclude = "(build|integration_tests|unit_tests|generated)"
# Optionals
ignore_missing_imports = true
# Strictness
allow_untyped_globals = false
allow_redefinition = false
implicit_reexport = false
strict_equality = true
# Warnings
warn_unused_ignores = true
warn_no_return = true
warn_return_any = true
warn_redundant_casts = true
warn_unreachable = true
# Error output
show_column_numbers = true
show_error_context = true
show_error_codes = true
show_traceback = true
pretty = true
color_output = true
error_summary = true
[tool.pytest.ini_options]
minversion = "6.2.5"
addopts = "-r a --capture=no -vv --color=yes"