| # Copyright 2023 The Fuchsia Authors. All rights reserved. | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| [tool.black] | |
| # Following the Google Python style guide, we set the maximum line length | |
| # to 80 characters. See: https://google.github.io/styleguide/pyguide.html#32-line-length | |
| line-length = 80 | |
| target-version = ['py311'] | |
| include = '\.pyi?$' | |
| exclude = ''' | |
| # Start regex with a forward slash so that black will only ignore these files | |
| # if they're in the root of the repo. | |
| ^/( | |
| ( | |
| \.jiri_root | |
| | out | |
| | third_party | |
| | prebuilt | |
| | __pycache__ | |
| ) | |
| ) | |
| ''' | |
| [tool.isort] | |
| profile = "black" | |
| line_length = 80 | |
| default_section="FIRSTPARTY" | |
| skip_glob = ["**/.venvs/*", "**/third_party/*", "**/*.pyz", "out/*"] | |
| [tool.mypy] | |
| strict = true | |
| pretty = true | |
| # Mypy 2.4+ enables the Rust-based native parser (which requires the | |
| # `ast_serialize` native extension) by default. Use the stdlib `ast` parser | |
| # instead so `ast_serialize` does not need to be vendored. | |
| native_parser = false | |
| # We need to ignore missing imports since some of our source code dependencies | |
| # reside in the 'third_party' directory, which may not always be in python path. | |
| ignore_missing_imports = true | |
| # TODO(b/324270220): Temporarily disable this flag to ease the transition to | |
| # type checking. Re enable this flag for stricter checking in the future. | |
| warn_return_any = false | |
| # TODO(b/331504010): Address subclass Type Errors in Tests | |
| # To handle `error: Class cannot subclass "FuchsiaBaseTest" (has type "Any") [misc]` | |
| # More info @ https://github.com/python/mypy/issues/9318 | |
| disallow_subclassing_any = false | |
| # Allow decorators, calls without type annotations since some of our packages | |
| # don't have type annotations. | |
| allow_untyped_decorators = true | |
| allow_untyped_calls = true | |
| # 'yaml' module imports aren't working with the global | |
| # 'ignore_missing_imports' flag. Overriding using overridesr entry. | |
| [[tool.mypy.overrides]] | |
| module = "yaml" | |
| ignore_missing_imports = true | |
| # Pyrefly is being rolled out to replace mypy; see https://fxbug.dev/575968075. | |
| [tool.pyrefly] | |
| # Matches mypy's `ignore_missing_imports = true`: some dependencies live in | |
| # //third_party and are not always on the search path. | |
| ignore-missing-imports = ["*"] | |
| # Hermeticity: don't query a host Python interpreter; type check against the | |
| # vendored Python (//prebuilt/third_party/python3) on Linux. | |
| skip-interpreter-query = true | |
| python-version = "3.14" | |
| python-platform = "linux" |