Skip to content

basedpyright migration #5753

Done
Done

Description

@stroxler

Describe the Bug

I realized as I was working through a backlog of basedpyright parity features and bugfixes that we don't currently have a system in place to make pyrefly --init behave well for basedpyright users.

I think we should try to work out heuristics for distinguishing basedpyright vs pyright setups, because the defaults are different and therefore the mapping to Pyrefly is different.

There's probably a bigger issue here, that our migration tooling has been less-maintained than we intended because we've been pulled into more bugfixing and feature work. I think in general we could use a big sweep for not only basedpyright but also pyright and mypy compatibility; I've recently noticed quite a number of error codes that could be mapped but aren't.

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Activity

  1. self-assigned this
    on Nov 24, 2026
  2. stroxler commented on Nov 24, 2026

    @stroxler
    ContributorAuthor

    There are a number of tells we can use in the config to detect basedpyright, beyond what we do today.

    Here's a list of potential heuristics, I'll aim to implement at least the highest-value ones; right now we only support one of them

    Signal Strength
    A [tool.basedpyright] section in pyproject.toml Definitive. We already use it.
    "typeCheckingMode": "recommended" or "all" in pyrightconfig.json Definitive, since pyright rejects these values.
    Keys only basedpyright defines, such as reportAny, reportExplicitAny, reportIgnoreCommentWithoutRule, reportUnusedCallResult, failOnWarnings, baselineFile, allowedUntypedLibraries Near-definitive. Pyright ignores or warns on them, so nobody would write them for pyright.
    .basedpyright/baseline.json on disk Strong.
    basedpyright in dev dependencies or lock files (dependency groups, [tool.uv]/Poetry/PDM groups, requirements-dev*.txt, uv.lock/poetry.lock) Strong, but you have to parse files beyond the config.
    How the project runs its checker: basedpyright in .pre-commit-config.yaml (e.g. the basedpyright-pre-commit-mirror hook), CI workflows, tox/nox/Makefile Strong for CI, but expensive to scan.
    basedpyright.* keys in .vscode/settings.json Weak. Someone may run basedpyright in the editor while CI runs pyright.

    In terms of what to do, we should audit our current settings against https://detachhead.github.io/python-type-checker-comparison, which is probably better curated than anything on our side.

    In the process, we might also discover some gaps relative to standard pyright and we should address those as well.

  3. stroxler commented on Nov 24, 2026

    @stroxler
    ContributorAuthor
  4. connernilsen commented on Nov 24, 2026

    @connernilsen
    Contributor

    .basedpyright/baseline.json on disk

    We may need to check that a Pyrefly config hasn't been used before, so that we don't treat a possible Pyright setup as BasedPyright here. I would assume pyrefly --init would skip running an init flow if a Pyrefly config is found on disk though.

  5. added a commit that references this issue on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions