Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for python.analysis.include, `python.analysis.exclude… #6251

Merged
merged 2 commits into from
Oct 29, 2023

Conversation

erictraut
Copy link
Collaborator

andpython.analysis.ignoresettings. These have been implemented in pylance for a while now, but they were never implemented previously in pyright. Also fixed a bug in the original implementation that caused the config file not to override the language server settings forpython.analysis.excludeandpython.analysis.ignore` as it should. This addresses #6250.

…` and `python.analysis.ignore` settings. These have been implemented in pylance for a while now, but they were never implemented previously in pyright. Also fixed a bug in the original implementation that caused the config file not to override the language server settings for `python.analysis.exclude` and `python.analysis.ignore` as it should. This addresses #6250.
@github-actions

This comment has been minimized.

Comment on lines 168 to 177
"description": "Paths of directories or files that should be included. If no paths are specified, Pylance defaults to the workspace root directory. Paths may contain wildcard characters ** (a directory or multiple levels of directories), * (a sequence of zero or more characters), or ? (a single character).",
"scope": "resource"
},
"python.analysis.exclude": {
"type": "array",
"default": [],
"items": {
"type": "string"
},
"description": "Paths of directories or files that should not be included. These override the include directories, allowing specific subdirectories to be excluded. Note that files in the exclude paths may still be included in the analysis if they are referenced (imported) by source files that are not excluded. Paths may contain wildcard characters ** (a directory or multiple levels of directories), * (a sequence of zero or more characters), or ? (a single character). If no exclude paths are specified, Pylance automatically excludes the following: `**/node_modules`, `**/__pycache__`, `.git` and any virtual environment directories.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uses the term Pylance instead of Pyright

Suggested change
"description": "Paths of directories or files that should be included. If no paths are specified, Pylance defaults to the workspace root directory. Paths may contain wildcard characters ** (a directory or multiple levels of directories), * (a sequence of zero or more characters), or ? (a single character).",
"scope": "resource"
},
"python.analysis.exclude": {
"type": "array",
"default": [],
"items": {
"type": "string"
},
"description": "Paths of directories or files that should not be included. These override the include directories, allowing specific subdirectories to be excluded. Note that files in the exclude paths may still be included in the analysis if they are referenced (imported) by source files that are not excluded. Paths may contain wildcard characters ** (a directory or multiple levels of directories), * (a sequence of zero or more characters), or ? (a single character). If no exclude paths are specified, Pylance automatically excludes the following: `**/node_modules`, `**/__pycache__`, `.git` and any virtual environment directories.",
"description": "Paths of directories or files that should be included. If no paths are specified, Pyright defaults to the workspace root directory. Paths may contain wildcard characters ** (a directory or multiple levels of directories), * (a sequence of zero or more characters), or ? (a single character).",
"scope": "resource"
},
"python.analysis.exclude": {
"type": "array",
"default": [],
"items": {
"type": "string"
},
"description": "Paths of directories or files that should not be included. These override the include directories, allowing specific subdirectories to be excluded. Note that files in the exclude paths may still be included in the analysis if they are referenced (imported) by source files that are not excluded. Paths may contain wildcard characters ** (a directory or multiple levels of directories), * (a sequence of zero or more characters), or ? (a single character). If no exclude paths are specified, Pyright automatically excludes the following: `**/node_modules`, `**/__pycache__`, `.git` and any virtual environment directories.",

@erictraut erictraut merged commit 08a295a into main Oct 29, 2023
6 checks passed
@erictraut erictraut deleted the excludeIgnore branch October 29, 2023 15:54
@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
- /tmp/mypy_primer/projects/hydra-zen/tests/annotations/behaviors.py
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/behaviors.py:74:17 - information: Type of "b.x" is "int"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/behaviors.py:85:17 - information: Type of "Conf(x=1).x" is "Any"
- /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:33:6 - error: Import "hydra.core.utils" could not be resolved (reportMissingImports)
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:34:6 - error: Import "omegaconf" could not be resolved (reportMissingImports)
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:87:17 - information: Type of "hydra_zen.__version__" is "str"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:93:9 - information: Type of "builds(A, zen_partial=True)" is "type[ZenPartialBuilds[type[A]]] | type[HydraPartialBuilds[type[A]]]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:97:17 - information: Type of "instantiate(conf_a_partial)" is "Partial[A]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:98:17 - information: Type of "instantiate(conf_a_partial)()" is "A"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:106:9 - information: Type of "builds(f, zen_partial=True)" is "type[ZenPartialBuilds[(x: int) -> int]] | type[HydraPartialBuilds[(x: int) -> int]]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:113:9 - information: Type of "conf_f_partial()" is "ZenPartialBuilds[(x: int) -> int] | HydraPartialBuilds[(x: int) -> int]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:118:17 - information: Type of "instantiate(conf_f_partial)" is "Partial[int]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:119:17 - information: Type of "instantiate(conf_f_partial_instance)" is "Partial[int]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:120:17 - information: Type of "instantiate(conf_f_partial)()" is "int"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:125:17 - information: Type of "builds(A, zen_partial=False)" is "type[Builds[type[A]]]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:127:17 - information: Type of "instantiate(conf_A_1)" is "A"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:130:9 - information: Type of "builds(f, zen_partial=False, expected_text="type[Builds[(x: int) -> int]]")" is "type[Builds[(x: int) -> int]]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:133:17 - information: Type of "instantiate(conf_f_1)" is "int"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:138:17 - information: Type of "builds(A)" is "type[Builds[type[A]]]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:140:17 - information: Type of "instantiate(conf_A_2)" is "A"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:142:17 - information: Type of "conf_A_2()" is "Builds[type[A]]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:144:17 - information: Type of "instantiate(conf_a_instance)" is "A"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:146:17 - information: Type of "builds(f)" is "type[Builds[(x: int) -> int]]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:148:17 - information: Type of "instantiate(conf_f_2)" is "int"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:159:17 - information: Type of "just(f)" is "Just[(x: int) -> int]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:160:17 - information: Type of "just(A)" is "Just[type[A]]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:161:17 - information: Type of "instantiate(just(f))" is "(x: int) -> int"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:162:17 - information: Type of "instantiate(just(A))" is "type[A]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:164:17 - information: Type of "just(1)" is "int"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:165:17 - information: Type of "just("hi")" is "str"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:166:17 - information: Type of "just(b"1234")" is "bytes"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:167:17 - information: Type of "just(1 + 2j)" is "ConfigComplex"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:168:17 - information: Type of "just(Path.home())" is "Path"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:169:17 - information: Type of "just(partial(f, 1))" is "Just[partial[int]]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:170:17 - information: Type of "just(set([1, 2, 3]))" is "Builds[type[set[int]]]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:171:17 - information: Type of "just(range(10))" is "Builds[type[range]]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:174:17 - information: Type of "partiald_f" is "partial[int]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:175:17 - information: Type of "partiald_f()" is "int"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:182:17 - information: Type of "just(B)" is "Just[type[B]]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:183:17 - information: Type of "just(B())" is "type[Builds[type[B]]]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:184:17 - information: Type of "just(B(), zen_convert={ "dataclass": False })" is "Any"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:195:17 - information: Type of "instantiate(SomeDataClass)" is "Any"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:196:17 - information: Type of "instantiate(some_dataclass)" is "Any"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:201:17 - information: Type of "get_target(builds(str))" is "type[str]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:202:17 - information: Type of "get_target(builds(str, zen_partial=False))" is "type[str]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:203:17 - information: Type of "get_target(builds(str, zen_partial=True))" is "type[str]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:204:17 - information: Type of "get_target(just(str))" is "type[str]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:207:17 - information: Type of "get_target(builds(f))" is "(x: int) -> int"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:209:9 - information: Type of "get_target(builds(f, zen_partial=False))" is "(x: int) -> int"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:212:9 - information: Type of "get_target(builds(f, zen_partial=True))" is "(x: int) -> int"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:214:17 - information: Type of "get_target(just(f))" is "(x: int) -> int"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:216:17 - information: Type of "get_target(builds(str)())" is "type[str]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:217:17 - information: Type of "get_target(builds(str, zen_partial=False)())" is "type[str]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:218:17 - information: Type of "get_target(builds(str, zen_partial=True)())" is "type[str]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:219:17 - information: Type of "get_target(just(str))" is "type[str]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:227:17 - information: Type of "A().x" is "List[int]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:237:17 - information: Type of "builds(str, zen_wrappers=f)" is "type[Builds[type[str]]]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:238:17 - information: Type of "builds(str, zen_wrappers=J)" is "type[Builds[type[str]]]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:239:17 - information: Type of "builds(str, zen_wrappers=B)" is "type[Builds[type[str]]]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:240:17 - information: Type of "builds(str, zen_wrappers=PB)" is "type[Builds[type[str]]]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:242:9 - information: Type of "builds(str, zen_wrappers=(None, ), expected_text="type[Builds[type[str]]]")" is "type[Builds[type[str]]]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:246:9 - information: Type of "builds(str, zen_wrappers=(f, J, B, PB, None))" is "type[Builds[type[str]]]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:251:9 - information: Type of "builds(str, zen_partial=True, zen_wrappers=f)" is "type[ZenPartialBuilds[type[str]]] | type[HydraPartialBuilds[type[str]]]"
-   /tmp/mypy_primer/projects/hydra-zen/tests/annotations/declarations.py:255:9 - information: Type of "builds(str, zen_partial=True, zen_wrappers=J)" is "type[ZenPartialBuilds[type[str]]] | type[HydraPartialBuilds[type[str]]]"

... (truncated 121 lines) ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants