google / google/sbsim

Configure Pyrefly

Open
#174 5 comments 0 reactions 0 assignees View on GitHub
good first issue
Dominant language
Python
Stars
123
Forks
56
Avg merge
17d 18h
Merged PRs (30d)
3

Description

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.

Contributor guide

Open the contributing guide

Research direction

Start by locating the repository's existing pytype tooling, pre-commit configuration, CI build configuration, and documentation. Add the provided pyrefly.toml configuration, replace the relevant pytype checks with Pyrefly, and update the documented workflow. Done means pre-commit and CI run Pyrefly successfully and the documentation reflects the new tool.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ci-cd, documentation, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.