microsoft / microsoft/pyright

Allow Ignoring Specific Libraries for Strict Type Checking in Pyright

Open
#10,566 0 comments 8 reactions 0 assignees View on GitHub
enhancement request
Dominant language
Python
Stars
15.6k
Forks
1.8k
Avg merge
12h 13m
Merged PRs (30d)
52

Description

It would be great to have a way to exclude specific third-party libraries from strict type checking, without disabling strict mode globally or having to manually suppress each individual error.

### 💡 **Use Case**

Many widely used libraries (e.g., certain Discord API wrappers, web frameworks, or older APIs) either:

* Do **not ship proper type stubs**, or
* Use **incomplete or dynamically-typed interfaces**

This leads to **unresolvable Pyright errors** in strict mode — especially `reportUnknownMemberType`, `reportUnknownArgumentType`, and `reportGeneralTypeIssues` — even when the code works perfectly at runtime.

### ✅ **Proposed Solution**

An option in `pyrightconfig.json`, something like:

```json
{
"typeCheckingMode": "strict",
"ignoreLibraries": ["discord", "some_legacy_package"]
}
```

### 🔍 **Why It Matters**

This would:

* Keep strict mode usable without drowning in 3rd-party errors
* Avoid cluttering the codebase with `# type: ignore` comments
* Improve developer experience when using popular, loosely-typed libraries

Contributor guide

Open the contributing guide

Research direction

Start with Pyright's pyrightconfig.json handling and the strict type-checking diagnostics named in the issue. Determine how an ignoreLibraries option should identify third-party packages and which diagnostics it affects. Done means strict checking remains enabled for project code while configured libraries no longer produce the targeted errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.