Skip to content

Configure Pyrefly #174

Description

@s2t2

Internally at Google we have changed to use Pyrefly instead of pytype.

https://pyrefly.org/

https://pyrefly.org/en/docs/error-kinds/

We should update the tooling in this repository to match.

This is the blessed "pyrefly.toml" config file to help OSS repos match internal Google formatting

# This is a pyrefly config for the use of OSS developers at Google.
# This configuration is intended to provide a closest configuration to the
# current g3 pyrefly.
python-version = "3.13"

# set the directory Pyrefly will search for files to type check
project-includes = []

# manually set the `sys.platform` Pyrefly will assume when type checking
python-platform = "linux"

# LINT.IfChange(pyrefly_oss_config)
infer-with-first-use = false
check-unannotated-defs = true
infer-return-types = "never"

# a table mapping error codes to an `is-enabled` boolean
[errors]
implicit-import = false
unused-coroutine = false
protocol-implicitly-defined-attribute = false
redundant-condition = false
unreachable = false
unsafe-overlap = false
redefinition = false
bad-dunder-all = false
bad-override-mutable-attribute = false
bad-override-param-name = false
abstract-method-call = false
# LINT.ThenChange(
#  [//depot/google3/third_party/pyrefly/pyrefly/lib/commands/util.rs:pytype_non_parity_errors](https://source.corp.google.com/piper///depot/google3/third_party/pyrefly/pyrefly/lib/commands/util.rs?q=%22LINT.IfChange%28pytype_non_parity_errors%29%22+case:yes),
#  [//depot/google3/third_party/pyrefly/pyrefly/lib/commands/util.rs:pytype_non_parity_command_line_arguments](https://source.corp.google.com/piper///depot/google3/third_party/pyrefly/pyrefly/lib/commands/util.rs?q=%22LINT.IfChange%28pytype_non_parity_command_line_arguments%29%22+case:yes)
#)

We also want to run pyrefly checks during pre-commit hooks and the CI build, and update documentation accordingly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions