Skip to content

Feature request: Support typeCheckingMode in executionEnvironments #1638

@aviadr1

Description

@aviadr1

Feature Request

Allow typeCheckingMode to be specified within individual executionEnvironments entries in the configuration file.

Current Behavior

Currently, typeCheckingMode can only be set globally in the configuration. Each execution environment can override individual diagnostic rules, but cannot set a type checking mode directly.

To apply different checking strictness to different folders, users must either:

  1. Manually specify dozens of individual diagnostic rules per execution environment
  2. Use the strict array (which only supports upgrading to strict mode, not other modes like "recommended")

Desired Behavior

Users should be able to specify typeCheckingMode within execution environments:

{
  "typeCheckingMode": "standard",
  "executionEnvironments": [
    {
      "root": "src/legacy",
      "typeCheckingMode": "basic"
    },
    {
      "root": "src/new_code",
      "typeCheckingMode": "recommended"
    }
  ]
}

This would make it much easier to:

  • Apply stricter checking to new code while keeping legacy code at a lower level
  • Gradually migrate a codebase to stricter checking folder-by-folder
  • Use "recommended" mode (basedpyright's default) only in specific parts of a project

Workaround

Currently, the only way to achieve this is to manually copy all diagnostic rules from the desired mode into each execution environment's configuration, which is verbose and error-prone.

Implementation Note

@aviadr1 ([email protected]) is currently working on a PR to implement this feature.

Related

This would be similar to how the strict array works, but more flexible as it would support all type checking modes (off, basic, standard, strict, recommended, all) rather than just strict mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    configissues relating to config (pyproject.toml, pyrightconfig.json, LSP config or vscode extension)rejected upstreamalso a bug in pyright/pylance or feature that isn't in pyright/pylance - they refused to address it

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions