vscode has new settings (python.analysis.packageIndexDepths
) you can use to control Pylance’s indexing behavior.
This setting lets you override how many levels under installed packages to index on a per package basis.
By default, only top-level modules are indexed (depth = 1).
{
"python.analysis.indexing": true,
"python.analysis.packageIndexDepths": [
{
"name": "",
"depth": 2,
"includeAllSymbols": true,
},
{
"name": "django",
"depth": 5,
"includeAllSymbols": true,
}
]
}
This is a recent vscode / pylance enhancement documented here.