-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Comparing changes
Open a pull request
base repository: python/mypy
base: v1.10.1
head repository: python/mypy
compare: v1.11.0
Commits on Apr 15, 2024
-
Bump version to 1.11.0+dev (#17129)
The release branch has been cut: https://github.com/python/mypy/tree/release-1.10 Increase the dev version.
Configuration menu - View commit details
-
Copy full SHA for d6d9d8c - Browse repository at this point
Copy the full SHA d6d9d8cView commit details
Commits on Apr 16, 2024
-
fix: incorrect returned type of access descriptors on unions of types (…
…#16604) Fixes #16603 This change maps over union types when determining the types of access descriptors. Previously, the because [this conditional](https://github.com/md384/mypy/blob/c2a55afcef32ecb11a4c76c4c79539f6ba36d55c/mypy/checkmember.py#L697-L701) would fall through to the `else` case because instance type was not a singular `TypeType` (it was a Union), so we'd end up with an instance value being passed to `__get__` instead of `None`.
Configuration menu - View commit details
-
Copy full SHA for 0570f71 - Browse repository at this point
Copy the full SHA 0570f71View commit details
Commits on Apr 17, 2024
-
Error for assignment of functional Enum to variable of different name (…
…#16805) Relates to discussion in https://discuss.python.org/t/draft-of-typing-spec-chapter-for-enums/43496/11
Configuration menu - View commit details
-
Copy full SHA for df35dcf - Browse repository at this point
Copy the full SHA df35dcfView commit details
Commits on Apr 22, 2024
-
Fix Literal strings containing pipe characters (#17148)
Fixes #16367 During semantic analysis, we try to parse all strings as types, including those inside Literal[]. Previously, we preserved the original string in the `UnboundType.original_str_expr` attribute, but if a type is parsed as a Union, we didn't have a place to put the value. This PR instead always wraps string types in a RawExpressionType node, which now optionally includes a `.node` attribute containing the parsed type. This way, we don't need to worry about preserving the original string as a custom attribute on different kinds of types that can appear in this context. The downside is that more code needs to be aware of RawExpressionType.
Configuration menu - View commit details
-
Copy full SHA for 1072c78 - Browse repository at this point
Copy the full SHA 1072c78View commit details -
Update CONTRIBUTING.md to include commands for Windows (#17142)
Add command about how to activate virtual environment on Windows.
Configuration menu - View commit details
-
Copy full SHA for f7687d3 - Browse repository at this point
Copy the full SHA f7687d3View commit details -
Update CHANGELOG.md with draft for release 1.10 (#17150)
Initial pass at blog post for Release 1.10. Still need to add some information about the major changes. Pulled up 3 commits that seemed like we might want to write something about (under TODO), but they can move them to "Other Notable Changes and Fixes" if that's not the case.
Configuration menu - View commit details
-
Copy full SHA for 810a019 - Browse repository at this point
Copy the full SHA 810a019View commit details
Commits on Apr 23, 2024
-
Configuration menu - View commit details
-
Copy full SHA for c1460f8 - Browse repository at this point
Copy the full SHA c1460f8View commit details -
- add typeshed updates note - remove unreleased
Configuration menu - View commit details
-
Copy full SHA for 400eece - Browse repository at this point
Copy the full SHA 400eeceView commit details
Commits on Apr 24, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 43e130b - Browse repository at this point
Copy the full SHA 43e130bView commit details -
docs: remove six from the intersphinx mappings (#17165)
002f77c removed the last reference to six, so there is no need to pull down the six docs inventory
Configuration menu - View commit details
-
Copy full SHA for 82ebd86 - Browse repository at this point
Copy the full SHA 82ebd86View commit details
Commits on Apr 26, 2024
-
docs: Use lower-case generics (#17176)
Use lower-case `list`, `tuple`, `type` instead of `List`, `Tuple`, `Type` in documentation.
Configuration menu - View commit details
-
Copy full SHA for 6ebce43 - Browse repository at this point
Copy the full SHA 6ebce43View commit details
Commits on Apr 27, 2024
-
Log full path to config file in verbose output (#17180)
Contributes to #6544
Configuration menu - View commit details
-
Copy full SHA for a1900c2 - Browse repository at this point
Copy the full SHA a1900c2View commit details -
Pin MacOS version in GH actions (#17183)
Fix failing MacOS tests in CI Python 3.9 is not available on the latest MacOS images actions/setup-python#850 --------- Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 8bc7966 - Browse repository at this point
Copy the full SHA 8bc7966View commit details -
Configuration menu - View commit details
-
Copy full SHA for ba6febc - Browse repository at this point
Copy the full SHA ba6febcView commit details
Commits on May 1, 2024
-
Source commit: python/typeshed@f244be9
Configuration menu - View commit details
-
Copy full SHA for cd895ce - Browse repository at this point
Copy the full SHA cd895ceView commit details -
Run more tests in parallel (#17185)
At some point, Github Actions runners started having more cores: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
Configuration menu - View commit details
-
Copy full SHA for fb31409 - Browse repository at this point
Copy the full SHA fb31409View commit details
Commits on May 10, 2024
-
Add Error format support, and JSON output option (#11396)
### Description Resolves #10816 The changes this PR makes are relatively small. It currently: - Adds an `--output` option to mypy CLI - Adds a `ErrorFormatter` abstract base class, which can be subclassed to create new output formats - Adds a `MypyError` class that represents the external format of a mypy error. - Adds a check for `--output` being `'json'`, in which case the `JSONFormatter` is used to produce the reported output. #### Demo: ```console $ mypy mytest.py mytest.py:2: error: Incompatible types in assignment (expression has type "str", variable has type "int") mytest.py:3: error: Name "z" is not defined Found 2 errors in 1 file (checked 1 source file) $ mypy mytest.py --output=json {"file": "mytest.py", "line": 2, "column": 4, "severity": "error", "message": "Incompatible types in assignment (expression has type \"str\", variable has type \"int\")", "code": "assignment"} {"file": "mytest.py", "line": 3, "column": 4, "severity": "error", "message": "Name \"z\" is not defined", "code": "name-defined"} ``` --- A few notes regarding the changes: - I chose to re-use the intermediate `ErrorTuple`s created during error reporting, instead of using the more general `ErrorInfo` class, because a lot of machinery already exists in mypy for sorting and removing duplicate error reports, which produces `ErrorTuple`s at the end. The error sorting and duplicate removal logic could perhaps be separated out from the rest of the code, to be able to use `ErrorInfo` objects more freely. - `ErrorFormatter` doesn't really need to be an abstract class, but I think it would be better this way. If there's a different method that would be preferred, I'd be happy to know. - The `--output` CLI option is, most probably, not added in the correct place. Any help in how to do it properly would be appreciated, the mypy option parsing code seems very complex. - The ability to add custom output formats can be simply added by subclassing the `ErrorFormatter` class inside a mypy plugin, and adding a `name` field to the formatters. The mypy runtime can then check through the `__subclasses__` of the formatter and determine if such a formatter is present. The "checking for the `name` field" part of this code might be appropriate to add within this PR itself, instead of hard-coding `JSONFormatter`. Does that sound like a good idea? --------- Co-authored-by: Tushar Sadhwani <86737547+tushar-deepsource@users.noreply.github.com> Co-authored-by: Tushar Sadhwani <tushar@deepsource.io>
Configuration menu - View commit details
-
Copy full SHA for 35fbd2a - Browse repository at this point
Copy the full SHA 35fbd2aView commit details
Commits on May 15, 2024
-
Source commit: python/typeshed@a9d7e86
Configuration menu - View commit details
-
Copy full SHA for b4f9869 - Browse repository at this point
Copy the full SHA b4f9869View commit details -
[dmypy] sort list of files for update by extension (#17245)
dmypy receives the list of updated files via `--update` flag. If this list contains both `foo.py` and `foo.pyi`, the order matters. It seems to process the first file in the list first. But if we have a `.pyi` file, we want this to be processed first since this one contains the typing information. Let's reverse sort the list of updated files by the extension. This should be a simple enough fix to resolve this. Though there might be some edge cases where the list of files to update contains just pyi files, but we might need to recheck the equivalent py files even if not explicitly updated.
Configuration menu - View commit details
-
Copy full SHA for 0a2225b - Browse repository at this point
Copy the full SHA 0a2225bView commit details -
Ignore typeshed test files (#17249)
During the last typehed update, we included the `@tests` folder which is unnecessary for mypy. Update the `sync-typeshed.py` script to exclude it in the future. Refs: - #17246 - python/typeshed#11762 --------- Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for cdc956b - Browse repository at this point
Copy the full SHA cdc956bView commit details
Commits on May 17, 2024
-
Fix for type narrowing of negative integer literals (#17256)
Configuration menu - View commit details
-
Copy full SHA for b74829e - Browse repository at this point
Copy the full SHA b74829eView commit details -
[PEP 695] Partial support for new type parameter syntax in Python 3.12 (
#17233) Add basic support for most features of PEP 695. It's still not generally useful, but it should be enough for experimentation and testing. I will continue working on follow-up PRs after this has been merged. This is currently behind a feature flag: `--enable-incomplete-feature=NewGenericSyntax` These features, among other things, are unimplemented (or at least untested): * Recursive type aliases * Checking for various errors * Inference of variance in complex cases * Dealing with unknown variance consistently * Scoping * Mypy daemon * Compilation using mypyc The trickiest remaining thing is probably variance inference in cases where some types aren't ready (i.e. not inferred) when we need variance. I have some ideas about how to tackle this, but it might need significant work. Currently the idea is to infer variance on demand when we need it, but we may need to defer if variance can't be calculated, for example if a type of an attribute is not yet ready. The current approach is to fall back to covariance in some cases, which is not ideal. Work on #15238.
Configuration menu - View commit details
-
Copy full SHA for 5fb8d62 - Browse repository at this point
Copy the full SHA 5fb8d62View commit details -
[PEP 695] Implement new scoping rules for type parameters (#17258)
Type parameters get a separate scope with some special features. Work on #15238.
Configuration menu - View commit details
-
Copy full SHA for 3b97e6e - Browse repository at this point
Copy the full SHA 3b97e6eView commit details
Commits on May 18, 2024
-
Added [prop-decorator] code for unsupported property decorators (#14461…
…) (#16571) Using a decorator before a @Property now results in the narrower `prop-decorator` code, which is a subcode of `misc` for backward compatibility. I would have preferred to add a more general Unsupported error code and have this be a subcode of that, but this has to be a subcode of misc for backward compatibility. Fixes #14461
Configuration menu - View commit details
-
Copy full SHA for dfab362 - Browse repository at this point
Copy the full SHA dfab362View commit details -
[mypyc] Show traceback when emitfunc unit test fails (#17262)
This makes debugging test failures easier.
Configuration menu - View commit details
-
Copy full SHA for 12837ea - Browse repository at this point
Copy the full SHA 12837eaView commit details -
Support rename=True in collections.namedtuple (#17247)
A pretty marginal feature but it's now tested in the typing conformance suite, and it was easy to add support. For reference: https://github.com/python/typing/blob/9f7f400bb7c4c79f1fb938402e0bb3198dac0054/conformance/tests/namedtuples_define_functional.py#L46, https://github.com/python/cpython/blob/7d8725ac6f3304677d71dabdb7c184e98a62d864/Lib/collections/__init__.py#L389
Configuration menu - View commit details
-
Copy full SHA for 828c0be - Browse repository at this point
Copy the full SHA 828c0beView commit details -
stubtest: changes for py313 (#17261)
Technically it feels like we should be able to put the new dunders on `type` or something, but that wasn't enough to make false positives go away. But also we might not want to do that because it only applies to pure Python types
Configuration menu - View commit details
-
Copy full SHA for 1c83463 - Browse repository at this point
Copy the full SHA 1c83463View commit details -
Configuration menu - View commit details
-
Copy full SHA for c27f4f5 - Browse repository at this point
Copy the full SHA c27f4f5View commit details
Commits on May 19, 2024
-
[mypyc] Allow specifying primitives as pure (#17263)
Pure primitives have no side effects, take only immutable arguments, and never fail. These properties will enable additional optimizations. For example, it doesn't matter in which order these primitives are evaluated, and we can perform common subexpression elimination on them. Only mark a few primitives as pure for now, but we can generalize this later.
Configuration menu - View commit details
-
Copy full SHA for ac8a5a7 - Browse repository at this point
Copy the full SHA ac8a5a7View commit details
Commits on May 20, 2024
-
Stubtest: ignore
_ios_support
(#17270)Trying to import this module on py313 raises RuntimeError on Windows, and it doesn't seem important
Configuration menu - View commit details
-
Copy full SHA for e8a2630 - Browse repository at this point
Copy the full SHA e8a2630View commit details
Commits on May 21, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 3579c61 - Browse repository at this point
Copy the full SHA 3579c61View commit details -
Add support for __spec__ (#14739)
Fixes #4145 Co-authored-by: Joongi Kim <me@daybreaker.info>
Configuration menu - View commit details
-
Copy full SHA for f5afdcd - Browse repository at this point
Copy the full SHA f5afdcdView commit details -
Fix case involving non-ASCII chars on Windows (#17275)
Fixes #16669 One can replicate this error in Windows using Python3.8 just by calling the mypy/pyinfo.py module using a slightly modified code of the `get_search_dirs` function where the python executable doesn't match the value of sys.executable. The only modification made to this code from `get_search_dirs` is the adding of a non-ascii-path to the env parameter
Configuration menu - View commit details
-
Copy full SHA for 2892ed4 - Browse repository at this point
Copy the full SHA 2892ed4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 42157ba - Browse repository at this point
Copy the full SHA 42157baView commit details -
Automatically set -n=0 when running tests with --update-data (#17204)
Unless there is a reason to have the error, I think this improves the developer experience.
Configuration menu - View commit details
-
Copy full SHA for 99dd314 - Browse repository at this point
Copy the full SHA 99dd314View commit details -
fix: annotated argument's
var
node type is explicit, not inferred (#……17217) Fixes #17216 During conversion from a standard library AST to the mypy AST, `Var` nodes were being created inside `Argument` nodes without acknowledging the presence of a type annotation, leading to the `Var` node's type as being always set as *inferred*: https://github.com/python/mypy/blob/fb31409b392c5533b25173705d62ed385ee39cfb/mypy/nodes.py#L988 This causes an error at https://github.com/python/mypy/blob/fb31409b392c5533b25173705d62ed385ee39cfb/mypyc/irbuild/expression.py#L161-L164 The fix simply acknowledges any presence of a type annotation, so the type of the relevant `Var` node is no longer considered inferred if an annotation is present.
Configuration menu - View commit details
-
Copy full SHA for ca393dd - Browse repository at this point
Copy the full SHA ca393ddView commit details
Commits on May 23, 2024
-
Add support for functools.partial (#16939)
Fixes #1484 Turns out that this is currently the second most popular mypy issue (and first most popular is a type system feature request that would need a PEP). I'm sure there's stuff missing, but this should handle most cases.
4Configuration menu - View commit details
-
Copy full SHA for 0871c93 - Browse repository at this point
Copy the full SHA 0871c93View commit details -
Validate more about overrides on untyped methods (#17276)
This commit fixes #9618 by making MyPy always complain if a method overrides a base class method marked as `@final`. In the process, it also adds a few additional validations: - Always verify the `@override` decorator, which ought to be pretty backward-compatible for most projects assuming that strict override checks aren't enabled by default (and it appears to me that `--enable-error-code explicit-override` is off by default) - Verify that the method signature is compatible (which in practice means only arity and argument name checks) *if* the `--check-untyped-defs` flag is set; it seems unlikely that a user would want mypy to validate the bodies of untyped functions but wouldn't want to be alerted about incompatible overrides. Note: I did also explore enabling the signature compatibility check for all code, which in principle makes sense. But the mypy_primer results indicated that there would be backward compability issues because too many libraries rely on us not validating this: #17274
Configuration menu - View commit details
-
Copy full SHA for 25087fd - Browse repository at this point
Copy the full SHA 25087fdView commit details
Commits on May 24, 2024
-
Mypybot/sync typeshed (#17280)
Sync typeshed before 1.11 release. --------- Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Co-authored-by: AlexWaygood <alex.waygood@gmail.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 43a605f - Browse repository at this point
Copy the full SHA 43a605fView commit details
Commits on May 25, 2024
-
Support unions in functools.partial (#17284)
Co-authored-by: cdce8p
Configuration menu - View commit details
-
Copy full SHA for 3ddc009 - Browse repository at this point
Copy the full SHA 3ddc009View commit details -
Fix stubgen for Python 3.13 (#17290)
__firstlineno__ and __static_attributes__ are new in 3.13. __annotate__ will be new in 3.14, so we might as well add it now. I tried to run the test suite on 3.13. There are a ton of compilation failures from mypyc, and a number of stubgen failures that this PR will fix.
Configuration menu - View commit details
-
Copy full SHA for 66b48cb - Browse repository at this point
Copy the full SHA 66b48cbView commit details -
Configuration menu - View commit details
-
Copy full SHA for fa2aefc - Browse repository at this point
Copy the full SHA fa2aefcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9315d62 - Browse repository at this point
Copy the full SHA 9315d62View commit details
Commits on May 26, 2024
-
Don’t leak unreachability from lambda body to surrounding scope (#17287)
Fixes #17254 Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Configuration menu - View commit details
-
Copy full SHA for 5059ffd - Browse repository at this point
Copy the full SHA 5059ffdView commit details
Commits on May 28, 2024
-
Configuration menu - View commit details
-
Copy full SHA for f60f458 - Browse repository at this point
Copy the full SHA f60f458View commit details
Commits on May 30, 2024
-
[PEP 695] Detect errors related to mixing old and new style features (#…
Configuration menu - View commit details
-
Copy full SHA for 7032f8c - Browse repository at this point
Copy the full SHA 7032f8cView commit details -
[PEP 695] Support recursive type aliases (#17268)
The implementation follows the approach used for old-style type aliases. Work on #15238.
Configuration menu - View commit details
-
Copy full SHA for 0820e95 - Browse repository at this point
Copy the full SHA 0820e95View commit details -
Configuration menu - View commit details
-
Copy full SHA for 77cfb98 - Browse repository at this point
Copy the full SHA 77cfb98View commit details
Commits on May 31, 2024
-
Configuration menu - View commit details
-
Copy full SHA for c3bbd1c - Browse repository at this point
Copy the full SHA c3bbd1cView commit details
Commits on Jun 2, 2024
-
Update 'typing_extensions' to >=4.6.0 to fix python 3.12 error (#17312)
With earlier versions of typing_extensions, the following traceback is seen: ``` Traceback (most recent call last): File ".../bin/mypy", line 5, in <module> from mypy.__main__ import console_entry File ".../lib/python3.12/site-packages/mypy/__main__.py", line 9, in <module> from mypy.main import main, process_options File ".../lib/python3.12/site-packages/mypy/main.py", line 12, in <module> from typing_extensions import Final File ".../lib/python3.12/site-packages/typing_extensions.py", line 1174, in <module> class TypeVar(typing.TypeVar, _DefaultMixin, _root=True): TypeError: type 'typing.TypeVar' is not an acceptable base type ``` The error is addressed in typing_extensions in python/typing_extensions#162, which is included in the 4.6.0 release.
Configuration menu - View commit details
-
Copy full SHA for 2116386 - Browse repository at this point
Copy the full SHA 2116386View commit details
There are no files selected for viewing