Fix stdlib detection incorrectly flagging site-packages files#385
Draft
Fix stdlib detection incorrectly flagging site-packages files#385
Conversation
Co-authored-by: edvilme <5952839+edvilme@users.noreply.github.com>
Co-authored-by: edvilme <5952839+edvilme@users.noreply.github.com>
…false positive test Co-authored-by: edvilme <5952839+edvilme@users.noreply.github.com>
…in tests Co-authored-by: edvilme <5952839+edvilme@users.noreply.github.com>
Co-authored-by: edvilme <5952839+edvilme@users.noreply.github.com>
Co-authored-by: edvilme <5952839+edvilme@users.noreply.github.com>
Co-authored-by: edvilme <5952839+edvilme@users.noreply.github.com>
Co-authored-by: edvilme <5952839+edvilme@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix bug for skipping standard library file notification
Fix stdlib detection incorrectly flagging site-packages files
Feb 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Users receive "Skipping standard library file (stdlib excluded)" notifications for third-party packages in site-packages (e.g., pytest, numpy), which are not stdlib files.
Root Cause
_stdlib_pathsincorrectly included:site.getsitepackages()/site.getusersitepackages()- third-party package directoriespurelib/platlibfromsysconfig.get_paths()- also site-packages pathsChanges
bundled/tool/lsp_utils.py:_get_sys_config_paths(): Only includestdlibandplatstdlibfromsysconfig.get_paths()_stdlib_paths: Removesite.getsitepackages()andsite.getusersitepackages()is_stdlib_file(): Add explicit exclusion for paths containing{os.sep}site-packages{os.sep}or{os.sep}dist-packages{os.sep}to handle edge casessrc/test/python_tests/test_stdlib_detection.py:site-packages-backup≠site-packages)Example
Original prompt
This section details on the original issue you should resolve
<issue_title>Skipping standard library file notification</issue_title>
<issue_description><!-- Hello! Thank you for submitting a bug to our repo. Our users and their bug reports are essential to our development process.
Before you submit an issue:
openandclosedissues.of the bug report below! (see directions on how to set and access these logs in the
Logssection below.)Thank you!-->
Diagnostic Data
Behaviour
Expected Behavior
No notifications during normal use.
Actual Behavior
Repeated 'Skipping standard library file (stdlib excluded)' notifications with a path pointing to site-packages.
Reproduction Steps:
I don't think I've done anything special, I have a venv (created using
python -m venv <path>) activated and write code. The latest notification that showed up today was for monkeypatch, so maybe writing a pytest test using monkeypatch. Importantly, I did not open any file in site-packages.Logs:
Unfortunately the logs include sensitive client information. I have included a redacted version (mostly removing filenames/paths).
Click here for detailed logs
2025-12-02 12:04:43.949 [info] [Trace - 12:04:43 PM] Sending request 'textDocument/codeAction - (1451)'. 2025-12-02 12:04:43.949 [info] Params: { "textDocument": { "uri": "--redacted--" }, "range": { "start": { "line": 32, "character": 0 }, "end": { "line": 40, "character": 0 } }, "context": { "diagnostics": [], "triggerKind": 2 } }2025-12-02 12:04:43.952 [info] [Trace - 12:04:43 PM] Received response 'textDocument/codeAction - (1451)' in 3ms.
2025-12-02 12:04:43.952 [info] Result: []
2025-12-02 12:04:45.241 [info] [Trace - 12:04:45 PM] Sending notification 'textDocument/didChange'.
2025-12-02 12:04:45.241 [info] Params: {
"textDocument": {
"uri": "--redacted--",
"version": 3281
},
"contentChanges": [
{
"range": {
"start": {
"line": 32,
"character": 0
},
"end": {
"line": 40,
"character": 0
}
},
"rangeLength": 199,
"text": ""
}
]
}
2025-12-02 12:04:47.077 [info] [Trace - 12:04:47 PM] Sending notification 'textDocument/didOpen'.
2025-12-02 12:04:47.077 [info] Params: {
"textDocument": {
"uri": "file:///c%3A/--venv path--/Lib/site-packages/pytest_bdd/steps.py",
"languageId": "python",
"version": 1,
"text": """"Step decorators.\n\nExample:\n\n@given("I have an article", target_fixture="article")\ndef _(author):\n return create_test_article(author=author)\n\n\n@when("I go to the article page")\ndef _(browser, article):\n browser.visit(urljoin(browser.url, "/articles/{0}/".format(article.id)))\n\n\n@then("I should not see the error message")\ndef _(browser):\n with pytest.raises(ElementDoesNotExist):\n browser.find_by_css(".message.error").first\n\n\nMultiple names for the steps:\n\n@given("I have an article")\n@given("there is an article")\ndef _(author):\n return create_test_article(author=author)\n\n\nReusing existing fixtures for a different step name:\n\n\n@given("I have a beautiful article")\ndef _(article):\n pass\n\n"""\n\nfrom future import annotations\n\nimport enum\nfrom collections.abc import Iterable\nfrom dataclasses import dataclass, field\nfrom itertools import count\nfrom typing import Any, Callable, Literal, TypeVar\n\nimport pytest\nfrom typing_extensions import ParamS...
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.