Rich Chiodo
4897e993d5
Fix 'reportShadowedImports' link
...
Fixes https://github.com/microsoft/pylance-release/issues/3752
2022-12-12 09:51:37 -08:00
Eric Traut
5f48e39671
Exposed new configuration setting analyzeUnannotatedFunctions
which corresponds to the --skipunannotated
command-line option. Added an information diagnostic for skipped functions. This addresses https://github.com/microsoft/pyright/issues/4303 .
2022-12-08 20:05:32 -08:00
Steve C
fa75fd6556
Fix typo in
-> is
, in typed-libraries.md ( #4180 )
2022-11-10 17:51:04 -08:00
Rich Chiodo
04a1058378
20221121 ( #4174 )
2022-11-09 16:00:25 -08:00
Rich Chiodo
8c0ba8a78a
Show a warning when a stdlib module is being overridden ( #4132 )
...
* Working for simple cases
* Fix localize
* Move logic to source mapper
* Add support for the current file
* Add rename file command
* Fix comments
* Closer to getting tests to work. Rename added
* Rework how stdlib modules are found. Fix tests
* Do the rename without bringing up a dialog
* Fix tests and add docs
* Fix tests on unix
* Review feedback
* Default shadowed imports to off
* Missed spot for execEnv not needing to be passed
2022-11-04 16:45:16 -07:00
Ignacio Vergara Kausel
512df5e922
Update type-concepts.md ( #4099 )
...
Fixed typo in documentation.
2022-10-27 06:05:31 -07:00
Eric Traut
d5d27505ef
Updated types in documentation to use PEP 604 syntax.
2022-10-24 20:06:21 -07:00
Eric Traut
8538998719
Extended the defineConstant
mechanism to work with conditional statements that contain member access expressions that reference a defined member name. This addresses https://github.com/microsoft/pyright/issues/4060 .
2022-10-18 15:28:17 -07:00
Kwanghoon Choi
40d511fadc
Update type-concepts.md ( #4029 )
...
A fix to add a missing parameter to isinstance as:
- isinstance(val, Bar)
2022-10-09 23:24:19 -07:00
Erik De Bonte
f21d04f204
Editable install docs ( #4020 )
2022-10-07 11:44:33 -07:00
Eric Traut
4105b97749
Updated documentation for pre-commit hooks to eliminate confusion and point users to the pyright-python wrapper.
2022-09-03 11:58:28 -06:00
Eric Traut
285550c5ce
Updated configuration documentation to include reportUnnecessaryContains in the table.
2022-07-17 23:42:44 -07:00
Eric Traut
7f3e7b0d2e
Added support for new reportUnnecessaryContains
diagnostic rule to catch potential bugs in in
and not in
containment checks.
2022-07-17 23:29:50 -07:00
Eric Traut
04945a4309
Made tweak to documentation for clarity.
2022-06-23 08:34:18 -07:00
Keming
de86a34dd4
fix typo ( #3601 )
2022-06-21 19:08:37 -07:00
Eric Traut
4ae8b9233e
Made suggested improvements to documentation.
2022-06-18 23:00:11 -07:00
Eric Traut
055dc1296a
Updated comments documentation to talk about reportTypeCommentUsage diagnostic check.
2022-06-12 11:50:47 -07:00
Eric Traut
484faf7ba3
Added support for new reportTypeCommentUsage
diagnostic check. It flag the usage of # type: xxx
comments for functions and variables. These are still supported for backward compatibility, but they are increasingly irrelevant and will likely be deprecated in the next few years.
2022-06-09 21:00:47 -07:00
Eric Traut
794d151050
Added new configuration setting called "defineConstant". It allows a configuration to specify one or more identifiers that should be assigned by pyright's binder to be constant anywhere they appear. Values can be boolean (true or false) or a string. If an identifier of this value is used within a conditional statement (like if not DEBUG:
) it will affect pyright's reachability analysis for the guarded code blocks.
2022-06-08 22:01:33 -07:00
Eric Traut
f2328237d3
Extended the "X in Y" type narrowing to support dict
, defaultdict
and OrderedDict
classes.
2022-05-30 00:55:22 -07:00
Eric Traut
255497446a
Fixed bug in type narrowing logic for expressions of the form "X not in Y".
2022-05-29 23:54:15 -07:00
Eric Traut
21a67358df
Specified that node.js 14.x should be used.
2022-05-21 10:47:05 -07:00
Eric Traut
42ad212d8d
Added missing quotes in library documentation for __all__
statements.
2022-05-19 17:12:04 -07:00
Eric Traut
48c910d0e3
Added back git hook example for non-github users.
2022-05-19 16:04:32 -07:00
Eric Traut
4b65372d4a
Changed CI integration instructions to point to the pyright-action project.
2022-05-19 15:34:10 -07:00
Eric Traut
5840e3eb7c
Improved docs string for the --skipunannotated
command line option.
2022-05-18 15:29:06 -07:00
Eric Traut
8d5da97ba6
More doc improvements.
2022-05-08 11:12:37 -07:00
Eric Traut
9f08b64bcd
Added documentation for class and instance variables.
2022-05-08 11:09:48 -07:00
Eric Traut
3b5752431b
Extended type guard for discriminated literal fields to support properties.
2022-04-29 20:39:32 -07:00
Eric Traut
2c7bcc81e1
Updated library guidance to include a small section on positional-only parameters.
2022-04-15 21:42:42 -07:00
Eric Traut
ab1fbfc0d6
Enhanced reportUnnecessaryComparison diagnostic check so it also detects cases where a function appears within a condition expression. This is a common source of programming error.
2022-04-10 23:33:41 -07:00
Eric Traut
8660a6f870
Added support for type guard based on a.b is None
or a.b is not None
patterns where b
is a member variable that distinguishes two different classes. ( #3273 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com>
2022-04-01 11:06:53 -07:00
Eric Traut
d1e5c924bd
Revert "Add support for type narrowing of NamedTuple fields with "is None" ( #3271 )"
...
This reverts commit e296cd58ee
.
2022-03-29 20:02:54 -06:00
Kevin Coffey
e296cd58ee
Add support for type narrowing of NamedTuple fields with "is None" ( #3271 )
...
* Add support for type narrowing of NamedTuple fields with is None.
* Add description for `x.y is None` narrowing
Fix capitalization for filename of sample in test.
2022-03-29 19:59:55 -06:00
Eric Traut
189f0314bb
Another attempt at formatting
2022-03-20 14:35:38 -06:00
Eric Traut
fadeea36b4
Updated diagnostic rule table so it groups basic and strict diagnostics.
2022-03-20 14:34:42 -06:00
Eric Traut
d28c481535
Added new diagnostic check reportUnusedExpression
to catch bugs like a == 4
when a = 4
was intended.
2022-03-13 15:25:18 -06:00
Eric Traut
77dc80f48a
Clarified the role of __all__
in the libraries documentation.
2022-03-11 18:11:55 -07:00
Eric Traut
2aeac06f5e
Updated comments doc to talk about reportUnnecessaryTypeIgnoreComment.
2022-03-11 17:55:20 -07:00
Eric Traut
4cbd352d39
Added support for per-line suppression of diagnostics using # pyright: ignore
comment. This also supports rule-specific suppression using a list of diagnostic rules, as in # pyright: ignore [reportGeneralTypeIssues]
.
2022-03-11 09:47:41 -07:00
Eric Traut
a4900ebd03
Extended support for narrowing of index expressions to include those with negative subscripts, such as a[-1]
. This is supported for all supported type guard patterns.
2022-03-05 01:35:17 -07:00
Eric Traut
faecce31ad
Updated library guidance to clarify that submodules under a private module are also considered private.
2022-03-04 17:52:51 -07:00
Eric Traut
c9b9676e21
Updated package type verifier to differentiate between "unknown" and "ambiguous" types.
2022-02-24 15:12:36 -07:00
Eric Traut
c061adb5b8
Fixed typo in documentation.
2022-02-22 16:01:28 -07:00
Eric Traut
450524d004
Added support for parameter type inference based on annotated base class method signatures and on default argument expressions.
2022-02-22 12:42:14 -07:00
Eric Traut
dc24fab779
Changed strictParameterNoneValue
to default to true rather than false. This reflects the updated guidance in PEP 484, which indicates that type checkers should not assume that a default argument of None
should imply an Optional
type.
2022-02-21 17:54:31 -07:00
Eric Traut
4d75f59065
Fixed typo in documentation.
2022-02-19 14:11:16 -07:00
Eric Traut
92b4028cd5
Changed the behavior of the package type verifier so it does not flag unannotated class or instance variables if a parent class provides a type annotation for a variable of the same name. The type is inherited in this case. Also updated the library guidance to reflect this change.
2022-02-11 10:25:48 -08:00
Jelle Zijlstra
3cc4e6ccdd
Document reveal_type() and reveal_locals() ( #2996 )
...
reveal_locals() was not documented anywhere, which may be part of why so few people know about it.
Happy to put this somewhere else if you prefer.
2022-02-05 19:21:30 -08:00
Eric Traut
94db5376c1
Added the ability to add new symbols to builtins
by simply adding a type stub file named __builtins__.pyi
locally.
2022-02-02 19:27:12 -08:00
Eric Traut
10a122ccd6
Fixed error in documentation for reportInvalidTypeVarUse.
2022-01-29 07:54:18 -08:00
Eric Traut
6776c0ce86
Fixed bug in documentation for reportMissingImports.
2022-01-29 00:05:40 -08:00
Eric Traut
a03acb0f41
Changed import resolution order to more closely match PEP 561. Typeshed stdlib type stubs are now resolved later in the import resolution process, after all local modules and modules within the python environment.
2022-01-27 22:57:30 -08:00
Eric Traut
b69843cf03
Updated type inference documentation to eliminate a statement that was leading to some confusion.
2022-01-27 13:20:55 -08:00
Eric Traut
b740ddfae5
Added new diagnostic check "reportMatchNotExhaustive" which reports cases where a match
statement doesn't exhaustively cover all cases.
2022-01-23 12:49:27 -08:00
Eric Traut
da81cdf22f
Updated documentation to cover the new # pyright: basic
comment.
2022-01-19 12:53:07 -08:00
Eric Traut
163ef21c3c
Changed "reportMissingSuperCall" to be off by default in strict mode.
2022-01-14 14:13:49 -08:00
Eric Traut
62ac83694e
Implemented a new diagnostic check "reportMissingSuperCall" that checks for __init__
, __init_subclass__
, __enter__
and __exit__
methods that fail to call through to their parent class(es) methods of the same name. This is a common source of bugs. The check is disabled by default in basic mode but enabled by default in strict mode.
2022-01-14 11:55:23 -08:00
Eric Traut
4934e906d5
Added new diagnostic check reportInconsistentConstructor
that checks for inconsistent input signatures between __new__
and __init__
methods.
2022-01-12 11:31:33 -08:00
Eric Traut
f9f4c34b5e
Added new diagnostic check reportUnnecessaryTypeIgnoreComment
that emits a diagnostic when a # type: ignore
comment has no effect.
2022-01-09 11:16:22 -07:00
Eric Traut
17f37a2482
Fixed a typo in the documentation.
2022-01-06 13:02:31 -07:00
Eric Traut
130c1cc055
Changed type guard logic that involves is
operator and literals to be limited to bool
and enum literals. It was making unsafe assumptions for other forms of literals.
2022-01-06 09:13:05 -07:00
Eric Traut
4fe3f1f7c0
Improved type narrowing for x == L
pattern to include x is L
, since they are equivalent. Likewise, extended x.y == L
pattern to include x.y is L
.
2022-01-05 15:19:37 -07:00
Eric Traut
c09480adb7
Updated CI script to make it clear that the latest pyright version should be used.
2022-01-03 17:43:08 -07:00
Eric Traut
d74b89a758
Added support for new type narrowing pattern: len(x) == L
and len(x) != L
where x
is a tuple or union of tuples and L
is a literal integer value.
2022-01-01 13:31:10 -07:00
Eric Traut
046eab4a8d
Added support for bool(x)
type guard.
2021-12-31 14:23:56 -07:00
Eric Traut
2f616204d9
Added documentation for pyright's overload matching algorithm.
2021-12-13 15:00:17 -08:00
Eric Traut
211ebe44dd
Changed class pattern matching behavior to support narrowing of Any
or Unknown
, exempting this case from the general "never narrow Any" rule.
2021-12-12 14:54:59 -08:00
Eric Traut
50b31d533f
Improved documentation.
2021-12-10 00:06:35 -08:00
Eric Traut
c5788d4916
Implemented support for type guards that are based on a local variable that is assigned an expression that narrows the type of the assigned expression. Some limitations apply. For details, refer to https://github.com/microsoft/pyright/blob/main/docs/type-concepts.md#narrowing-based-on-local-variable .
2021-12-09 23:56:44 -08:00
Eric Traut
e267b8adec
Improved handling of x in y
type guard to handle the case where y
is a tuple.
2021-12-08 00:17:46 -08:00
Eric Traut
7e59a19eaa
Updated library guidance doc to clarify point of confusion about import forms.
2021-12-01 08:57:29 -08:00
Eric Traut
28d60e62ae
Updated command-line documentation for consistency.
2021-11-29 22:31:14 -08:00
Jos Verlinde
8d32784230
extend documentation on JSON ( #2635 )
...
copying the information provided as answer to https://github.com/microsoft/pyright/issues/2634
2021-11-29 13:20:41 -08:00
Eric Traut
ed84eb7b36
Changed reportPropertyTypeMismatch to be disabled by default in all diagnostic modes.
2021-11-27 17:08:01 -08:00
Eric Traut
280d95cd80
Updated documentation for reportUnusedVariable.
2021-11-24 16:05:53 -08:00
Elijah K
c70cee87ea
Update configuration.md ( #2519 )
...
Links the description of the `executionEnvironment` option. Would have partially prevented a question in #2518 .
2021-10-30 11:09:25 -07:00
Eric Traut
cc7216e66e
Changed text representation of inferred type of self
and cls
parameters to Self@ClassName
. This is more consistent with the emerging standard for an explicit Self
type.
2021-10-29 21:21:32 -07:00
Eric Traut
ef773d2407
Added "--skipunannotated" option for command-line version of pyright. If specified, pyright skips type analysis of functions and methods that have no parameter or return type annotations. Return types of functions are also never inferred from the function implementation. This matches the default behavior of mypy and allows for more efficient analysis of complex code bases that are only partially annotated.
2021-10-22 23:17:29 -07:00
Eric Traut
3fbb23a5c4
Fixed typo in command-line docs.
2021-10-15 10:01:29 -07:00
Eric Traut
5f0317229c
Updated documentation for pythonPlatform to include "All".
2021-10-15 09:43:28 -07:00
Eric Traut
9976ff0436
Fixed a misleading statement in the documentation about the strict
config setting.
2021-10-14 14:56:49 -07:00
Eric Traut
38bd56b130
Clarified directory for tests
2021-10-12 00:10:29 -07:00
Eric Traut
06c69907fe
Added instructions for running tests.
2021-10-12 00:06:34 -07:00
Eric Traut
1cbb690b11
Added support for new type guard pattern: x[I] is None
and x[I] is not None
where x
is a tuple or union of tuples with known lengths and entry types and I
is an integer.
2021-10-06 22:48:14 -07:00
Eric Traut
ff55b895f9
Added new diagnostic check "reportMissingParameterType" that checks for function and method input parameters that are missing a type annotation.
2021-10-06 21:55:12 -07:00
Eric Traut
6107de9090
Added new "--warnings" command-line option that generates an exit code of 1 if one or more warnings are emitted. By default, only errors generate an exit code of 1.
2021-10-06 20:12:15 -07:00
Eric Traut
dbe41fa4d2
Made a few small improvements to the documentation.
2021-09-26 12:10:05 -07:00
Eric Traut
3fa5299614
Changed code that converts types to textual representation to prepend a tilde ("~") character for the inferred type of a "self" or "cls" parameter.
2021-09-24 20:01:48 -07:00
Eric Traut
14ad02575f
Extended reportCallInDefaultInitializer diagnostic check to disallow list, set or dict expressions in default argument expression.
2021-09-16 21:22:31 -07:00
Eric Traut
9035f64c71
Added reportPrivateImportUsage diagnostic rule, which reports usage of a symbol from a py.typed library that is not intended to be re-exported by the library's author. The rule is on by default in basic type checking mode but can be disabled. Completion provider no longer offers these symbols as completion suggestions.
2021-09-12 01:10:57 -07:00
sasano8
a1ebf82bb8
Ambiguous tuples become as specific as possible. ( #2291 )
...
The rationale is as follows.
>Tuple Expressions
>When inferring the type of a tuple expression (in the absence of bidirectional inference hints), Pyright assumes that the tuple has a fixed length, and each tuple element is >typed as specifically as possible.
```python
# The inferred type is Tuple[Literal[1], Literal["a"], Literal[True]]
var1 = (1, "a", True)
def func1(a: int):
# The inferred type is Tuple[int, int]
var2 = (a, a)
# If you want the type to be Tuple[int, ...]
# (i.e. a homogenous tuple of indeterminate length),
# use a type annotation.
var3: Tuple[int, ...] = (a, a)
```
2021-09-10 12:27:42 -07:00
Kyle Kovacs
ad0e8acf14
Add missing strictSetInference
option to table ( #2263 )
...
The `strictSetInference` row was missing from the Diagnostic Rule Defaults table.
2021-09-03 15:44:28 -07:00
Eric Traut
2202af33a7
Improved readability of docs.
2021-08-30 09:44:14 -07:00
Omer Tuchfeld
9edf6d2d1a
Fix docs/configuration.md misleading case sensitive Pyproject.toml
typo ( #2238 )
...
Creating `Pyproject.toml` as it is currently shown in the docs title will not work,
because the file name is case sensitive. It should be exactly `pyproject.toml`
2021-08-28 07:37:25 -07:00
Denis Eliseev
475a44273c
Update type-concepts.md ( #2230 )
2021-08-26 08:33:12 -07:00
Eric Traut
0bf45ea2ed
Added support for new type narrowing pattern for discriminating among tuples. The pattern is V[I] == L
or V[I] != L
where I
is an integer literal, L
is another literal value, V
is a tuple with a known length and a type at index I
that is declared as a literal type.
2021-08-06 23:17:21 -07:00
Eric Traut
f842817006
Updated docs for reportUnsupportedDunderAll.
2021-07-17 09:41:29 -06:00
Eric Traut
295db6af56
Disabled reportUnitializedInstanceVariable in strict mode, as intended.
2021-07-14 16:46:21 -06:00
Eric Traut
2156f2eb73
Implemented "reportUninitializedInstanceVariable" diagnostic check that looks for instance variables that are not initialized in the class body or constructor.
2021-07-14 16:13:49 -06:00
Eric Traut
845764c5ae
Modified reportUnnecessaryIsInstance
diagnostic to never report always-false conditions because the type checker no longer generates such conditions.
2021-07-03 10:03:49 -06:00
Eric Traut
c23d563a17
Took another swing at making the markdown processor in github do what I want in the typed-libraries documentation.
2021-06-22 10:01:50 -07:00
Eric Traut
bf66ff22c5
Fixed a few typos and formatting issues in typed-libraries documentation.
2021-06-22 10:00:30 -07:00
Eric Traut
0440272219
Added support for type narrowing conditional expressions of the form a is False
, a is True
, a is not False
and a is not True
.
2021-06-18 17:01:59 -07:00
Eric Traut
562a6b4848
In basic type checking mode, enabled the following diagnostic checks by default: reportOptionalSubscript, reportOptionalMemberAccess, reportOptionalCall, reportOptionalIterable, reportOptionalContextManager, and reportOptionalOperand.
2021-06-16 18:43:58 -07:00
Arnav Jindal
68a0cb85e0
Update command-line.md to emphazise flags with arguments ( #1980 )
...
* Update command-line.md
* Update command-line.md
* Update command-line.md
2021-06-12 09:20:57 -07:00
Yuichi Tateno (secon)
e09560c3ea
Fixing wrong type int
to str
of type-concepts.md ( #1958 )
2021-06-07 15:53:48 -07:00
Eric Traut
0f9d308827
Added documentation for conditional types reported with "*".
2021-05-29 15:43:09 -07:00
Eric Traut
eced7b57bd
Added support for "tagged union" type narrowing when the conditional expression is of the form x[K] == V
or x[K] != V
where x
is a union of TypedDict objects and K
is a literal str key value that refers to a field with a literal type and V
is a literal value.
2021-05-23 23:38:04 -07:00
Eric Traut
c52c928e66
Added type narrowing support for index expressions where the index value is a string literal.
2021-05-23 23:03:05 -07:00
Eric Traut
186e444652
Added new diagnostic rule "reportIncompleteStub", which reports a diagnostic for a module-level __getattr__
function in a type stub, indicating that it's incomplete. This check was previously part of the "reportUnknownMemberType" diagnostic rule.
2021-05-15 19:23:25 -07:00
Jake Bailey
893d08be8c
Update everything for main branch rename
2021-05-13 13:26:44 -07:00
Eric Traut
320a0a2fd3
Updated documentation to indicate that some forms of subscripts are supported in type guards.
2021-04-29 08:20:19 -07:00
Eric Traut
69a0c5594a
Added support for pyproject.toml files.
2021-04-20 21:51:39 -07:00
Steve Rice
bda2a94294
Update command line directions with new output format ( #1749 )
...
Since ba901d1449 (diff-c3f0fa903325059f6e7dda1116458aafa72061ac3d1a51ddfd077a5dc0801030R394)
, the `--outputjson` result schema has changed.
2021-04-08 17:36:48 -07:00
Eric Traut
27fb622a5e
Implemented new diagnostic rule "reportUnnecessaryComparison". It checks for "==" and "!=" comparisons where the LHS and RHS types have no overlap and the LHS has no __eq__
overload. This new diagnostic rule is off by default in normal type checking mode but is on in strict mode.
2021-04-08 16:32:08 -07:00
Eric Traut
4f03ba88c0
Added configuration option "strictSetInference" which is analogous to "strictListInference" and "strictDictionaryInference" but specifically for set expressions.
2021-04-03 08:35:40 -07:00
karthickeyan
3b5a6d1a02
Update configuration.md ( #1707 )
...
Fixing a typo in "extraPaths" of configuration.md document
2021-03-31 10:34:48 -07:00
Andrew Grangaard
9f544885bc
fix typo in settings documentation. ( #1699 )
2021-03-29 20:21:32 -07:00
Eric Traut
ea8628909a
Added "reportTypedDictNotRequiredAccess" diagnostic rule and split out diagnostics that pertain specifically to unguarded accesses to non-required TypedDict keys.
2021-03-27 09:28:28 -07:00
Eric Traut
e5714b3365
Added smarter handling of empty lists ([]
) and dicts ({}
). Previously, these were inferred to have types list[Unknown]
and dict[Unknown, Unknown]
, respectively. They are now provided with a known type if the variable is assigned a known list or dict type along another code path.
2021-03-24 13:50:59 -07:00
Eric Traut
cb4aad13dc
Added new top-level "extraPaths" config option for pythonconfig.json that specifies the default extraPaths to use when no execution environments apply to a file. Changed settings logic to use the new default extraPaths mechanism for the "python.analysis.extraPaths" setting. ( #1632 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com>
2021-03-15 17:43:31 -07:00
Eric Traut
b86718ed0d
Fixed example configuration in documentation.
2021-03-10 08:01:50 -08:00
Eric Traut
09cb091fe9
Removed support for "venv" entry in execution environments since this never really worked. Clarified in documentation that import resolution within an execution environment is not transitive.
2021-03-09 18:19:36 -08:00
Eric Traut
9ac028e7ab
Fixed bug in sample code for documentation.
2021-03-07 09:12:54 -08:00
Eric Traut
ee2b18986e
Added more documentation for "implied else narrowing".
2021-03-07 09:12:06 -08:00
Eric Traut
adabd54bf8
Changed reportOverlappingOverload to be an error in strict mode.
2021-03-05 09:23:23 -07:00
Eric Traut
acdefc550c
Updated documentation on type narrowing to cover "Narrowing for Implied Else".
2021-03-05 09:07:26 -07:00
Eric Traut
af4426c4d6
Clarified default value for reportOverlappingOverload setting in docs.
2021-03-04 17:48:45 -07:00
Eric Traut
a192486099
Renamed "--ignore-external" to "--ignoreexternal" for consistency. Removed undocuemented "!" mechanism for invoking this functionality.
2021-03-03 00:51:18 -07:00
Vlad Emelianov
dc7382d52f
Add --ignore-external CLI flag ( #1564 )
...
Co-authored-by: Eric Traut <eric@traut.com>
2021-03-03 00:42:37 -07:00
Eric Traut
e6f8dbf4fa
Implemented command-line switches for pythonplatform and pythonversion. These are overridden by pyrightconfig.json settings. ( #1529 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com>
2021-02-23 17:05:13 -07:00
Eric Traut
36d499cada
Further clarified in the typed libraries docs that “from .A import X” form is honored only in “__init__.py”.
2021-02-23 01:10:51 -07:00
Eric Traut
b5017de462
Updated typed library documentation to explicitly mention import statements of the form “from . import A” and “from .A import X”.
2021-02-23 01:02:15 -07:00
Eric Traut
68fca4eab6
Added "reportOverlappingOverload" diagnostic rule, splitting out a few checks that were previously in the "reportGeneralTypeIssue" rule. This allows for finer-grained control over these overload checks.
2021-02-20 09:28:57 -07:00
Richard Höchenberger
2e1b01f866
Fix typo in import ( #1476 )
2021-02-12 07:03:58 -08:00
Eric Traut
36c168c1ae
Changed the reportUnboundVariable
default severity from "warning" to "none" when typeCheckingMode is "off". There were too many complaints of false positives from users who have no interest in type checking.
2021-02-05 21:57:48 -08:00
Eric Traut
77410d86e5
Updated typing guidance for libraries documentation based on @JelleZijlstra's feedback.
2021-02-02 20:54:00 -08:00
Simon Hawkins
0977764a7e
Update typed-libraries.md ( #1369 )
...
Fixed minor typos in documentation.
2021-01-13 16:55:27 -08:00
Eric Traut
3dc83c0b1a
Fixed minor typos in documentation.
2021-01-06 07:38:29 -08:00
Eric Traut
d6206e6b61
Updated git hook to refer to a more recent version of pyright.
2021-01-03 16:11:16 -08:00
Eric Traut
f9db4dcc8a
Updated README to refer to PEP 647.
2021-01-03 12:13:20 -08:00
Alexey Shamrin
ec7bf81cb8
correct useLibraryCodeForTypes CLI argument ( #1322 )
2020-12-28 07:46:39 -08:00
Eric Traut
51387b95cd
Added documentation for the default severity levels for each type checking mode (off, basic and strict).
2020-12-27 21:50:35 -08:00
Eric Traut
fb4a4e92bd
Added new diagnostic rule "reportUnusedCoroutine" that reports an error if the result returned by an async function is not consumed (awaited, assigned to a variable, etc.). This detects and reports a common error when using async coroutines.
2020-12-26 22:30:49 -08:00
Eric Traut
b1d9ab7002
Added a new diagnostic rule called "reportInvalidTypeVarUse" that flags errors when TypeVars are used incorrectly. In particular, it flags the use of a single instance of a TypeVar within a generic function signature.
2020-12-11 22:28:19 -08:00
Eric Traut
cf1a5790d2
Implemented new diagnostic rule reportUnusedCallResult that checks whether a call expression's results are consumed. If the results are None or Any, no diagnostic is produced.
2020-11-25 19:50:31 -08:00
Eric Traut
a44e254c32
Added support for new reportUnsupportedDunderAll diagnostic rule. It checks for unsupported manipulations of __all__
.
2020-11-25 16:07:59 -08:00
Eric Traut
1601a177cd
Added new diagnostic rule "reportFunctionMemberAccess" that reports an attempt to access, set or delete non-standard attributes of function objects.
2020-11-19 17:19:22 -08:00
Eric Traut
8cb9bfca41
Updated out-of-date information in type-stubs.md documentation.
2020-11-17 17:47:17 -08:00
Eric Traut
258202af72
Added more documentation about type narrowing and type guards.
2020-11-11 14:54:37 -08:00
Eric Traut
5e5e55449e
Changed re-export logic for type stub and py.typed modules to honor the clarification that was recently added to PEP 484. Previously, any import that used an "as" clause was considered to be re-exported. Now, symbols are re-exported only if the "as" clause is redundant (i.e. it is of the form import A as A
or from A import X as X
).
2020-11-01 08:54:09 -08:00
Eric Traut
9046794205
Removed recently-added "reportInvalidTypeVarUse" diagnostic rule and associated checks. After further discussion, we decided that there are legitimate cases where a TypeVar can appear only once in a function signature.
2020-10-21 09:59:36 -07:00
Eric Traut
bb04ffa6be
Added new diagnostic rule "reportInvalidTypeVarUse" that controls reporting of TypeVars that appear only once in a function signature. By default it is off in basic type checking mode but on in strict mode.
2020-10-19 13:30:06 -07:00
Eric Traut
246ff993e7
Fixed bug in decorator annotation documentation.
2020-10-14 20:14:08 -07:00
Eric Traut
57175e8d3a
Did another editing pass on the typed library documentation for readability and consistency.
2020-10-02 23:56:37 -07:00
Eric Traut
af01be3244
Fixed documentation for building pyright.
2020-10-02 11:00:26 -07:00
Eric Traut
b2882fd6be
Added support for the __all__ += <module>.__all__
idiom for mutating the __all__
value. This idiom is used by numpy.
2020-10-02 10:55:24 -07:00
Eric Traut
05cdaf9344
Added missing section on type aliases within typed library documentation.
2020-09-29 15:16:48 -07:00
Eric Traut
67e94f4c8a
Fixed markdown rendering issue in docs.
2020-09-29 15:04:51 -07:00
Eric Traut
1cb2a3a950
Added detailed documentation for the "--verifytypes" option.
2020-09-29 15:03:14 -07:00
Eric Traut
dc5cd387fc
Implemented new "verifytypes" command-line option that analyzes a py.typed package and reports missing or partially-unknown types.
2020-09-28 14:49:32 -07:00
Eric Traut
b6cd5eedae
Fixed missing JSON field in command-line documentation.
2020-09-28 14:34:29 -07:00
Eric Traut
5d44a7e35d
Updated import resolution documentation to accurately reflect recent changes related to py.typed packages.
2020-09-23 14:20:23 -07:00
Eric Traut
6378f7761f
Changed reveal_type to use an information diagnostic severity rather than warning. Added support in CLI for information diagnostic severity. These were previously dropped.
2020-09-16 10:11:30 -07:00
Eric Traut
006f5d60d1
Changed python.analysis.logLevel to use "Information" rather than "Info" for consistency with Python extension.
2020-09-14 14:44:18 -07:00
Eric Traut
f72711b07b
Added support for new "reportWildcardImportFromLibrary" diagnostic rule that checks for the use of wildcard imports from non-local modules. By default, it is reported as a warning, but in strict mode it is an error.
2020-09-12 20:31:25 -07:00
Eric Traut
6356575664
Changed the behavior of the command-line version of pyright when file specs are passed on the command line. Previously, file specs couldn't be used in conjunction with a config file. Now a config file is used, but the specified file specs override the "include" section of the config file.
2020-09-11 00:27:57 -07:00
Eric Traut
cea376e59b
Added new diagnostic rule "reportPropertyTypeMismatch" that verifies that the type of the input parameter to a property's setter is assignable to the return type of the getter.
2020-09-05 14:55:12 -07:00
Eric Traut
0a65625e03
More documentation improvements.
2020-09-04 14:51:40 -07:00
Eric Traut
4fa40fba75
Minor tweak to documentation.
2020-09-04 14:32:38 -07:00
Eric Traut
6591dafce0
Documented the JSON output when "--outputjson" command-line option is used.
2020-09-04 14:30:14 -07:00
Jake Bailey
9e231b1292
Extensibility updates in threading and fourslash, add completion context ( #995 )
2020-09-02 19:01:49 -07:00
Eric Traut
9e46548fc5
Added new "reportMissingTypeArgument" diagnostic rule and enabled it by default in "strict" mode. It generates a diagnostic when a generic class or generic type alias is used in an annotation with no type arguments provided. Also fixed a bunch of inaccurate settings defaults in pyright's package.json.
2020-09-01 15:59:31 -07:00
Jake Bailey
da39a2a78a
Convert repo into a lerna monorepo, add a validation workflow ( #978 )
2020-08-28 19:46:48 -07:00
Eric Traut
295a6dd306
Changed capitalization of the python.analysis.logLevel setting so it matches Pylance. The settings code in Pyright is case insensitive, but the JSON editor emits a warning if the case doesn't match.
2020-08-20 09:17:32 -07:00
Eric Traut
07001963c2
Fixed documentation bug.
2020-08-15 16:14:04 -07:00
Eric Traut
605bcc482c
Added support for narrowing types based on the pattern "A.B == <literal>" and "A.B != <literal>" when A has a union type and all members of the union have a field "B" with a declared literal type that discriminates one sub-type from another.
2020-08-15 16:11:23 -07:00
Eric Traut
b59542c6ed
Improved command-line documentation to clarify that individual files specified on the command line will cause the config file to be ignored.
2020-08-14 23:07:23 -07:00
Eric Traut
9e1a67c418
Added more documentation about type concepts relating to mutable container types.
2020-08-12 12:29:13 -07:00
Eric Traut
7808935fa7
Added support for "useLibraryCodeForTypes" option in config file. It overrides the client setting of the same name or the "--lib" command-line option.
...
Fixed several bugs in logging for config errors.
2020-08-10 11:28:50 -07:00
Jake Bailey
b89504d593
Add python.analysis.autoImportCompletions to control auto-import completions ( #917 )
2020-08-05 16:00:11 -07:00
Eric Traut
109e2dfd71
Added new diagnostic rule "reportInvalidStubStatement" (on by default in strict mode, off otherwise) that reports diagnostics for statements that should not appear within a type stub file.
2020-08-04 22:02:56 -07:00
Eric Traut
997fd7d57c
More docs improvements.
2020-08-02 14:50:14 -07:00
Eric Traut
c7dfba390d
More docs improvements.
2020-08-02 14:48:48 -07:00
Eric Traut
b7ae207558
Small improvements to documentation.
2020-08-02 14:20:07 -07:00
Eric Traut
2ade4f0aeb
Removed redundant documentation from configuration.md.
2020-07-30 18:52:17 -07:00
Eric Traut
63c9b5b691
Fixed a few typos in the inference documentation.
2020-07-27 21:03:20 -07:00
Eric Traut
f844bd2f1c
Added new diagnostic rule "reportIncompatibleVariableOverride" which is similar to "reportIncompatibleMethodOverride" except that it reports incompatible overrides of variables (non-methods).
2020-07-26 10:32:21 -07:00
Eric Traut
dcfcd09a1e
Updated CI docs.
2020-07-22 21:54:10 -07:00
Joe Paris
36e4fb3a30
Fixed typo ( #876 )
...
Fixed minor typo on line 33.
2020-07-22 17:45:07 -07:00
Eric Traut
2002520d0b
Moved CI documentation to its own page.
2020-07-22 16:55:50 -07:00
Eric Traut
d687708503
Updated "getting started" documentation to include an example git hook definition.
2020-07-22 16:53:34 -07:00
Eric Traut
0cb83d36c8
Renamed setting "pyright.useLibraryCodeForTypes" to "python.analysis.useLibraryCodeForTypes" for compatibility with Pylance. The older setting name is still supported but will be removed in the future.
2020-07-16 15:58:09 -07:00
Eric Traut
3581910469
Improved documentation for useLibraryCodeForTypes setting.
2020-07-16 15:49:16 -07:00
Eric Traut
579fb7be69
Fixed an outdated statement in the configuration documentation.
2020-07-16 10:09:43 -07:00
Eric Traut
838b293a4f
Small improvements to type inference documentation.
2020-07-15 00:26:02 -07:00
Eric Traut
531ebc4694
Added documentation for type inference.
2020-07-14 23:02:50 -07:00
Eric Traut
c80b8af3aa
Updated "getting started" docs.
2020-07-11 14:40:01 -07:00
Eric Traut
5e4cbeca63
Fixed a few markdown issues in import resolution documentation.
2020-07-11 14:00:20 -07:00