forked from google/pytype
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCHANGELOG
1575 lines (1240 loc) · 55 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 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.
Version 2022.03.21:
Updates:
* Support typing.TypeAlias.
Bug fixes:
* Fix a crash when reporting an error for an undefined value.
* Fix TypedDictClass.instantiate(...) signature.
* Fix matching of Final[T] against T for imported final constants.
* Check IsVisible() before reporting errors in function.call_function.
Version 2022.03.08:
Updates:
* New feature flags:
* --trace-all-classes: traces class creation for better analysis of class
bodies.
* --strict-primitive-comparisons: catches illegal types in comparisons
involving primitives.
Once these features are stable, the flags will be removed and their behavior
made the default.
Bug fixes:
* Catch type errors when folding constants.
* Fix Callable argument count inconsistency for decorated instance methods.
* Fix a caching bug that caused closure variables to be reused.
* Still look up typing and typing_extensions types when reporting
not-supported-yet.
* Parse Python 3.10's new line number table format.
* Unpack ClassVar in constant_to_var so unions are handled correctly.
* Handle `__getitem__` correctly for typed dicts passed as function args.
* Allow using the `python3` executable if it matches the requested version.
Version 2022.02.23:
Bug fixes:
* Add mising magic methods to typing.Counter.
* Allow `<name>: Final = <Literal value>` in pyi files.
* Ignore some private attributes when doing pyi star imports.
Version 2022.02.17:
New features and updates:
* Update typeshed pin to commit fc60d02 from Feb 2.
* Support positional-only parameters.
Bug fixes:
* Recognize type-annotated callables as attributes in attrs classes.
* Python 3.9: fix crashes and bugs in directive handling.
* Support ellipses when __future__.annotations enabled.
* Support typed dicts in pyi files.
* Fix an error when checking for `__getitem__` on a metaclass.
* Remove TypedDict 'total' check that sometimes fires incorrectly.
Version 2022.02.08:
New features and updates:
* Remove the --allow-recursive-types flag. Recursive types are now fully
supported and the behavior of this flag is enabled by default.
Bug fixes:
* Don't raise a final-error when analysing the same method repeatedly.
* Get rid of an overly restrictive [not-callable] check in ParameterizedClass.
* Strip "__init__" from module names when checking supported versions.
* Finish a TODO in byte_GET_YIELD_FROM_ITER.
Version 2022.01.31:
New features and updates:
* Support typing.final and typing.Final.
* Rework directors.py's source parsing using LibCST.
* Show error name in red in Linux-like environments.
Bug fixes:
* Add fixes for instantiating a typed dict from an annotation.
* Prevent misfiring of "NoReturn is not allowed as inner type" error.
* Defer checking of `Final` so that it can be used with `Annotated`.
* Output typed dicts into the pyi file.
Version 2022.01.13:
New features and updates:
* Make available an initial implementation of recursive type aliases with a
feature flag, --allow-recursive-types. Once this feature is stable, the flag
will be removed and its behavior made the default.
* Allow using '...' as a top-level type annotation. This is an experimental
annotation that means "inferred type".
Bug fixes:
* Stop replacing unsubstituted type params in generic aliases with Any in stubs.
* Better handle type aliases with multiple options.
Version 2022.01.07:
New features and updates:
* Drop support for Python 3.6.
* Make classmethod and staticmethod generic.
Bug fixes:
* Fix a load_pytd bug involving circular dependencies and star imports.
Version 2022.01.05:
New features and updates:
* Add a feature flag, --enable-typed-dicts, for basic TypedDict support. Once
this feature is stable, the flag will be removed and its behavior made the
default.
* Delete --fix-module-collisions flag. It has been a no-op since the last
release.
* Add support for @attr.dataclass.
* Add a 'recursive' attribute to pytd.LateType.
* This is the last release that supports Python 3.6. Starting from the next
release, pytype will only support Python 3.7+.
Bug fixes:
* Don't report an unhelpful name error when YIELD_FROM yields nothing.
* Downgrade 'no MAKE_FUNCTION opcode found for decorator' to a warning.
* Improve an [invalid-annotation] error message.
* Fix a bug in parameterizing a generic type alias with a TypeVar.
* Fix ParamSpec bugs that are blocking typeshed.
Version 2021.12.15:
New features and updates:
* Enable --fix-module-collisions by default and make the flag a no-op. It will
be removed in the next release.
Bug fixes:
* Fix a bug in resolving dotted name types in load_pytd.
* Fix a Python 3.9 issue with `# pytype: disable=attribute-error` line numbers.
* Eliminate some spurious 'TypeVar not in scope' errors.
* Stop reporting weird name errors for ".0".
Version 2021.12.08:
New features and updates:
* Update typeshed pin to commit 3b6a52b from Nov 29.
Bug fixes:
* Recognize typing_extensions.SupportsIndex as a protocol.
* Allow summing anything with an __add__ method.
* Remove pytd optimizations that broke overloads.
* Fix a crash in --protocols mode.
* Add object.__dir__ to builtins.pytd.
Version 2021.11.29:
Bug fixes:
* Pass feature flags to the INFER command.
Version 2021.11.24:
New features and updates:
* Update typeshed pin to commit 7cc5eb2 from Aug 8.
* Remove pytype's ability to accept python_version=3.
* Rename pytype "master" branch to "main".
* Remove the --gen-stub-imports flag. This was a no-op as of version 2021.11.18.
* Look up local names in nested class scopes when importing pyi files.
* Consistently use "base" instead of "parent" to refer to base classes. This
changes the pickled representation of pytd.Class.
Bug fixes:
* Check for multiple module-level `__getattr__` overloads.
* Raise a not supported error for constructors in type annotations in pyi files.
* Fix a [not-instantiable] false positive.
* Add a feature flag, --fix-module-collisions, to fix a 'duplicate top-level
identifier' pyi issue.
* Don't enforce @abstractmethod and @coroutine consistency on properties.
Version 2021.11.18:
New features and updates:
* Enable --gen-stub-imports by default and make the flag a no-op. It will be
removed in the next release.
* Pass more precise argument types to contextmanager __exit__ methods.
* Add a helpful error message for use-after-delete.
Bug fixes:
* Recognize "/dev/null" as a package path in load_pytd.
* Remove references to the `__builtin__` module.
* Allow disables for invalid calls in 3.9 to be put on the same lines as in 3.7.
Version 2021.11.12:
New features and updates:
* Use the official pyi files from attrs.
* Report a type error when comparing types (e.g. int > str) and when calling an
overloaded comparison method like __gt__ fails.
* Ship Linux AArch64 wheels.
Bug fixes:
* Use a homogeneous tuple as a pytd node sort key.
* Fix crash in pytd.Lookup caused by ClassType with unfilled cls pointer.
* Fix a pytd printer bug that was causing us to print 'Optional[import ...]'.
* Fix a pytype bug in matching Literal against Literal.
* Fix a bug in which classmethods weren't detected as protocol members.
* --use-enum-overlay:
* Only add `__new__` to an enum if it has members to lookup.
* Skip potential enum members that are functions or have dunder names.
* Teach the enum overlay what a descriptor is.
* --allow-recursive-types:
* Fix infinite recursion in vm.init_class.
* Support recursive types in sub_one_annotation.
* Add support in visitors.LookupLocalTypes.
Version 2021.11.02:
New features and updates:
* Remove the --bind-properties flag. Its behavior has been made the default.
* Take advantage of module aliases to print prettier stub files.
* Add support for cross-module attr.s wrappers.
* Add a feature flag, --gen-stub-imports, to improve pyi import handling.
* Add a bit more support for PEP 612 in stubs.
Bug fixes:
* Add remove{prefix,suffix} methods for bytes, bytearray.
* Fix a bug where Errorlog.copy_from() duplicated error details.
* Fix some issues with handling module aliases in stub files.
* Support a [not-supported-yet] case in a generic class TypeVar renaming check.
* Add `__init__` attributes to canonical enum members.
Version 2021.10.25:
New features and updates:
* Completely remove the --preserve-union-macros flag. This was a no-op as of
version 2021.10.17.
* Add a new flag, --build-dict-literals-from-kwargs, to construct dict literals
for `dict(k=v, ...)`. This behavior will ultimately by enabled by default and
the flag removed.
* Add a new flag, --strict_namedtuple_checks, for typing.NamedTuple and
collections.namedtuple to inherit from fixed-length tuples. This behavior will
ultimately be enabled by default and the flag removed.
Bug fixes:
* Fix how the enum overlay calls `base_type.__new__`.
* Improve how the enum overlay chooses base types.
* When an `attr.ib()` call has type errors, construct the attrib anyway.
* Support builtin str removeprefix/removesuffix.
Version 2021.10.18
New features and updates:
* Completely remove the --attribute-variable-annotations flag. This was a no-op
as of version 2021.10.11.
* Enable --preserve-union-macros by default and make the flag a no-op. It will
be removed in the next release.
Bug fixes:
* Enum overlay: fix crash due to loading `__new__` from a PyTDClass.
* Enum overlay: use ClassVar to differentiate enum class attributes.
* Fix a parser bug involving nested class name conflicts.
* Fix a crash when lazily loading a missing submodule.
* Change PrintVisitor to group explicit imports with the ones collected from
type annotations.
Version 2021.10.11
New features and updates:
* Update pytype and typing annotation stubs for features added in attrs 21.1.0.
* Enable --attribute-variable-annotations by default and make the flag a no-op.
It will be removed in the next release.
* The --use-enum-overlay flag is ready for general use. Enable this flag for
precise typing of the stdlib enum library.
Bug fixes:
* Support quoted types as annotations in pyi files.
* Add precise overloads for the map function.
* Support Ellipsis annotations in pyi files.
* Preserve None in unions containing Any.
* Fix a pyi import printing bug.
* Improve ignored-abstractmethod error message.
* Teach convert._load_late_type to handle nested classes.
Version 2021.10.04
Bug fixes:
* Call init_class instead of instantiate when adding assertIsInstance bindings.
* Use the namedtuple 'defaults' argument when generating __new__ signature.
* Do not raise a parser error for unrecognised decorators.
* Merge BaseValue.cls and BaseValue.get_class().
* Check Instance.maybe_missing_members earlier during attribute access.
* Fix a bug in matching callables with TypeVar parameters.
Version 2021.09.27
New features and updates:
* Drop target Python 3.5 support.
* Remove the no-op --enforce-noniterable-strings flag.
* Support arbitrary python values for typing.Annotated in pyi files.
* Add more extensive type support for attr converters.
Bug fixes:
* Preserve named args in a function call when we have **kwargs in the arglist.
* Allow assertIsInstance to take a tuple of classes.
* Fix a bug in matching a Union against a TypeVar.
* Attach a line number to function call errors caused by annotating self.
* Add some missing namedtuple args.
Version 2021.09.09
New features and updates:
* Enable --enforce-noniterable-strings by default and make the flag a no-op. It
will be removed in the next release.
* Narrow the types of local variables based on test assertions.
* For bad return type annotations on generators, change invalid-type-annotation
to bad-yield-annotation error.
* Slightly improve pytype's performance on a trivial file.
Bug fixes:
* Fix our type definition for BaseException.with_traceback().
* Add some missing 3.8 methods to typing stubs.
* Add `breakpoint` to the supported builtin methods.
* Fix a bug in pytype's handling of late annotations.
* Typeshed: fix version parsing regex.
Version 2021.08.24
New features and updates:
* Update typeshed pin to commit 8da23e0 from July 30.
* Remove all Python 2 compatibility code.
* Print method signatures in the error message for a protocol type mismatch.
* Raise an error when comparing incompatible primitive types.
Bug fixes:
* Fix bugs in constant folding of f-strings.
* Fix a bug where typing_extensions.Protocol was treated as Any.
* Emit a pyi-error for an invalid annotation in a pyi file instead of crashing.
* Add an extra check to forbid matching Mapping too broadly.
Version 2021.08.11
New features and updates:
* Stop supporting target Python 2.
* Enable constant folding, a performance optimization that significantly speeds
up analysis of large data structure literals.
Bug fixes:
* Replace ParamSpec.{args,kwargs} with Any.
Version 2021.08.03
New features and updates:
* This is the last release of pytype that supports analyzing code in Python 2.7.
From the next release onward, pytype will only support Python 3.5+.
* Add a typing FAQ.
* Add a pytype_extensions.Dataclass protocol for matching any dataclass.
Bug fixes:
* Use [invalid-annotation] rather than [not-supported-yet] to report stray
TypeVars in variable annotations.
* Fix bugs in attribute matching for Protocol.
* Fix a bug in pytype's import resolution for relative imports.
Version 2021.07.27
New features and updates:
* Add more detailed [name-error] messages for UnboundLocalError and the like.
* Remove --check-parameter-types. Its behavior has been the default since
version 2021.07.19.
* Support generic namedtuples.
* Fix bugs and add features for --use-enum-overlay.
* Add a flag, --enforce-noniterable-strings, that forbids implicit iteration
over strings.
* Add support for attr converters.
Bug fixes:
* Get rid of a spurious 'appear only once in signature' TypeVar error.
* Fix a few protocol matching bugs.
* Fix exception handling bugs by tracking the frame state within
try/except/finally blocks.
Version 2021.07.19
New features and updates:
* Add a flag, --use-enum-overlay, for greatly improved support for the stdlib
enum library. The behavior of this flag will be enabled by default once it is
stable.
* Default --check-parameter-types to True.
* Take advantage of submodule version information in typeshed/stdlib/VERSIONS.
* typing.Protocol: support non-method attributes and modules, make error
messages more detailed, and fix several bugs.
* Remove --create-pyi-dataclasses and make its behavior the default.
* Do not try doing dead block elimination within try/except blocks.
Bug fixes:
* Handle unions correctly when dealing with exception types.
* Support adding typing.Mapping as a chex.dataclass base class.
* Get rid of some incorrect 'appears only once in signature' TypeVar errors.
* Fix a pyi error caused by _PropertyToConstant not recognizing imported
TypeVars.
* Allow more cases of valid typevars in variable annotations, typing.cast, and
attr.ib's 'type' argument.
* Allow bound class methods to match object.
* Allow bytearray.__contains__ to accept bytes.
Version 2021.06.17
New features and updates:
* Open source pytype_extensions, a library of type system extensions for use
with pytype.
* Add an assert_type statement to assert pytype's view of an expression type.
* Remove the [key-error] error class: it found few real type errors and produced
many false positives.
Bug fixes:
* Fix a bug that caused 'self' to be typed as 'Any' in @property bodies
(temporarily requires --bind-properties flag).
* Add support for multiple and chained assignments in pyi files.
* Support the 'Protocol[T, ...]' shorthand for generic protocols.
* Typeshed: support py2-only third-party packages with no top-level stubs.
Version 2021.05.25
New features and updates:
* Add support for referencing class-scoped TypeVars in variable annotations.
* Add support for generic dataclasses and attrs.
Bug fixes:
* Fix a performance regression in pytype/pytd/typeshed.py.
* Generate mutations from __init__ parameter annotations in stubs.
* Use the typeshed stub for the array module instead of a custom one.
Version 2021.05.19
New features and updates:
* Add support for PEP 604 (Union |) in stub files.
Bug fixes:
* Get rid of special_builtins.Filter.
* Fix circular import issues in the pytd loader.
Version 2021.05.14
New features and updates:
* Allow TypeGuard to be used in type stubs by rewriting TypeGuard[X] to bool.
Bug fixes:
* Fix the order of inherited attributes for dataclasses.
* Change the type of __path__ from Iterable to List.
* Add a replace() method to flax dataclasses.
Version 2021.05.11
Bug fixes:
* Report [not-supported-yet] instead of [import-error] for importing TypedDict.
* Fix a bug in attribute lookup from parent classes.
* Fix a Python 3.7 failure in typeshed/tests/pytype_test.py.
* pytd: populated mutated_type from annotated `self` parameters.
* Preserve kw_only attribute when inheriting attrs from a different module.
* Add a vm state to allow recursive construction of pytd values.
Version 2021.05.06