Add pyrefly config for smart_control - #175
Conversation
Add initial configuration for Pyrefly with settings for Python version, project includes/excludes, and error handling.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Hi @TakshPatel5821 welcome! Thanks for your contribution, and for your notes.
https://github.com/google/sbsim/actions/runs/31047696462/job/92663756344?pr=175
Finally, as some background info, we are preparing a big sync-out of some internal code - that code should hopefully be passing all the pyrefly rules, so it will likely not be necessary to address / fix the current pyrefly issues separately on the GitHub side. To coordinate with this upcoming sync-out, we might sync-out first and then merge the pyrefly updates. I need to think about which should come first. Perhaps we merge the pyrefly config first and ignore existing warnings. |
|
Thanks for the response!
most of it is really one root cause — 194 of the 656 errors are proto message classes used in type hints (e.g. Also noticed
|
Addresses #174.
Internally at Google, pyrefly has replaced pylint, and this issue asked for the repo's tooling to be updated to match. This PR adds the "blessed" pyrefly.toml from the issue, scoped to
project-includes = ["smart_control"](mirroring thefiles: '^smart_control/'pattern already used for the pyink/isort/pylint pre-commit hooks) and excluding the generated*_pb2.pyfiles andsmart_control/proto/, the same way isort and the pylint hook already do.pyrefly is also added to the dev dependency group in pyproject.toml so it installs alongside pylint via
poetry install --with dev.What I intentionally left out:
poetry locklocally should be a one-line fix if a maintainer wants to land this as-is.pyrefly check --config pyrefly.tomlagainst the repo and it currently surfaces 600+ pre-existing type errors under smart_control/ (mostly missing-import noise from optional deps, but also some real bad-argument-type findings). Turning this on as a blocking hook today would break every contributor's pre-commit run for unrelated changes. Happy to add the hook in this PR too if you'd rather land it non-blocking to start, or as a separate PR once there's a plan for the existing errors.Let me know which direction you'd prefer and I can adjust.