Eric Traut
d3398850c4
Fixed documentation for class and instance variable overrides.
2023-11-28 13:21:16 -08:00
Eric Traut
5b3523ff53
Added support for parameter type inference for lambdas whose parameters include default arguments. This is analogous to the logic used for unannotated function parameters with default arguments. This addresses #6558 . ( #6563 )
2023-11-27 17:51:31 -08:00
Eric Traut
e4197c3c2b
Updated import resolution documentation to cover a case that was previously not mentioned in the docs. This addresses #6415 .
2023-11-10 18:28:46 -08:00
Eric Traut
73ec51cb37
Updated docs to further de-emphasize "venv" config option.
2023-11-07 07:44:30 -08:00
Eric Traut
a48b5fed1b
Marked PEP 702 as no longer "draft" since it was accepted.
2023-11-07 07:26:42 -08:00
Eric Traut
08a295a261
Added support for python.analysis.include
, `python.analysis.exclude… ( #6251 )
...
* Added support for `python.analysis.include`, `python.analysis.exclude` 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 .
* Removed references to pylance in the help text.
2023-10-29 08:54:14 -07:00
Eric Traut
eee32c3c92
Updated documentation to add PEP 705.
2023-10-23 10:07:16 -07:00
Eric Traut
012dc1c182
Extended the len(x) == L
type guard logic to support arbitrary expressions L
that evaluate to a literal int type. This addresses #6216 . ( #6219 )
2023-10-21 12:09:19 -07:00
Eric Traut
b360d00ada
Updated docs based on a recent change in mypy.
2023-10-21 11:42:54 -07:00
Eric Traut
db8fb3d60c
Improved documentation for overload matching.
2023-10-16 13:19:38 -07:00
Eric Traut
a6f27a5dc8
Added PEP 724 to supported PEPs list in the documentation.
2023-10-13 20:11:14 -07:00
Erik De Bonte
4137f0ca43
Docs could be clearer about which .pth
files work in editable install scenarios ( #6079 )
2023-10-03 16:37:00 -07:00
klezm
851571c10f
Adds default value for reportImplicitOverride to docs/configuration.md ( #6056 )
2023-10-02 07:43:24 -07:00
Eric Traut
fe1e16ec1e
Added a new configuration switch disableBytesTypePromotions
that controls whether bytearray
and memoryview
should be implicit subtypes of bytes
. This switch defaults to false in basic type checking mode and true in strict mode. Eventually, we will probably have it default to true in all modes. ( #6024 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com>
2023-09-25 12:00:40 -07:00
Eric Traut
66bf443e1c
Updated documentation to reflect recent addition to mypy functionality.
2023-08-28 08:10:28 -07:00
Eric Traut
9cce48b6e3
Updated mypy comparison documentation. This addresses #5818 .
2023-08-26 07:45:35 -07:00
Eric Traut
4474b7d36b
Added a new configuration option deprecateTypingAliases
that enables deprecation detection and reporting for symbols imported from the typing
module that are deprecated according to PEP 585 and 604. The option is currently disabled by default (even in strict mode) but can be enabled manually. This addresses #3598 . ( #5812 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com>
2023-08-25 11:17:37 -07:00
Eric Traut
e2cf85f24c
Updated mypy comparison to reflect the fact that mypy's support for ParamSpecs now supports overloaded functions.
2023-08-21 11:04:30 -07:00
Eric Traut
050a3c6cea
Fixed a bug in the command-line version of pyright where it did not enable "auto search paths", so it didn't automatically add "src" as an extra path. This addresses https://github.com/microsoft/pyright/issues/4771 .
2023-07-31 23:27:45 -06:00
Eric Traut
3f7c20213d
Documented the difference between mypy's and pyright's handling of None
return type.
2023-07-30 10:41:23 -06:00
Eric Traut
501681295b
Modified type inference logic so methods that raise an exception whose type derives from NotImplementedError
is not inferred to return NoReturn
. Previously, only NotImplementedError
was exempted, not subclasses. This addresses https://github.com/microsoft/pyright/issues/5608 . ( #5609 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com>
2023-07-29 22:45:10 -06:00
Eric Traut
d81ffb7b5c
Added a new configuration options flag called enableExperimentalFeatures
that controls whether certain experimental features are enabled. Currently there are three features under this flag: StrictTypeGuard
, ReadOnly
fields for typed dicts, and inlined TypedDict
definitions. This addresses https://github.com/microsoft/pyright/issues/5598 .
2023-07-28 22:22:08 -06:00
Eric Traut
9fd63fea86
Fixed small typo in documentation.
2023-07-26 21:57:51 -06:00
Eric Traut
a34eb58fc9
Added section on plugins to the comparison with mypy.
2023-07-22 08:25:37 -07:00
Eric Traut
99dfe982a1
Added documentation about overloads and ParamSpec.
2023-07-22 07:23:43 -07:00
Eric Traut
19194dd089
Fixed an inconsistency in reporting of unbound variables when the variable is captured by an inner scope. The new behavior correctly identifies unbound (or potentially unbound) variables in cases where the captured variable is narrowed. This happens when there are no assignments to the variable after it is captured. This addresses #5548 . ( #5551 )
...
Fixed a bug in type narrowing for captured variables. Captured variables that are modified in other scopes using a `nonlocal` or `global` binding should be ineligible for type narrowing.
Co-authored-by: Eric Traut <erictr@microsoft.com>
2023-07-20 21:08:53 -07:00
Eric Traut
98fcba13dd
Added support for the X is C
and X is not C
type guard pattern (where C
is a class). This addresses #5490 . ( #5544 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com>
2023-07-19 20:28:55 -07:00
Eric Traut
6a25a7bf0b
Removed the requirement that a TypedDict
be marked @final
for it to be considered for type narrowing as part of a S in D
type guard pattern. This requirement wasn't sound because TypedDict is a structural type (i.e. a protocol), so @final
doesn't have any real meaning.
2023-07-17 08:01:52 -07:00
Eric Traut
0a67c65bef
Clarified in documentation that no_type_check
is not supported.
2023-06-30 08:39:10 +02:00
Eric Traut
c767228a82
Improved documentation for "implied else" type narrowing.
2023-06-29 01:28:19 +02:00
Eric Traut
5568b4dc95
Enhanced command-line version of pyright to allow file or directory names to be passed via stdin if -
option is used in the command line. This addresses https://github.com/microsoft/pyright/issues/5342 .
2023-06-19 18:00:31 -07:00
Eric Traut
2de35e3684
Added documentation about higher-order functions.
2023-06-18 00:00:06 -07:00
Eric Traut
8d9910eb89
Added more details about difference between mypy and pyright overload resolution in ambiguous cases.
2023-06-15 16:01:12 -07:00
Ross J. Duff, MSc
b12ca05927
Clarification of --version argument usage string ( #5308 )
...
* Update command-line.md
clarify that `--version` prints the version *and exits*
* Update --version usage string
Clarifies that `--version` prints the version *and exits*, this is fairly common language used by most CLI apps to indicate what the behavior of `--version` is. It may surprise new users that `--version` exits rather than appending the version with the previous language.
2023-06-15 08:42:26 -07:00
Serhii Tereshchenko
0d0e716f92
Update ci-integration.md ( #5259 )
...
When both scripts are executed in `scripts:` section, and `pyright` reports error, second script is not executed.
Best way to ensure report are always converted, is to use `after_script:` block.
2023-06-09 08:37:45 -06:00
Eric Traut
24b612fda2
Reverted overload change for now. It's causing breaks in the pandas-stubs library. More investigation is needed.
2023-06-06 17:53:24 -06:00
Eric Traut
5ca3d900fd
Deleted redundant documentation.
2023-06-05 15:06:24 -06:00
Eric Traut
746e03a49d
Modified overload matching algorithm to better match that of mypy. In particular, if overload matching is ambiguous due to an Any
or Unknown
anywhere within an argument type (even within type arguments) and the resulting filtered overloads return the same generic type but with different type arguments, the resulting type was previously the return type of the first filtered overload. It is now the common generic type with erased type arguments. This addresses https://github.com/microsoft/pyright/issues/5216 .
2023-06-03 17:36:09 -06:00
Eric Traut
6e6c3664b3
Added documentation for pyright's handling of constructor calls and how this differs from mypy.
2023-05-25 18:36:11 -07:00
Erik De Bonte
b971a0c689
Add PEP 712 to features.md ( #5143 )
2023-05-19 17:07:39 -07:00
Eric Traut
35a2ed939c
Updated features documentation to mark PEP 695 as no longer in draft form.
2023-05-15 23:16:36 -07:00
Eric Traut
98b0604eb9
Added command-line option pythonpath
that allows the path to the python interpreter to be specified. This addresses https://github.com/microsoft/pyright/issues/5111 .
2023-05-13 16:19:14 -07:00
Eric Traut
ba18f421d1
Deprecated command-line options 'typeshed-path' and 'venv-path' in favor of 'typeshedpath' and 'venvpath'. The hyphenated options were inconsistent with the conventions used for other options.
2023-05-13 15:56:26 -07:00
Eric Traut
85a8b34aee
Added instructions for adding a “pyright: checked” badge.
2023-05-06 08:26:44 -07:00
Eric Traut
a9a0a60a39
Moved badge to docs/img folder.
2023-05-06 08:25:03 -07:00
Erik De Bonte
6e95b76291
Fix broken link in mypy-comparison.md
( #5046 )
2023-05-01 14:42:54 -07:00
Eric Traut
2c6e5b2938
Updated CLI documentation to clarify that files specified on the command line do not cause the config file to be ignored entirely.
2023-04-22 19:31:52 -07:00
Eric Traut
9f81564a46
Changed reportImportCycles
so it is not on by default in "strict" type checking mode. It is highly opinionated and should be used only in cases where the developer opts into it.
2023-04-08 10:29:14 -07:00
Eric Traut
39cac72d99
Improved documentation for conditional types.
2023-04-05 15:50:00 -07:00
Eric Traut
5d6eacd5e1
Changed the default of the useLibraryCodeForTypes
from false to true to bring pylance and pyright into alignment. Also deprecated the "--lib" command-line option, which was previously used to enable useLibraryCodeForTypes
from the command line. ( #4903 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com>
2023-04-05 09:47:59 -06:00
Eric Traut
ff134e6467
Added documentation to mypy comparison that talks about narrowing for captured variables.
2023-04-02 08:34:28 -07:00
Eric Traut
08085479ef
Extended type narrowing for type guards of the form x[I] is B
and x[I] is not B
where x
is a tuple and B
is an enum literal.
2023-03-30 18:26:46 -07:00
Eric Traut
f1db88481f
Added support for type guards of the form x[I] is B
and x[I] is not B
where x
is a tuple and B
is a boolean literal True
or False
. This addresses part of https://github.com/microsoft/pyright/issues/4875 .
2023-03-30 18:10:06 -07:00
Dmitry Volodin
14b0831697
Fix Markdown links ( #4849 )
...
* Fixed Markdown links
* Gave main doc page prettier name
2023-03-27 19:48:11 -06:00
Eric Traut
e2e3a5c9ff
Added new diagnostic check reportImplicitOverride
. This addresses https://github.com/microsoft/pyright/issues/4788 .
2023-03-16 09:52:25 -06:00
Eric Traut
65ca325a14
Changed # pyright: basic
file-level comment so it overrides "strict" settings specified in the config file or language server settings. This allows an individual file to be "downgraded" from strict to basic. This addresses https://github.com/microsoft/pyright/issues/4751 .
2023-03-09 10:28:44 -07:00
Eric Traut
3f987e3137
Fixed broken links in README for npmjs page. Added missing link to command line interface documentation in sidebar.
2023-03-09 09:46:17 -07:00
Eric Traut
9c6ebad347
Updated mypy comparison to reflect change in mypy's type narrowing capabilities.
2023-03-09 08:21:01 -07:00
Eric Traut
c83a95e62e
More improvements to documentation.
2023-03-07 16:38:22 -07:00
Eric Traut
414dce170e
Updated documentation for import modeling differences between mypy and pyright.
2023-03-07 10:16:14 -07:00
Eric Traut
1fdeadeca6
Improved "getting started" documentation.
2023-03-07 09:53:49 -07:00
Eric Traut
a00a026953
Fixed capitalization inconsistency in docs.
2023-03-06 18:12:20 -07:00
Eric Traut
08b2cb4698
Did a consistency pass on documentation markdown.
2023-03-06 18:10:33 -07:00
Eric Traut
f7db5822ef
Ran auto-formatter on html to avoid style issue in CI.
2023-03-06 17:59:23 -07:00
Eric Traut
8f17673300
Fixed main Pyright link in sidebar.
2023-03-06 17:55:58 -07:00
Eric Traut
400dd260cc
Another small tweak to docs sidebar.
2023-03-06 17:54:36 -07:00
Eric Traut
2c4a9da2ae
More tweaks to documentation and README files. Added a navbar to docs site.
2023-03-06 17:52:06 -07:00
Eric Traut
65874c5254
Small tweak for main docs page.
2023-03-06 17:45:37 -07:00
Eric Traut
deabba5e6a
Tweaked documentation theming and added language highlighting for json.
2023-03-06 17:44:15 -07:00
Eric Traut
2827c94d89
Small correction to settings documentation.
2023-03-06 16:10:06 -07:00
Eric Traut
dc87fa46af
Added a missing HTML tag to index.html.
2023-03-06 16:03:19 -07:00
Eric Traut
6cb2f4a058
Moved installation instructions and FAQ to their own docs pages, further simplifying the main README.
2023-03-06 15:58:44 -07:00
Eric Traut
b61f121efe
Minor tweak to README.
2023-03-06 15:51:49 -07:00
Eric Traut
4c4aec52a5
Added support for docsify-based docs site.
2023-03-06 15:46:07 -07:00
Eric Traut
b3fd962116
Fixed bugs in documentation.
2023-03-06 15:45:51 -07:00
Eric Traut
735c19a1c9
Improved documentation for ...
function bodies.
2023-03-06 10:49:54 -07:00
Eric Traut
7197a8d624
Added documentation for import statements.
2023-03-06 08:49:00 -07:00
Eric Traut
81f21ee3d4
Added support for type guard patterns type(x) == T
and type(x) != T
. This addresses https://github.com/microsoft/pyright/issues/4719 .
2023-03-01 23:29:44 -07:00
ErezAmihud
2857963212
add gitlab ci documentation ( #4704 )
2023-02-27 13:57:05 -07:00
Eric Traut
526d907def
Slimmed down the README to remove information that most pyright users probably don't care about. Features of pyright were moved to a separate "features.md" document.
2023-02-26 10:54:20 -07:00
Eric Traut
344b091bfe
Minor formatting improvements to documentation.
2023-02-14 18:23:13 -08:00
Eric Traut
4eb4397a90
Updated documentation for default exclude settings.
2023-02-08 13:09:55 -08:00
Eric Traut
f8eb114de3
Fixed a few typos in the pyright documentation.
2023-02-01 08:09:36 -08:00
Eric Traut
b17f64ddcb
A few more tweaks to the documentation for consistency.
2023-01-27 09:29:38 -08:00
Eric Traut
3829e8e32d
Tweaked documentation for readability.
2023-01-27 09:26:30 -08:00
Eric Traut
53e8cd4145
Added provisional support for draft PEP 702 (marking deprecations using the type system).
2023-01-13 21:16:07 -08:00
Eric Traut
a2784020f2
Added support for x[K] is V
and x[K] is not V
type narrowing forms. This addresses https://github.com/microsoft/pyright/issues/4453 .
2023-01-13 16:53:18 -08:00
Eric Traut
452bd59778
Updated build instructions.
2023-01-08 09:20:12 -08:00
Christian Clauss
bd3ac8b722
Fix typos discovered by codespell ( #4399 )
2023-01-04 06:54:43 -07:00
Eric Traut
c7626944f1
Added support for type guard forms x is ...
, x is not ...
, x == ...
and x != ...
. Support for these were recently added to mypy. This addresses https://github.com/microsoft/pyright/issues/4397 .
2023-01-04 06:13:44 -07:00
Christian Clauss
7be1d77360
Fix typo ( #4398 )
2023-01-04 05:53:27 -07:00
Eric Traut
775b7b4d85
Improved handling of TypeVars that appear only within a Callable within a return type annotation for a function. By a strict reading of PEP 484, these should be bound to the function's scope, but practically, they are bound to the Callable. This allows a function to return a generic callable type. When TypeVars are rescoped in this manner, the TypeVar cannot be referenced within the function body because it is no longer in scope in that context. This addresses https://github.com/microsoft/pyright/issues/4285 .
2022-12-25 10:57:02 -07:00
Eric Traut
0be873e289
Fixed a couple of typos in the documentation.
2022-12-21 10:47:28 -07:00
Eric Traut
97b6231d13
Added a few more minor improvements to the docs.
2022-12-18 18:40:29 -08:00
Jelle Zijlstra
355361e8b3
fix typos in mypy-comparison ( #4354 )
...
* fix typos in mypy-comparison
* fix versions
2022-12-18 18:15:17 -08:00
Eric Traut
e3ddbb3171
Small tweaks to the new documentation based on proofreading pass.
2022-12-18 15:24:59 -08:00
Eric Traut
5a19cb9f0a
Added documentation that covers the major behavioral differences between pyright and mypy and the justifications for those differences.
2022-12-18 15:11:11 -08:00
Eric Traut
c4e61dcc6a
Fixed a few bugs in the type guard documentation.
2022-12-18 15:10:30 -08:00
Eric Traut
8d3a6e62c8
Further clarified the new overload behavior in the documentation.
2022-12-18 08:06:47 -08:00
Eric Traut
1dc84b93b1
Modified the overload matching algorithm to match the behavior of mypy when the overload match is ambiguous because an argument evaluates to Any
or Unknown
. In this case, the call expression evaluates to Unknown
. Previously, pyright used the first of the matching overloads in this case. This addresses https://github.com/microsoft/pyright/issues/4347 .
2022-12-16 23:18:37 -08:00