diff --git a/sdks/python/.isort.cfg b/sdks/python/.isort.cfg deleted file mode 100644 index a29f98cc90be..000000000000 --- a/sdks/python/.isort.cfg +++ /dev/null @@ -1,58 +0,0 @@ -# -# 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. -# - -[settings] -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, - main_test.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 \ No newline at end of file diff --git a/sdks/python/pyproject.toml b/sdks/python/pyproject.toml index c764298ebae3..980a0fda0a55 100644 --- a/sdks/python/pyproject.toml +++ b/sdks/python/pyproject.toml @@ -44,3 +44,175 @@ requires = [ # 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"] +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" diff --git a/sdks/python/pyrefly.toml b/sdks/python/pyrefly.toml deleted file mode 100644 index 6247d79264a6..000000000000 --- a/sdks/python/pyrefly.toml +++ /dev/null @@ -1,60 +0,0 @@ -# -# 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. -# - -project-includes = ["apache_beam"] -python-version = "3.10.0" -ignore-missing-imports = ["*"] -untyped-def-behavior = "skip-and-infer-return-any" - -[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, e.g there are -# fewer violations for the check on line 40 than for the check on line 35. -# violations. -# -# 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" \ No newline at end of file diff --git a/sdks/python/ruff.toml b/sdks/python/ruff.toml deleted file mode 100644 index 5a862e013f12..000000000000 --- a/sdks/python/ruff.toml +++ /dev/null @@ -1,96 +0,0 @@ -# -# 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. -# - -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"] - -[lint] -select = ["E9", "PL", "F821", "F822", "F823"] -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]+?))$" \ No newline at end of file