blob: 7da1d29acef3d110acd20773c3d7837bd03d9ed3 [file]
#
# 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.
#
# since we rely on setuptools and according to https://peps.python.org/pep-0518/#build-system-table
# this is the minimum requirements for the build system to execute.
[build-system]
requires = [
"setuptools",
"wheel>=0.36.0",
# Note: after upgrading to grpcio-tools, we must bump protobuf to >=5.0.
# Currently Blocked on old dependencies of Beam tft extra:
# https://github.com/apache/beam/issues/37854
"grpcio-tools==1.62.1; python_version <= '3.12'",
"grpcio-tools==1.71.0; python_version >= '3.13'",
"mypy-protobuf==3.5.0",
# Avoid https://github.com/pypa/virtualenv/issues/2006
"distlib==0.3.9",
# Numpy headers
"numpy>=1.14.3,<2.5.0", # Update setup.py as well.
# having cython here will create wheels that are platform dependent.
"cython>=3.2.5,<4",
## deps for generating external transform wrappers:
# also update PyYaml bounds in sdks:python:generateExternalTransformsConfig
'pyyaml>=3.12,<7.0.0',
# also update Jinja2 bounds in test-suites/xlang/build.gradle (look for xlangWrapperValidation task)
"jinja2>=2.7.1,<4.0.0",
'yapf==0.43.0'
]
# legacy installation is needed to generate `apache_beam.portability.api` package.
build-backend = "setuptools.build_meta"
[tool.isort]
py_version = 310
line_length = 120
old_finders = true
order_by_type = true
force_single_line = true
combine_star = true
src_paths = ["apache_beam"]
extra_standard_library = ["dataclasses"]
known_third_party = ["yaml"]
skip = [
"apiclient.py",
"avroio_test.py",
"cloudpickle.py",
"datastore_wordcount.py",
"datastoreio_test.py",
"doctests_test.py",
"fast_coders_test.py",
"hadoopfilesystem.py",
"iobase_test.py",
"main_test.py",
"model.py",
"preprocess.py",
"process_tfma.py",
"render_test.py",
"slow_coders_test.py",
"taxi.py",
"tfdv_analyze_and_validate.py",
"yaml/main.py",
"yaml_testing_test.py",
"bigquery_v2_client.py",
"bigquery_v2_messages.py",
"dataflow_v1b3_client.py",
"dataflow_v1b3_messages.py",
"storage_v1_client.py",
"storage_v1_messages.py",
"proto2_coder_test_messages_pb2.py",
"cloudbuild_v1_client.py",
"cloudbuild_v1_messages.py",
"boto3_client.py",
]
skip_glob = [
"*.pxd",
"*.pyx",
"*pb2*.py",
"**/examples/**/*.py",
"**/portability/api/**/*.py",
"**/portability/api/__init__.py",
]
[tool.ruff]
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
"*.pxd",
"*.pyx",
"*pb2*.py",
"**/examples/**/*.py",
"**/examples/**/*.ipynb",
"**/portability/api/**/*.py",
"**/portability/api/__init__.py",
]
target-version = "py310"
src = ["apache_beam"]
[tool.ruff.lint]
select = ["E9", "PL", "F821", "F822", "F823", "UP006"]
ignore = [
# Ignored Pylint Checks
"PLC0415", # import-outside-toplevel
"PLR2004", # magic-value-comparison
"PLR0913", # too-many-arguments
"PLR0912", # too-many-branches
"PLW0108", # unnecessary-lambda
"PLW2901", # redefined-loop-name
"PLR0915", # too-many-statements
"PLR1714", # repeated-equality-comparison
"PLR0911", # too-many-return-statements
"PLR5501", # collapsible-else-if
"PLW0603", # global-statement
"PLR1730", # if-stmt-min-max
"PLW1641", # eq-without-hash
"PLW0602", # global-variable-not-assigned
"PLC1802", # len-test
"PLC3002", # unnecessary-direct-lambda-call
"PLW0642", # self-or-cls-assignment
"PLR1733", # unnecessary-dict-index-lookup
"PLR0402", # manual-from-import
"PLC0132", # type-param-name-mismatch
"PLC0206", # dict-index-missing-items
"PLC0207", # missing-maxsplit-arg
"PLR1704", # redefined-argument-from-local
"PLR1711", # useless-return
"PLW0406", # import-self
"PLW3301", # nested-min-max
"PLR2044", # empty-comment
]
# Allow fix for all enabled rules (when --fix) is provided.
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.pyrefly]
project-includes = ["apache_beam"]
python-version = "3.10.0"
ignore-missing-imports = ["*"]
untyped-def-behavior = "skip-and-infer-return-any"
[tool.pyrefly.errors]
missing-attribute = "ignore"
invalid-annotation = "ignore"
redundant-condition = "ignore"
untyped-import = "ignore"
# Beam-specific supressions to keep pyrefly green
# These are in descending order of instances.
#
# TODO(https://github.com/apache/beam/issues/37699): Reduce the number of
# ignored checks.
bad-param-name-override = "ignore"
bad-override = "ignore"
bad-argument-type = "ignore"
unsupported-operation = "ignore"
implicit-import = "ignore"
bad-function-definition = "ignore"
bad-return = "ignore"
unbound-name = "ignore"
no-matching-overload = "ignore"
bad-assignment = "ignore"
missing-argument = "ignore"
bad-index = "ignore"
invalid-type-var = "ignore"
unknown-name = "ignore"
not-a-type = "ignore"
deprecated = "ignore"
not-callable = "ignore"
invalid-argument = "ignore"
invalid-inheritance = "ignore"
not-iterable = "ignore"
unexpected-keyword = "ignore"
bad-specialization = "ignore"
bad-context-manager = "ignore"
invalid-yield = "ignore"
bad-argument-count = "ignore"
bad-typed-dict-key = "ignore"