-
Notifications
You must be signed in to change notification settings - Fork 279
/
CHANGELOG
2027 lines (1593 loc) · 70.6 KB
/
CHANGELOG
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Version 2024.10.11:
Updates:
* Drop support for Python 3.8 and 3.9.
* Make merge_pyi not to overwrite existing type annotations.
* When printing types (e.g. in error messages or `reveal_type`), print generic
builtin names in lowercase.
Old: `from typing import List; List[Foo]`
New: `list[Foo]`
Bug fixes:
* Unpin dependency on networkx, which means pytype now supports >=3.3.
* Emit all unused/duplicate files with --unused_imports_info_files option,
rather than only one per unique module name.
* Change return types of AsyncGenerator's methods to coroutines. This brings
pytype's definition in line with the definition on typeshed and reflects the
fact that asynchronous generators defined using the `async def`/`yield` syntax
have methods returning coroutines rather than just arbitrary awaitables.
* Fix type guards propagating invisibile bindings. Fixes some incorrect "used
after deleted" errors with Python 3.12.
* Fix resolution of ParamSpec in files with circular imports.
Version 2024.09.13:
Updates:
* Basic support for Python 3.12.
With this release you can run pytype with Python 3.12. But pytype has no
support for any new features added in Python 3.12.
Look out for type checking changes caused by different bytecode emit:
* dict/list/set comprehensions are type checked 1 level deeper.
* Errors after `if` statements can be printed differently.
* Add support for pickled pyi files in merge_pyi.py.
* Several performance improvements.
* Stop validating imports map. Pytype used to validate that each file in an
import map exists. This has proved too costly, especially on network file
systems. Pytype now assumes import maps specified via --imports_info are
correct.
* Add support for flag files (required for Bazel workers).
* Change the format of errors printed to the console.
Errors now also include the column number and a code snippet, which highlights
the part that's broken.
Old:
File "test.py", line 4, in foo: unsupported operand type(s) for +: str and int [unsupported-operands]
Function __add__ on str expects str
New:
test.py:4:10: error: in foo: unsupported operand type(s) for +: str and int [unsupported-operands]
Function __add__ on str expects str
print(arg + 3)
~~~~~~~
Bug fixes:
* Add type definitions for `aiter()` and `anext()`.
* Don't include deleted top-level variables in module types.
* Don't crash when a Generic subtype uses a TypeVar differently.
* Fix type inference for `iter(func, None)`.
Version 2024.04.11:
Updates:
* Change error message hint to suggest `X | None` rather than `Optional[X]`.
Bug fixes:
* Take the 'maybe_missing_members' attribute into account when setting up enum
classes.
* Fix a bug in signature compatibility checking.
* Teach main.py how to fix unescaped spaces in command-line arguments.
* Fix return type of exit() and quit().
* Update pytype_runner.py - change escape_ninja_path to escape all the ninja
path escape-needing characters
* Modify type annotations for coroutines as soon as they are created.
* Fully promote __init_subclass__ to a classmethod.
Version 2024.03.19:
Updates:
* Add 'default' field to pytd.TypeParameter.
Bug fixes:
* Raise an error when a non-class is passed to a class match case.
Version 2024.03.11:
Updates:
* Split generate_pyi into separate components for ast and pyi generation.
* Replace `pickle` with `msgspec`.
* Support PEP 742 (TypeIs).
* Update typeshed pin to commit c35b3bc from Mar 8.
* Support typing_extensions.Unpack usage in typeshed.
Bug fixes:
* Fix a corner case with an indefinite case in a match with concrete values.
* Check types as well for dataclasses.replace.
* Export enum values as Literals where possible.
* Remove mystery 'None' from overlays/named_tuple.
* Still do property lookups when maybe_missing_members is set.
* Fix crash in enum_overlay.
* Recognize __func__ attribute on methods.
* Fix a crash when constant-folding an invalid map literal.
Version 2024.02.27:
Updates:
* Add support for pragmas to pytype.
* Implement the cache-return pragma.
Bug fixes:
* Track the set of case lines we have encountered, not just the number of them.
* Fix interaction between Self and overload.
* Typo fix in cover_from_cmp.
* Add __match_args__ to dataclasses.
* Add missing __reduce__ method to builtins.object.
* Fix a bug in how we resolve aliases in pyi files.
* Don't crash when using a method as a fiddle config type constructor.
Version 2024.02.13:
Bug fixes:
* Fix: pytype.single -> pytype.main.
* Catch UnicodeDecodeError when attempting to read excluded files.
* Add protocol overload to definition of builtins.divmod.
Version 2024.02.09:
Updates:
* Remove 'deep' and 'store_all_calls' options.
* Remove duplicate pytype inputs and outputs.
Bug fixes:
* Fix module resolution bug in load_pytd.
* Pattern matching:
* Fix a corner case in pattern matching where the first case is None.
* Fix a corner case when comparing to Any in a case statement.
* Fix a false redundant-match when matching instances of a nonexhaustive type.
* Do not attempt to track matching if we don't recognise a CMP as an instance.
* Do not attempt to track matches if the match variable contains an Any.
* Rework the check for an out-of-order opcode in a match block.
* Fix a crash when calling get() on a TypedDict instance.
* Don't crash when inferring a type for an uncalled attrs.define.
* Handle aliased imports in type stubs better.
* Teach pytype that zip is actually a class.
* Catch bad external types in type annotations.
Version 2024.01.24:
Updates:
* Stop doing suboptimal line number adjustment for 3.10/3.11 consistency.
Bug fixes:
* Fix a couple of --none-is-not-bool issues.
* --bind-decorated-methods: Don't treat SimpleFunction as a full-fledged method.
* Fix bad matching of typing.Self against other TypeVars.
* Don't do attr-demangling on non-attr classes.
* Fix interaction between signature compatibility checks and typing.Self.
* Fix [invalid-function-definition] error caused by ignoring
dataclasses.KW_ONLY.
* Report an error when a TypedDict key has an ambiguous type.
* Fix bug caused by bad ParameterizedClass hashing.
* Make sure we consistently use the same `dict` class for types.
* Don't raise MissingParameter on keyword-only params when **kwargs is present.
Version 2024.01.05:
Updates:
* Support typing.Required and typing.NotRequired.
* Detect bad calls to `dataclasses.replace`.
Bug fixes:
* Do not crash if we encounter a malformed splat in a constant list.
* Allow ParamSpecs as generic class parameters.
* Fix crash caused by incorrect assumption about the type of an ast node.
* Allow NoReturn to match anything in @override checks.
* Expand the types that `dict.__ior__` accepts.
Version 2023.12.18:
Bug fixes:
* Prevent `ChainMap`, `Counter` and `OrderedDict` from being dropped if they're
only imported.
* Fix matching against a plain fiddle.Config in pyi signatures.
* Remove no-longer-necessary `__getattribute__`s from enum.pytd.
* Resolve attribute access on Any constants in pytd to just the constant.
* Don't let `typing` be treated as a replaceable Any.
* FIX: Only call match_fiddle_instance_against_bare_type if we have a fiddle
instance.
Version 2023.12.08:
Bug fixes:
* Fix a crash with nested pattern matches.
* Allow typing.Unpack to be parameterized.
Version 2023.12.07:
Updates:
* 3.11: support ExceptionGroup.
* Update typeshed pin to commit 0b36e65 from Nov 29.
* Add a flag, --none-is-not-bool, to disable treatment of None as a bool.
Bug fixes:
* Remove extraneous quotes around part of error message.
* Fix pattern matching with `case None` branches.
* Support @override for methods anywhere in the MRO.
Version 2023.11.29:
Updates:
* Remove the --use-enum-overlay flag. It has been enabled by default since the
last release.
Bug fixes:
* Mark typing.Required as generic.
* Fix container mutation bug.
Version 2023.11.21:
Updates:
* Add support for typing_extensions.override.
* Add support for the pax fiddle library.
* Enable --use-enum-overlay by default.
Bug fixes:
* Take arguments passed by keyword into account in Unknown.to_type().
* Don't create extra copies of `None` in convert.py.
* Allow frame locals to be an Unsolvable (Any).
* When making properties, check their arity against require arg count.
* Allow arbitrary AST nodes in typing.Annotated.
* Fix crash caused by assuming parameter names are strings.
* Fix corner case in which decorated setUp method wasn't being analyzed.
* Add missing buffer methods to memoryview.
* Allow functions in pyi files to have any number of decorators.
Version 2023.10.31:
Updates:
* Happy Halloween!
* typing.Self: support Self in variable annotations.
* 3.11: Implement typing features Never, clear_overloads, get_overloads,
assert_type, reveal_type, and assert_never.
* Add feature flag --bind-decorated-methods to bind 'self' correctly in
decorated methods.
Bug fixes:
* Fix some corner cases in invalidating an enum tracker.
* Use equality check rather than identity check for recursion detection.
Version 2023.10.24:
Updates:
* Add support for typing.Self in method type annotations.
Bug fixes:
* Support pattern matching against a tuple of match variables.
* Fix crash caused by use of a recursive type in a callable.
* When setting a type from assertIsInstance narrow the original type if
possible.
Version 2023.10.17:
Updates:
* Remove the --overriding-parameter-count-checks flag. This flag's behavior is
now the default.
* Support enum.StrEnum.
* Support type narrowing for match cases with `as` captures.
* Add basic support for Python 3.11.
* Pytype can now analyze code that does not use any new 3.11 features in 3.11.
* Support for new features will follow over the coming months.
Bug fixes:
* Improve `set` and `frozenset` methods.
* Fix maximum recursion depth error.
* Remove extraneous check in RenameModuleVisitor.
Version 2023.10.05:
Updates:
* Default --overriding-parameter-count-checks to True. This flag is now a no-op.
Bug fixes:
* Improve type signatures for set.union.
* Simplify the output of assert_type and reveal_type.
* --strict-undefined-checks: Don't propagate block locals when a block cannot be
exited from.
* Fix various Python 3.11 bugs.
Version 2023.09.27:
Updates:
* Update typeshed pin to commit 8597724 from Sep 18.
* Python 3.11: add exception handling.
* Support pattern matching literal sequences.
Bug fixes:
* Take TypeVar substitutions into account when extracting annotations.
* Fix a crash when pattern matching against `Callable()`.
* Apply overlays when loading modules imported in pyi files.
* Don't ignore decorated initializers.
* Add object.__format__ to builtins stubs.
* Export the type stub for attrs.cmp_using.
Version 2023.09.19:
Updates:
* Update typeshed pin to commit ce222e5 from Jun 12.
* pytype-single: Add --no-validate-version flag to disable Python version
checks. This makes testing not-yet-supported versions easier.
* Remove max version requirement for installing pytype. This prevents accidental
installation of very old versions of pytype that don't have this requirement.
Pytype itself still emits an error upon encountering an unsupported version.
* Use pycnite for bytecode processing.
Bug fixes:
* Fix a corner case in ParamSpec matching for a class with a __call__ method.
* Python 3.11:
* Fix implementations of several 3.11 opcodes.
* op.next should not point backwards even if the op is a backwards jump.
* Track undecorated functions for better handling of TypeVars in signatures.
* Fix 'TypeVar not in scope' check for imported TypeVars.
Version 2023.09.11:
Updates:
* Preserve the line number of del statements to use in error messages.
Bug fixes:
* Never discard user-provided overloads in output.py.
Version 2023.08.31:
Updates:
* Support typing.is_typeddict.
* Change how pytype handles `isinstance(..., Any)`.
* Allow class-scoped TypeVars in classmethods.
Bug fixes:
* Filter out non-visible bindings in vm._unpack_sequence.
* Use the alias name for resolving property decorators.
* Don't collapse long unions containing literals.
* Update pytd printer's treatment of `cls` annotations to match `self`.
* Clear out any `self` annotation before a function recursively calls itself.
* vm: fix narrowing for unittest assertions.
Version 2023.08.22:
Bug fixes:
* Report more position information for type stub parse errors.
* Handle aliases in type stubs more consistently.
Version 2023.08.14:
Updates:
* Add support for typing_extensions.dataclass_transform used without arguments.
* Remove --enable-cached-property entirely.
Bug fixes:
* Relax the pyi parser's duplicate identifier detection.
* Don't crash on `[]` appearing in the parameters of a user-defined class.
* Work around syntax errors in type stubs.
* Allow `_HAS_DYNAMIC_ATTRIBUTES` to work for class attribute lookups.
* Fix how pytype handles aliases to properties and overloaded methods in stubs.
* Fix how the enum overlay logs [not-supported-yet].
Version 2023.07.28:
Updates:
* Flip the enable-cached-property flag to True. This flag is now a no-op and
will be removed in the next release.
* Add bad_unpacking error for unordered types (set and frozenset) unpacking.
* Support assigning to `importlib.import_module(...)` in pyi files.
Bug fixes:
* Raise a parser error when loading a pyi file with an invalid literal
annotation.
* Use init_class instead of instantiate in MATCH_CLASS.
Version 2023.07.21:
Bug fixes:
* Include ParamSpecs in CollectTypeParameters.
* Fill in TypeVar substitutions when matching against protocols.
* Look up TypeVar values when retrieving an attribute from a ParameterizedClass.
* Add missing __buffer__ method to builtins.bytearray.
* output.py: don't crash upon encountering ParamSpecMatch.
* Add ForwardRef definition to typing stub.
* Implement definitions of collections.UserList, collections.UserString.
* Overload union, intersection, difference, and symmetric difference for Set
class.
Version 2023.07.12:
Updates:
* Drop support for Python 3.7, which reached end-of-life last month.
* Support the new `BINARY_OP` opcode in python 3.11.
* Fix some stack effects for the new 3.11 opcodes.
Version 2023.06.16:
Updates:
* Add partial typing.Self support in type stubs.
* Make some minor improvements to pytype's type stub printer.
Bug fixes:
* Flesh out definition of collections.UserDict.
* Fix timeout in file that constructs a complicated dict of tuples.
* Narrow the type of the matched variable in case branches with class matches.
Version 2023.06.02:
Updates:
* Performance improvement: change Dict.set_str_item to merge nonatomic str
values into Dict._K.
Bug fixes:
* Fix crash caused by typing.TypeVar lookup failure.
* Do not follow aliases for "builtins" and "typing" in pyi files.
* Check [not-instantiable] for classes inheriting directly from a protocol.
* Do a better job of catching illegal TypedDict field names.
* FIX: Do not match all views for a var with multiple bindings in a CLASS_MATCH.
* Take into account __round__ implementations when analyzing round().
* Fix timeout caused by infinite loop in LookupItemRecursive.
* Fix some spurious [not-instantiable] errors.
* Only store the blockgraph when compiling the main module code.
Version 2023.05.24:
Updates:
* Performance improvements:
* Speed up Variable.Bindings by using the reachability analyzer.
* Implement literal erasure for List and Tuple.
* Add support for analyzing python scripts.
Bug fixes:
* Fix bug in pytype's handling of overloads.
* Fix timeout caused by name clash between a module and a package.
* Limit the scope of module aliases in load_pytd.
* Handle generic dataclasses in fiddle configs.
* Support referring to a class via an alias in a pyi file.
* Fix a crash when pattern matching on collections.abc classes.
* Handle nested classes better in the LookupExternalTypes visitor.
* Improve matching of typing names in the pyi parser.
Version 2023.05.08:
Updates:
* When checking for unmatched typevars in defs, use a separate message for bare
generic aliases.
* If an overridden method changes the name of a posarg, check posarg count but
not types.
Bug fixes:
* Fix for number of bindings when constant folding long lists.
Version 2023.04.27:
Updates:
* Performance optimizations:
* Cache the `NestedAnnotation.formal` property.
* Speed up `LateAnnotation.__getattribute__`.
* Speed up abstract_utils._isinstance.
* Add support for dataclasses.KW_ONLY.
* Bump networkx version requirement to pick up a matplotlib compatibility fix.
Bug fixes:
* Fix a string manipulation bug in LookupScopedNames.
* Fix a crash in the fiddle overlay when instantiating a function-based config.
* Allow constants as defaults in pyi files.
Version 2023.04.18:
Updates:
* Remove pytype's copy of the _ctypes stub.
Bug fixes:
* Remove expensive copy.deepcopy call from the pytd printer.
* Track default (_) cases in match statements in the director.
Version 2023.04.11:
Updates:
* Add a block graph visualiser.
* Remove the --always-use-return-annotations flag. Its behavior is now enabled
by default.
Bug fixes:
* Add pattern matching for builtins.
* Keep track of already-seen cases when analysing the same match statement
twice.
* Support `total=False` on imported TypedDicts.
* Use SupportsIndex in some builtins.
* Improve handling of dataclasses and attrs in pyi files.
* Fix inferred yield type for YIELD_FROM opcode.
Version 2023.03.31:
Updates:
* Add an overlay for the third party fiddle configuration library.
* Add feature to not replace None with Any when it is the only value.
Bug fixes:
* Fix pattern matching over imported enums.
* Track the variable name for annotated assignments in the director.
* Don't replace late annotations with Any in class definitions.
* Preserve TypedDict instances in TypeVar substitutions.
* Delegate getattr on pyi classmethods and staticmethods to underlying method.
* Support late annotations as parameters for user-defined generic classes.
* Fix a nondeterminism bug in pytype.
* Fix a latent type error in the typing.TypedDict overlay.
* Fix a crash caused by failing to catch [bad-concrete-type].
* Update memview stubs to be closer to API.
Version 2023.03.13:
Updates:
* Support abc.abstractclassmethod and abc.abstractstaticmethod.
Bug fixes:
* Look up aliased imports when resolving imported modules.
* Copy typeshed changes to builtins.pyi.
* Fix a pytype crash when encountering a pyi import corner case.
Version 2023.03.08:
Updates:
* Add basic query visualization to the CFG visualizer.
Bug fixes:
* Slight fix to wording of non-iterable strings error message.
* Allow TypeVar amd ParamSpec to be passed None for bounds and constraints.
* Handle multiple options for a class's base classes better.
* Don't crash on `from functools import cached_property`.
* Support `__self__` on methods.
Version 2023.03.02:
Updates:
* Update typeshed pin to commit 37a180e from Feb 3.
* Make it possible to run pytype on PyPy.
Bug fixes:
* Use ninja importability to determine python-ninja usability.
* Treat `typing.Pattern` and `typing.Match` as aliases of the same-named classes
in the `re` module.
* Handle callables better in protocol matching.
Version 2023.02.17:
Updates:
* Add overlay for functools.cached_property.
* Performance optimization: combine two expensive loops in _UniqueMatches.insert
Bug fixes:
* Don't parse literal string constants as type annotations.
* Add missing __required_keys__ and __optional_keys__ attributes to TypedDict.
* Do not reexport `__future__` imports.
Version 2023.02.14:
Bug fixes:
* Add fget, fset, fdel attributes to property.
* Check for ignored abstract methods on nested classes.
* Add a native TypedDict.get() implementation.
* Remove some unnecessary CFG nodes.
Version 2023.02.09:
Updates:
* Support isinstance(..., Union[...]).
* analyze_project: take external dependencies of typeshed stubs into account.
* Add support for the 3.10+ kw_only dataclass field parameter.
Bug fixes:
* Fix a misfiring of the [incomplete-match] error.
* Detect mixin override of @final-decorated attribute.
* Always apply TypeVar substitutions to function return types.
Version 2023.01.31:
Updates:
* PEP 612:
* Add support for ParamSpecs in source files.
* Basic support for ParamSpec args and kwargs.
* Remove --overriding-return-type-checks (now a no-op).
Bug fixes:
* Fix types of Mapping.keys(), values(), items().
* Don't unnecessarily mutate type parameter values to Any.
* Add missing methods from collections.abc.MutableSequence.
Version 2023.01.17:
Updates:
* Default --overriding-return-type-checks to True.
* Optimise literal output for class variables as well as constants.
* Do some preliminary work for pytype Python 3.11 support.
Bug fixes:
* Add missing 3.10 attributes to typing.Counter.
* Do not parse default values as types.
* Make `ChainMap` accept `MutableMapping`.
Version 2023.01.10:
Updates:
* Add a new "missing_modules" parameter to load_pytd.create_loader.
* Support putting pytype settings in a pyproject.toml file.
* Add a performance optimisation for outputting the type of large collections.
Bug fixes:
* Add missing int.bit_count method.
* Improve pytype's handling of dict.update.
* Do better matching of overloads in generic classes.
* Show expected type in InterpreterFunction error messages with *args/**kwargs.
* Allow 'self' as a keyword argument to str.format.
Version 2022.12.15:
Updates:
* Remove the --overriding-default-value-checks and
--overriding-parameter-name-checks feature flags, which have been no-ops since
the last release.
* Update typeshed pin to commit 78d96cd from July 12.
Version 2022.12.09:
Updates:
* PEP 612: Add support for imported ParamSpec and Concatenate instances.
* Update typeshed pin to commit 4e0aacc from July 12.
* Feature flags:
* Remove --mapping-is-not-sequence, which has been a no-op since the last
release.
* Default --overriding-default-value-checks to True.
* Default --overriding-parameter-name-checks to True.
Bug fixes:
* Fix a bug in module resolution in load_pytd.
* Don't let one TypeVar contain another, and keep invalid TypeVars when
possible.
* Support calling super() with a subclass of builtins.type.
* Fix annotation of *args and **kwargs when constructing a SimpleFunction.
* Don't report container errors for late types.
* --always-use-return-annotations: handle coroutines.
* Add missing attributes to typing.TextIO.
Version 2022.11.29:
Updates:
* Default --mapping-is-not-sequence to True.
Bug fixes:
* Fix incorrect "Any" count in pytd printer for Callable[nothing, X].
Version 2022.11.18:
Updates:
* Allow NoReturn to appear anywhere.
* Add basic TypeGuard support.
Bug fixes:
* Improve imports handling in the pytd printer.
* Do a better job of catching bad parameterized types in pyi files.
* Fix constant folding for python-3.9+ literals compiling to LIST_EXTEND.
* Stop accidentally converting bound to unbound functions.
Version 2022.11.10:
Updates:
* Add an optional no-return-any flag to disallow Any as a return type.
* Add a mechanism to allow per-file opting in to feature flags, via a file-level
`features` directive, for example, `# pytype: features=no-return-any`.
Bug fixes:
* Do not let a kwarg in **args interfere with a posonly arg of the same name,
pyi edition.
* Interpret special characters in serialized (pyi or pickle) Literal[""] type
definitions correctly.
Version 2022.10.26:
Updates:
* Implement basic exhaustiveness checking for pattern matches over enums.
* Performance improvements:
* Avoid expensive variable filtering in a couple of places.
* Switch fully to argument-by-argument call matching for PyTDFunction.
Bug fixes:
* Relax an overly strict TypeVar consistency check.
* Track TypeVar unions in the matcher.
* Emit `node/kind record` and `subkind class` facts instead of `node/kind class`
* Add a missing parameter type to bytearray.__add__.
Version 2022.10.13:
Updates:
* Add a flag, --mapping-is-not-sequence, to forbid matching mappings against
the Sequence protocol.
* Add a library for serializing the CFG.
* Fully support pattern matching in 3.10, aside from exhaustiveness checks.
* Make some performance improvements around type-checking of function call
arguments for functions defined in the same file.
Bug fixes:
* Store more information in matcher._recursive_annots_cache.
* Fix "appears only once" TypeVar error on overloads in generic classes.
* Do not let a kwarg in **args interfere with a posonly arg of the same name.
* Re-resolve LateType instances that resolve to another LateType.
Version 2022.09.27:
Updates:
* Slightly improve pytype's numpy stub.
* Remove --overriding-parameter-type-checks flag that is now enabled by default.
* Add partial support for pattern matching.
* Add `Attrs` protocol and `__attrs_attrs__` member to attr overlay.
Bug fixes:
* Fix infinite recursion caused by annotated __new__ methods.
* Take nested classes into account when re-resolving dependencies in load_pytd.
* Support empty generic protocols.
* Correct type annotations for IO objects: `seek` and `truncate`.
* Define __new__ instead of __init__ for np.ndarray.
Version 2022.09.19:
Updates:
* Rework arg parsing to make using pytype as a library in tools easier.
* Move typegraph and cfg graph visualisation to a separate frontend binary.
* Add a feature flag, --always-use-return-annotations, to always use return type
annotations when analyzing function calls.
* Default --overriding-parameter-type-checks to True. This flag will be removed
in an upcoming release.
Bug fixes:
* Add an OrderedCode object to LOAD_FOLDED_CONST.
* Treat LiteralString as str in pyi files.
* xref:
* Replace `record` into `package` kind and add `childof` edge from `file`.
* Do not add a defines/binding edge for `a.x = ...` if `a` is not `self`.
Version 2022.09.08:
Updates:
* Remove the --build-dict-literals-from-kwargs flag. Its behavior is now enabled
by default.
Bug fixes:
* Parse Literal values containing quotes better.
* Make collections.OrderedDict an alias for typing.OrderedDict.
Version 2022.08.30:
Updates:
* Update typeshed pin to commit 7de1ed9 from Jun 14.
* Specify option conflicts and required dependencies in @uses decorator in
config.Postprocessor.
* Remove the --strict_namedtuple_checks flag. Its behavior is now enabled by
default.
* Support TypedDict construction via function call in pyi files, and use
TypedDict functional form if a keyword is used as a field name.
Bug fixes:
* Allow [signature-mismatch] disable to be put on any line of a function
signature.
* Teach pytype that _typeshed.NoneType is the same as type(None).
* Fix a check that was wrongly filtering out lambdas in function bodies.
* Check for misuse of ellipses in Callable.
* Add missing constants to _ctypes.
* xref:
* Fix function param indexing.
* Index class attributes defined as classvars.
Version 2022.08.23:
Bug fixes:
* Add missing attrs.validators.min_len.
* Allow bare variable annotations at the module level.
* Change the order of the Protocol and Generic bases when expanding
Protocol[_T].
* Handle multiple substitutions better in PyTDSignature.call_with_args.
* Improve name resolution for typeshed.
Version 2022.08.17:
Updates:
* Use argument-by-argument call matching for some simple generic functions.
Bug fixes:
* Check that @classmethod and @staticmethod are applied to callable functions.
* Add StopIteration.value and turn type comments into annotations.
* Fix nested class inference for TypedDict and ParameterizedClass.
* analyze_project: fix parsing of `jobs=auto` from config files.
* xref: link the entire span of a function call.
Version 2022.08.03:
Bug fixes:
* Support aliases of module name prefixes in load_pytd.
* Don't allow partial late annotations in | union types.
* Fully resolve pytd aliases in LookupExternalType's duplicate aliases check.
Version 2022.07.26:
Updates:
* Remove the --enable-bare-annotations flag. Its behavior is now the default.
* Support generic properties.
Bug fixes:
* Python 3.10:
* Don't assume Any | Any is a type annotation.
* Calculate starts of decorated functions correctly.
* Don't crash on a nested function referenced in a closure before definition.
* Sort classes by name in convert.merge_classes.
Version 2022.07.18:
Bug fixes:
* Look up methods properly on classes with _HAS_DYNAMIC_ATTRIBUTES.
* Handle .pyi-1 files in load_pytd.Module.is_package().
* Adjust opcode line numbers for return statements in python 3.10+.
* Remove optimize.Factorize, which unnecessarily flattens overloaded functions.
* Fix coroutine signatures in overriding_checks.
* Handle generic types correctly in signature compatibility checks.
* Respect NoReturn annotations even when maximum depth is reached.
Version 2022.06.30:
Updates:
* Add the option to show kythe facts in the debug indexer.
* Add a command-line argument `pickle-metadata` to pass metadata to pytype to
store during serialization to a pickle file.
Bug fixes:
* Make slight improvements to --overriding-default-value-checks.
* Preserve comments when preprocessing source code.
Version 2022.06.23:
Updates:
* Support `T1 | T2 | ...` syntax for union types in python 3.10+ (PEP604).
* Replace libcst with ast in directors.py in Python 3.9+. This makes source code
parsing much faster.
Bug fixes:
* Python 3.10 fixes:
* Convert `types.NoneType` to `builtins.NoneType`.
* Adjust the error line number for an implicit `return None`.
* Add `ParamSpecArgs` and `ParamSpecKwargs` to `typing.pytd`.
Version 2022.06.14:
Updates:
* Add a stub and overlay for the 'attrs' module.
Bug fixes:
* Fix parameterized attributes for dataclass subclasses.
* Mark dict views as reversible in Python 3.8+.
* Add missing memoryview.nbytes attribute.
* Fix chained attribute traces for python 3.10.
Version 2022.06.06:
Updates:
* Remove --enable-nested-classes, which has been a no-op since the last release.
* Support `__all__ += [...]` in pyi files.
* Add support for the TypedDict functional constructor.
* Add a `--backup` option to merge_pyi to copy the source file when overwriting.
* Add a merge_project binary to recursively merge files in a project.
Bug fixes:
* Preserve precise element types when adding two fixed-length tuples.
* Raise a meaningful exception when unpickling a pytd file fails.
* Don't check Literals when expanding compatible builtins.
* Fix a crash when applying a method decorator to a property.
* Fix some off-by-one errors in sequence unpacking.
* Fix a tuple addition crash.
* Fix a crash in the indexer.
Version 2022.05.19:
Updates:
* Default --enable-nested-classes to True. This flag will be removed in an
upcoming release.
* Use argument-by-argument matching for PyTDFunction in simple cases.
Bug fixes:
* Load symbols from typing when converting parametrised collection classes.
* Raise an error when referencing a nonexistent pyi file in another pyi file.
* Take `__all__` into account when importing `*` in pyi files.
* Support `from x import y` for stdlib modules in pickled pyi files.
* Preprocess source code to augment bare annotations in functions.
* Slightly change the format of the [signature-mismatch] error.
* Switch resolution order for nested and top-level classes in AddNamePrefix.
Version 2022.05.10:
Bug fixes:
* Improve the collections_abc overlay.
* Raise an exception for typed dict errors rather than logging them immediately.
* Reset matcher errors between individual parameter matches.
* --overriding-return-type-checks: Allow method return types to be changed when
the overridden type is NoReturn.
* Resolve GenericType nodes better in LookupLocalTypes.
Version 2022.05.05:
Updates:
* Update typeshed pin to commit 354787f from Apr 8.
* Remove --enable-typed-dicts, which has been a no-op since the last release.
* Add a group of feature flags for checking compatibility of signatures for
overriding methods:
* --overriding-default-value-checks
* --overriding-parameter-count-checks
* --overriding-parameter-name-checks
* --overriding-parameter-type-checks
* --overriding-return-type-checks
* Add code structure for gradual migration to argument-by-argument call
matching.
Bug fixes:
* Move a check out of --enable-nested-classes.
* Fix spurious not-callable error for typing.OrderedDict.
Version 2022.04.26:
Updates:
* Enable --enable-typed-dicts by default.
Bug fixes:
* Preserve the full name of imported TypedDicts.
* Stop dropping TypedDict annotations from local assignments.
* Don't mark fields of anonymous namedtuple parents as ClassVars.
* Instantiate imported TypedDicts to typed_dict.TypedDict, not Instance.
* Fix more typeshed circular dependency issues.
Version 2022.04.22:
Updates:
* Add support for `|` for Dicts in 3.9.
Bug fixes:
* Make a collection of bug fixes needed for nested class support.
* Handle attribute accesses on Final[...] constants from pyi files.
* Remove collections.OrderedDict from pytype.
* Remove duplicate NamedTuple class definition from typing.pytd.
* Evaluate late annotations before checking for 'TypeVar not in scope' error.
* Don't print Variable in error messages.
* Represent namedargs as a python dict throughout.
Version 2022.04.15:
Updates:
* Add basic Python 3.10 support.
* Instantiate pyi namedtuples directly as interpreter classes. This is a large
refactoring that also made namedtuple type-checking more precise, exposing a
fair number of type errors in user code.
* Remove the last traces of the no-longer-necessary --trace-all-classes flag.
Bug fixes:
* Allow __match_args__ in pyi files to be assigned a tuple value.
* Fix a bug in looking up attributes defined via variable annotation.
* Handle Unions better in byte_STORE_ATTR.
* Fix an [unbound-type-param] error.
* Call abstract.Dict.setitem directly when constructing a folded dict literal.
Version 2022.04.06:
Updates:
* Default --trace-all-classes to True.
* Add a --platform option to pytype.
Bug fixes:
* Fix for comparing recursive tuples for equality.
* Do a better job of determining whether a typing(_extensions) import is
allowed.
* Set TypedDict pyval items when instantiating a TypedDictClass.
* Don't raise duplicate-keyword-argument for positional-only arguments.
* Update definition of typing.get_type_hints.
Version 2022.03.29:
Updates:
* Add support for literal enums.
Bug fixes:
* Apply a couple of user-proposed fixes to merge-pyi.
* Handle subclasses in property_get.
* Convert type aliases in pyi files to aliases instead of constants.
* Generate new views when instantiating a value in output.py.
* Support partial forward references in pyi files.