Skip to content

detect basedpyright config - #4729

Open
DetachHead wants to merge 3 commits into
facebook:mainfrom
DetachHead:basedpyright-migration
Open

detect basedpyright config#4729
DetachHead wants to merge 3 commits into
facebook:mainfrom
DetachHead:basedpyright-migration

Conversation

@DetachHead

@DetachHead DetachHead commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #4382

Test Plan

  • added a new test

  • manually tested by running pyrefly init on a project with an empty [tool.basedpyright] section in pyproject.toml, and confirmed the following [tool.pyrefly] section was added:

    [tool.pyrefly]
    python-platform = "all"
    preset = "all"
    infer-with-first-use = false

@meta-cla

meta-cla Bot commented Aug 30, 2026

Copy link
Copy Markdown

Hi @DetachHead!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@DetachHead
DetachHead force-pushed the basedpyright-migration branch from 89cf695 to acc61af Compare August 30, 2026 02:48
@meta-cla meta-cla Bot added the cla signed label Aug 30, 2026
@github-actions github-actions Bot added size/m and removed size/m labels Aug 30, 2026
@meta-codesync

meta-codesync Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

This pull request has been imported. If you are a Meta employee, you can view this in D118023988. (Because this pull request was imported automatically, there will not be any future comments.)

@connernilsen connernilsen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing this! Here are some answers to the questions I saw + a few other additional things to request

Comment thread crates/pyrefly_config/src/migration/error_codes.rs Outdated
Comment thread crates/pyrefly_config/src/migration/pyright.rs Outdated
Comment thread crates/pyrefly_config/src/migration/pyright.rs Outdated
Comment thread crates/pyrefly_config/src/migration/python_platform.rs
Comment thread crates/pyrefly_config/src/migration/run.rs Outdated
Comment thread pyrefly/lib/commands/check.rs Outdated
Comment thread pyrefly/lib/lsp/non_wasm/type_error_display_status.rs Outdated
@DetachHead
DetachHead force-pushed the basedpyright-migration branch from 9a928a7 to 2564515 Compare August 30, 2026 04:55
@github-actions github-actions Bot added size/l and removed size/l labels Aug 30, 2026
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions github-actions Bot added size/l and removed size/l labels Sep 5, 2026
@DetachHead
DetachHead force-pushed the basedpyright-migration branch from 9186d46 to 699bedd Compare September 5, 2026 02:16
@github-actions github-actions Bot added the size/l label Sep 5, 2026
@DetachHead
DetachHead force-pushed the basedpyright-migration branch from 699bedd to 0450164 Compare September 5, 2026 04:31
@github-actions github-actions Bot added size/l and removed size/l labels Sep 5, 2026
@DetachHead
DetachHead force-pushed the basedpyright-migration branch from 0450164 to f8cb183 Compare September 5, 2026 04:44
@github-actions github-actions Bot added size/l and removed size/l labels Sep 5, 2026
@DetachHead
DetachHead force-pushed the basedpyright-migration branch 2 times, most recently from 23199eb to d5abc62 Compare September 5, 2026 05:56
@github-actions github-actions Bot added size/l and removed size/l labels Sep 5, 2026
@DetachHead
DetachHead force-pushed the basedpyright-migration branch from d5abc62 to beda202 Compare September 5, 2026 06:02
@github-actions github-actions Bot added size/l and removed size/l labels Sep 5, 2026
@DetachHead
DetachHead force-pushed the basedpyright-migration branch from beda202 to 924f1b7 Compare September 5, 2026 06:11
@github-actions github-actions Bot added size/l and removed size/l labels Sep 5, 2026
@DetachHead

This comment was marked as outdated.

@DetachHead
DetachHead marked this pull request as draft September 5, 2026 15:20
meta-codesync Bot pushed a commit that referenced this pull request Sep 5, 2026
Summary:
after connernilsen pointed out that i accidentally committed a `dbg!` macro, i wondered if there was a clippy rule to prevent such mistakes (see #4729 (comment)). turns out there is!

note that enabling a rule globally seems to be nowhere near as straightforward as it is in most other linters, so i had to make some other changes:

- i had to set `workspace = true` in each package (rust-lang/rust-clippy#16541 (comment))
- i also had to move the existing `unexpected_cfgs` config out of the individual packages into the global config, to workaround rust-lang/cargo#13157

Pull Request resolved: #4821

Test Plan:
intentionally inserted a `dbg!` macro and ran `cargo clippy`:

```
error: the `dbg!` macro is intended as a debugging tool
  --> crates/pyrefly_config/src/migration/error_codes.rs:72:9
   |
72 |         dbg!(&pyright_cfg.type_checking_mode);
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#dbg_macro
   = note: requested on the command line with `-D clippy::dbg-macro`
help: remove the invocation before committing it to a version control system
   |
72 -         dbg!(&pyright_cfg.type_checking_mode);
72 +         &pyright_cfg.type_checking_mode;
   |

error: could not compile `pyrefly_config` (lib) due to 1 previous error
```

Reviewed By: samwgoldman

Differential Revision: D118959745

Pulled By: stroxler

fbshipit-source-id: fca410967f9edfeb2defa2225a5cad4dd8962ea1
@DetachHead
DetachHead force-pushed the basedpyright-migration branch from 924f1b7 to 1175d82 Compare September 6, 2026 02:54
@DetachHead
DetachHead marked this pull request as ready for review September 6, 2026 02:54
@github-actions github-actions Bot added size/l and removed size/l labels Sep 6, 2026
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BasedPyright config detection/migration

3 participants