2 Star 0 Fork 0

mirrors_google / pytype

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
CHANGELOG 68.15 KB
一键复制 编辑 原始数据 按行查看 历史
rechen 提交于 2024-04-11 15:09 . Prepare a PyPI release.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959
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.
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
New features and updates:
* Update typeshed pin to commit 2c8cb60 from Apr 27.
Bug fixes:
* Add typing._Alias.
* Pin attrs to 20.3.0.
Version 2021.05.04
New features and updates:
* Remove --check-attribute-types, --check-container-types, and
--check-variable-types flags. Their behaviors are now enabled by default.
* Add a temporary --preserve-union-macros flag that preserves Union generic type
aliases in type stubs. This behavior will ultimately be enabled by default and
the flag removed.
* Support max versions in typeshed VERSIONS file.
Bug fixes:
* Add typing.GenericMeta stub.
* Fix handling of typeshed/stdlib/@python2.
Version 2021.04.26
New features and updates:
* Enable --check-attribute-types, --check-container-types, and
--check-variable-types by default. These flags will soon be removed.
* Add a fix suggestion for [annotation-type-mismatch] with a None value.
* Add a temporary --attribute-variable-annotations flag that applies PEP
526-style annotations on attribute assignments. This behavior will ultimately
be enabled by default and the flag removed.
* Add a temporary --create-pyi-dataclasses flag that creates dataclasses from
@dataclass-annotated classes in type stubs. This behavior will ultimately be
enabled by default and the flag removed.
Bug fixes:
* Don't lose track of attributes when @typing.final is used.
* Fix generation of type information for nested typing.NamedTuple classes.
* Fix some bugs in handling of generic type aliases.
* Fix a pytype crash on a generic protocol.
* For method aliasing in pyi files, consider base classes when doing lookup.
Version 2021.04.15
New features and updates:
* Update typeshed pin to commit ce24720 from Jan 27, and drop support for the
old typeshed directory structure.
* Delete the --check-nonnull-parameter-types flag.
Bug fixes:
* Add "from typing import overload" statement when using @overload.
* Add object.__delattr__ to our builtins stubs.
* Add some more support for generic type aliases.
Version 2021.04.09
New features and updates:
* Enable --check-parameter-types by default for non-None default values.
* Add some minimal support for PEP 612 in type stubs.
* Add support for typing.Annotated in pyi files.
Bug fixes:
* Fix a crash when analysed code accessed an undefined closure cell.
* Fix a minor bug in pytype's expansion of Protocol[T].
* Check starargs and starstarargs when gathering TypeVars in function sigs.
* Fix some bugs in pytype's handling of the new typeshed directory structure.
* Make sure `collections.defaultdict.__init__` always accepts kwargs.
* Filter out properties from class attributes when constructing dataclasses.
* Add gi_* fields to Generators.
Version 2021.04.01
New features and updates:
* Add basic Python 3.9 support.
Bug fixes:
* Fully support method aliasing in stub files.
* Improve pytype's handling of sets.
Version 2021.03.22
New features and updates:
* Support inheritance from dataclasses defined in pyi files.
Bug fixes:
* Don't check attribute values against types from pyi files.
* Add a missing array.array.frombytes method.
* Fix the pyi type of attributes annotated with class type parameters.
* Allow annotation-type-mismatch directives to be put on more sensible lines.
* Pass ninja relative paths instead of absolute ones.
Version 2021.03.10
New features and updates:
* Basic support for defining dataclasses in pyi files.
* Enable more of --check-attribute-types by default.
* Get rid of the legacy pyi parser.
Bug fixes:
* Fix a circular import error (#760).
* Make NotImplementedType inherit from bool.
* Fix a caching bug that caused incorrect function parameter defaults.
Version 2021.03.03
New features and updates:
* Enable part of --check-attribute-types by default.
Bug fixes:
* Allow callable constants to match protocol methods.
* Allow builtins.tuple to be used for a heterogeneous tuple annotation.
* Don't report [not-instantiable] when instantiating an abstract annotation.
* Take a TypeVar's bound into account when instantiating it in attribute.py.
* Use typeshed stubs in preference to empty stubs.
* Fix a bug where multiple definitions of a TypeVar could end up in a stub.
* Fix a caching bug in check_container_types.
* Fix initialization of Union types in forward references.
Version 2021.02.23
New features and updates:
* Support running pytype under Python 3.9. (Does not yet support analyzing 3.9
code; see details in https://github.com/google/pytype/pull/840.)
* Update typeshed pin to commit 869238e from Jan 26.
Bug fixes:
* Do stricter filtering of container_type_mismatch errors.
* Preserve the concrete value of TYPE_CHECKING in method bodies.
* Support using collections.abc.Callable in type stubs.
Version 2021.02.19
Bug fixes:
* Fix 'nothing' parameter inference for self in custom generic classes.
* Fix several cases of class type parameters being instantiated incorrectly.
* Fix an if-splitting bug by (mostly) ignoring cycles in the CFG.
* Use match_var_against_type, not match_from_mro, for check_container_types.
Version 2021.02.09
New features and updates:
* Replace namedtuples with attrs in our PyTD representation.
Bug fixes:
* Improve error messaging for typing.AnyStr.
* Fully qualify `std::size_t` to avoid platform incompatibilities.
* Add isascii attribute to str, bytes, and bytearray.
* Support isinstance() checks on tuples of typing containers.
* Improve *args and **kwargs forwarding for attrs and dataclasses.
* Don't propagate attribute errors for deleted names.
Version 2021.01.28
New features:
* Update typeshed pin to commit 8c20938 from Nov 13.
* Implement basic support for PEP 593.
* Support typeshed's new directory structure.
Bug fixes:
* Support aliases attr.attrs for attr.s, and attr.attrib for attr.ib.
* --check-container-types: fix a crash and improve the error message.
Version 2021.01.21
* Switch to a typed_ast-based stub parser.
* Fix matching of NamedType against LiteralType in --protocols mode.
* Fix: super() in a list comprehension needs to look at the enclosing frame.
Version 2021.01.14
* Fix some corner cases with unpacking and function args.
* Add ImportError attributes name, path for Python 3.3+.
* Unbreak annotate-ast by adding an empty pytype/ast/__init__.py file.
Version 2021.01.08
* Automatically add a .gitignore file to the pytype output directory.
* Do not allow python keywords in pytd files.
* Fix: Don't infer Callable parameters when there are kwonly params.
* Fix: Represent empty tuples as TupleType(()).
* Fix: add __init__ and __contains__ to dict view classes.
Version 2020.12.23
* Support using a union to filter types out of a type parameter.
* Fix the attribute type obtained from `attr.ib(default=())`.
Version 2020.12.16
* Support NewType in stubs.
* Treat classes whose metaclass inherits from type(Protocol) as abstract.
* Automatically promote __init_subclass__ to a classmethod.
* Improve unpacking and function arg matching by tracking unpacked iterables.
* Fix a [name-error] caused by a bad regex check for comprehensions.
* Strip carriage returns from files read as bytes.
* Support using an AnnotationClass in an isinstance check.
* Support aliases to methods of classes in the same module in the pyi parser.
Version 2020.12.02
* Update typeshed pin to commit fae6bda from October 12.
* Improve the [bad-return-type] error message.
Version 2020.11.23
* Treat modules as hashable.
* Support typing_extensions.Literal in source files.
* Take classmethods and staticmethods into account in protocols.
Version 2020.11.12
* Support `# type: ignore[errorcode, ...]` in pyi files.
* Always allow classes to match typing.Hashable.
* Fix a bug in pytype's handling of Literal[<str>].
Version 2020.11.03
* Drop support for running pytype under Python 3.5.
* Add a dependency on pybind11 for new typegraph metrics.
* merge-pyi support for "import collections.abc as abc" style imports.
Version 2020.10.08
* Add runtime_checkable to typing.pytd.
Version 2020.09.29
* Fix a bug in attaching function type comments to opcodes.
* Use `py -x.y` instead of `pythonx.y` for windows.
Version 2020.09.24
* Fix a bug involving multiple super calls.
* Support tuple slicing.
* Make all tests pass in Python 3.8.
* Respect all typing re-exports in the pyi parser.
* Create C++ metrics classes for tracking typegraph metrics.
* Update attrs pytd files to support version 20.2.0.
Version 2020.09.16
* Fix a parser bug when importing and re-exporting a submodule.
* Call `python -m ninja` instead of `ninja`.
* Don't crash when processing a pyi containing __all__.
* Convert Bindings() to a list in cfg.py.
Version 2020.09.14
* Drop the --python_exe option.
* Have check_py and generate_pyi accept a source string instead of a filename.
* Pass around an options.open_function that is used in place of builtins.open.
* Fix some Python 3.8 bugs.
* Fix python-incompatible syntax in pytd files.
* Print 'leaving directory' after ninja command.
* Support sys.version_info tuple checks that do not use slicing.
Version 2020.08.28
* Let multiple PyTDFunction signatures match when *args/**kwargs is present.
Version 2020.08.17
* Allow `# type: ignore` in more places in pyi files.
* Support TypedDict function-based syntax in pyi files.
* Add more developer documentation.
Version 2020.08.10
* Support aliases to unions with type parameters.
* Don't crash when a nested NamedTuple subclass hits max depth.
* Support kw_only arg to attr.ib.
* Add more developer documentation.
Version 2020.07.30
* Allow typing.AnyStr to be used to parameterize custom generic classes.
* FIX: We were occasionally reusing an exhausted generator in Union constructor.
* Support imported type macros in pyi files.
* When raising not-supported-yet for Alias = Union[T, ...] set the type to Any.
Version 2020.07.24
* pyi parser: allow aliases inside a class to values outside the class.
* Copy annotations instead of modifying them when adding a scope.
* Make self.__class__ return Any in __init__.
* Check object visibility before setting attributes.
Version 2020.07.20
* pyi parser: support importing TypedDict from typing_extensions.
Version 2020.07.14
* Populate the `cls` arg in classmethods with the class type.
* Log [not-supported-yet] as soon as a recursive type alias is defined.
* pyi parser: allow the 'total' keyword for subclasses of TypedDict.
* Make collections.OrderedDict reversible.
* Make the behavior of io.open match builtins.open.
* Add/fix some opcodes for Python 3.8.
Version 2020.06.26
* Treat objects as True in a boolean context, unless explicitly overridden.
* If cls is the class argument of Foo.__new__, treat `cls is Foo` as ambiguous.
* Add basic support for third-party flax dataclasses.
* Autodetect number of jobs with --jobs auto.
Version 2020.06.01
* Update typeshed pin to commit 5fe6a5b from May 18.
* Support callback protocols.
* Get rid of the RemoveInheritedMethods pyi optimisation.
* (In-progress) Add partial Python 3.8 support.
Version 2020.05.13
* Check attrs default values against annotations.
* Add an experimental --check-variable-types mode.
Version 2020.05.07
* Drop support for analyzing Python 3.4.
* Add special builtins support for filter(None, xs).
* Open-source a developer doc on minor version upgrades.
* Improve support for @typing.overload.
* Improve annotated decorators' handling of classes.
Version 2020.04.22
* Drop support for running pytype under Python 2.
* Report [not-supported-yet] when aliasing Union[T, ...].
* Add typing.OrderedDict.
* Improve how annotations are tracked and applied.
* Allow functions to match types.FunctionType.
* Don't report [invalid-typevar] when type() is called on a TypeVar.
Version 2020.04.01
* Do some test restructuring and cleanup.
Version 2020.03.19
* Fix a couple of pytype crashes.
* Do not allow mixing string types in IO.write() in Python 3.
Version 2020.02.20
* Stop rewriting (x: X = None) to (x: Optional[X] = None).
Version 2020.02.06
* Update typeshed pin to commit d5851ec from January 24.
Version 2020.01.24
* Don't fail on mypy-style '# type: ignore[code, ...]' comments.
* Support separating disabled error classes by whitespace in addition to commas.
Version 2020.01.08
* Support @typing.type_check_only on classes and functions in pyi files.
Version 2020.01.07
* Add a 2020 Q1 roadmap.
* Improve handling of forward references with type errors.
Version 2019.12.17
* Improve support for forward references and function type comments.
* Support typing.ClassVar and dataclasses.InitVar.
* Fix some attrs and dataclasses bugs.
Version 2019.12.06
* Update typeshed pin to commit f7f6860 from December 1.
* Allow running pytype-single as `python -m pytype-single`.
Version 2019.11.27
* Support using typing.Counter as a generic.
* Handle non-utf8 string literals without crashing in host Python 3.
* Allow running pytype as `python -m pytype`.
* Add a `-j/--jobs` option to pytype.
* Detect and raise errors for recursive type aliases, rather than crashing.
Version 2019.10.17
* Make Python 2 metaclass declarations an error in Python 3.
* Add basic support for dataclasses.
* Open-source a partial numpy type stub.
* Fix some bugs in the pyi parser.
Version 2019.09.17
* Update typeshed pin to commit 668988f from September 5.
Version 2019.09.06
* Update typeshed pin to commit ce0f5b2 from August 22.
Version 2019.08.29
* Improve the usability of the pytype.io module.
* Add basic callgraph generation to pytype.tools.xref.
* Update typeshed pin to commit fab2ee0 from August 16.
* Add an experimental --precise-return mode.
Version 2019.08.09
* Partially support typing[_extensions].Literal in pyi files.
* Adopt a unicode pytype logo.
* Add a traces library for accessing pytype's inferred type information.
* Add `annotate-ast` subtool for annotating ASTs with type information (WIP).
Version 2019.07.30
* Allow trailing commas in lists in type stubs.
Version 2019.07.26
* Update typeshed pin to commit 40215d1 from July 18.
* Improve support for subprocess.Popen in Python 3.
Version 2019.07.11
* Update typeshed pin to commit e1e5c83 from July 1.
* Support `async def` in pyi files.
Version 2019.06.28
* Fix attrs bugs.
* Check exception types in `except` blocks.
Version 2019.06.21
* Support typing.overload in source files.
* Fix merge-pyi bugs.
* Support basic attrs usage.
Version 2019.05.31
* Add an xref output mode that creates a (lineno, column) -> type map.
* Fix an AnyStr bug in the Python 2 filter() definitions.
Version 2019.05.24
* Fix an import bug.
* Support extracting pytype types from xref.
Version 2019.05.15
* Update typeshed pin to commit 50d98ac from May 13.
* Support nested classes in pyi files.
Version 2019.05.08
* Fix a bug in pyi lookup of re-exported imports.
Version 2019.05.06
* Update typeshed pin to commit 4e572ae from April 23.
* Support collections.namedtuple in pyi files.
* Support module aliases in pyi files.
Version 2019.04.26
* Improve typegraph performance.
Version 2019.04.19
* Support method matching for custom PEP 544 protocols.
Version 2019.04.12
* Update typeshed pin to commit cfa65b8 from April 8.
* Fix comparisons of primitive objects of the same type.
* Limit the number of tracebacks shown for one error.
Version 2019.04.05
* Improve Python 3 definitions in pytype's enum and typing stubs.
Version 2019.04.02.1
* Require typed_ast only in Python 3.3+.
Version 2019.04.02
* Simplify the text pytype prints to the terminal.
* Rename the default pytype output directory from pytype_output to .pytype.
* Add a --no-cache option to send pytype output to a temporary directory.
* Update typeshed pin to commit 9b9ff64 from March 29.
* Support typing.ChainMap and typing.Counter.
Version 2019.03.27
* Support `# type: ignore` on import lines in pyi files.
Version 2019.03.21
* Update typeshed pin to commit afe6656 from March 16.
* Add missing Python 3 methods {bytearray,list}.{clear,copy}.
Version 2019.03.15
* Make --parse-pyi verify that the AST has been resolved.
* Fix pyi parsing of `typing` aliases.
* Remove mirror of asyncio.tasks stub in favor of the canonical typeshed one.
* Support type macros in pyi files.
Version 2019.03.08
* Fix bad type definitions for builtins reversed and enumerate.
Version 2019.03.01
* Make pytype's type stubs loadable in Python 3.4.
Version 2019.02.13
* Support asynchronous generators.
* Fix variable annotations in Python 3.7.
* Fix a pyi circular import bug.
Version 2019.01.30
* Support future.utils.with_metaclass.
* Support coroutine annotation.
Version 2019.01.18
* Add support for unittest.TestCase.setUp().
* Open-source a user guide.
* Open-source the FAQ.
Version 2018.12.21
* Improve support and add testing framework for target Python 3.7.
* Handle files that generate parse errors more gracefully.
Version 2018.12.11
* Add rudimentary support for target Python 3.7.
* Make error messages for Python operators friendlier.
* Set the default target python version to the host version.
* Change default behavior to stop at first error and add a --keep-going option.
* Flag annotations with the wrong parameter count and invalid uses of NoReturn.
* Improve pytype and merge-pyi status messages.
* Support PEP-526 variable annotation syntax.
Version 2018.11.06
* Use --imports_info to allow preserving generated type stubs between runs.
* Handle TypeParameter inheritance more robustly with a union-find approach.
* Get more precise deps from importlab to allow build parallelization.
* Trim the dependencies of builtin and system files from the import graph.
* Generate a build.ninja file and call pytype-single via ninja.
Version 2018.10.30
* Improve the display of tracebacks in error messages.
* Make several Python 3 fixes and improvements, including better enum support.
* Fix evaluation of conditionals inside closures.
* Improve handling of comparison operators.
* Add a --strict-import option to not load submodules not explicitly imported.
Version 2018.09.26
* Generate default type stubs for pip-installed dependencies.
* Remove the output directory at the start of each pytype run.
Version 2018.09.25
* Improve Python 3 varargs and kwargs support.
* Support user-defined generic types.
* Improve --generate-config to show a full sample config file.
Version 2018.09.19
* Allow the command-line `inputs` option to be specified in a config file.
* Support hidden files.
* Make the behavior of --exclude more intuitive.
Version 2018.09.18
* Support setting --exclude in a config file.
* Add support for annotations in inner functions.
* Officially support running under Python 3.7.
Version 2018.09.07.1
* Update typeshed pin to commit c968124 from September 6.
Version 2018.09.07
* Make typing.NamedTuple a class for Python 3.6+.
Version 2018.08.10
* Add --exclude flag to support excluding files or directories from analysis.
Version 2018.07.13
* Improve type checking of typing.Generator.
* Enable logging from C++ in debug builds.
* Expose pytype-single's return code.
* Add the ability to record trace data during bytecode execution.
Version 2018.06.19
* Tweak the installation instructions and add a quickstart guide.
Version 2018.06.18
* Document pytype's platform support.
Version 2018.06.15
* Officially support running under Python 3.5 and 3.6.
* Expose pytype-single's --version option.
* Optimization: skip argument parameter combinations we've already seen.
* Bring back pytype-single's --timeout option.
* Add --return-success to pytype-single to report errors but return success.
Version 2018.06.05
* Print transient progress messages.
* Rename pytype to pytype-single and pytype-all to pytype.
* Use the system and site package dependencies found by importlab in pytype-all.
* Make the pytype-all help message friendlier.
* Allow pytype-single args to be specified in a config file.
* Add a merge-pyi subtool to merge pyi files into their Python sources.
* Expose some pytype-single options to pytype-all.
* Add a script which runs pytype tests.
* Allow specifying config file variables for pytype-all on the command line.
* Add a --version option to display the pytype version.
Version 2018.05.22.1
* Use different flags when compiling with gcc or clang.
Version 2018.05.22
* Add flags for building with clang on Mac OS X.
* Allow pytype-all to accept directories as input.
* Change pytype-all's config file to INI style, and fall back to setup.cfg.
* Make analyze_annotated a command-line option.
* Add pythonpath guessing to pytype-all.
Version 2018.05.15
* Make some fixes to the release packaging.
Version 2018.05.14
* Release pytype-all.
Version 0.2
* Release pytype.
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_google/pytype.git
git@gitee.com:mirrors_google/pytype.git
mirrors_google
pytype
pytype
main

搜索帮助

344bd9b3 5694891 D2dac590 5694891