14
0
forked from pool/python-mypy

33 Commits

Author SHA256 Message Date
dadf1232c4 Convert to libalternatives, bsc#1245883 2025-11-03 14:54:59 +01:00
5dbbee55a0 Accepting request 1281381 from devel:languages:python
- Remove upstreamed mypy-1.14.1-gcc15.patch
- Update to 1.16.0:
    Different Property Getter and Setter Types
    Mypy now supports using different types for a property getter and setter:
    class A:
        _value: int
        @property
        def foo(self) -> int:
            return self._value
        @foo.setter
        def foo(self, x: str | int) -> None:
            try:
                self._value = int(x)
            except ValueError:
                raise Exception(f"'{x}' is not a valid value for 'foo'")
    This was contributed by Ivan Levkivskyi (PR 18510).
    Flexible Variable Redefinitions (Experimental)
    Mypy now allows unannotated variables to be freely redefined
    with different types when using the experimental
    --allow-redefinition-new flag. You will also need to enable
    --local-partial-types. Mypy will now infer a union type when
    different types are assigned to a variable:
    # mypy: allow-redefinition-new, local-partial-types
    def f(n: int, b: bool) -> int | str:
        if b:
            x = n
        else:
            x = str(n)
        # Type of 'x' is int | str here.
        return x
    Without the new flag, mypy only supports inferring optional
    types (X | None) from multiple assignments, but now mypy can
    infer arbitrary union types.
    An unannotated variable can now also have different types in
    different code locations:
    # mypy: allow-redefinition-new, local-partial-types
    ...
    if cond():
        for x in range(n):
            # Type of 'x' is 'int' here
            ...
    else:
        for x in ['a', 'b']:
            # Type of 'x' is 'str' here
            ...
    We are planning to turn this flag on by default in mypy 2.0,
    along with --local-partial-types. The feature is still
    experimental and has known issues, and the semantics may
    still change in the future. You may need to update or add
    type annotations when switching to the new behavior, but if
    you encounter anything unexpected, please create a GitHub
    issue.
    This was contributed by Jukka Lehtosalo (PR 18727, PR 19153).
    Stricter Type Checking with Imprecise Types
    Mypy can now detect additional errors in code that uses Any
    types or has missing function annotations.
    When calling dict.get(x, None) on an object of type dict[str,
    Any], this now results in an optional type (in the past it
    was Any):
    def f(d: dict[str, Any]) -> int:
        # Error: Return value has type "Any | None" but expected "int"
        return d.get("x", None)
    Type narrowing using assignments can result in more precise
    types in the presence of Any types:
    def foo(): ...
    def bar(n: int) -> None:
        x = foo()
        # Type of 'x' is 'Any' here
        if n > 5:
            x = str(n)
            # Type of 'x' is 'str' here
    When using --check-untyped-defs, unannotated overrides are
    now checked more strictly against superclass definitions.
    Related PRs:
        Use union types instead of join in binder (Ivan Levkivskyi, PR 18538)
        Check superclass compatibility of untyped methods if
        --check-untyped-defs is set (Stanislav Terliakov, PR
        18970)
    Improvements to Attribute Resolution
    This release includes several fixes to inconsistent
    resolution of attribute, method and descriptor types.
        Consolidate descriptor handling (Ivan Levkivskyi, PR 18831)
        Make multiple inheritance checking use common semantics (Ivan Levkivskyi, PR 18876)
        Make method override checking use common semantics (Ivan Levkivskyi, PR 18870)
        Fix descriptor overload selection (Ivan Levkivskyi, PR 18868)
        Handle union types when binding self (Ivan Levkivskyi, PR 18867)
        Make variable override checking use common semantics (Ivan Levkivskyi, PR 18847)
        Make descriptor handling behave consistently (Ivan Levkivskyi, PR 18831)
    Make Implementation for Abstract Overloads Optional
    The implementation can now be omitted for abstract overloaded methods, even outside stubs:
    from abc import abstractmethod
    from typing import overload
    class C:
        @abstractmethod
        @overload
        def foo(self, x: int) -> int: ...
        @abstractmethod
        @overload
        def foo(self, x: str) -> str: ...
        # No implementation required for "foo"
    This was contributed by Ivan Levkivskyi (PR 18882).
    Option to Exclude Everything in .gitignore
    You can now use --exclude-gitignore to exclude everything in
    a .gitignore file from the mypy build. This behaves similar
    to excluding the paths using --exclude. We might enable this
    by default in a future mypy release.
    This was contributed by Ivan Levkivskyi (PR 18696).
    Selectively Disable Deprecated Warnings
    It's now possible to selectively disable warnings generated
    from warnings.deprecated using the --deprecated-calls-exclude
    option:
    # mypy --enable-error-code deprecated
    #      --deprecated-calls-exclude=foo.A
    import foo
    foo.A().func()  # OK, the deprecated warning is ignored
    # file foo.py
    from typing_extensions import deprecated
    class A:
        @deprecated("Use A.func2 instead")
        def func(self): pass
        ...
    Contributed by Marc Mueller (PR 18641)
    Annotating Native/Non-Native Classes in Mypyc
    You can now declare a class as a non-native class when
    compiling with mypyc. Unlike native classes, which are
    extension classes and have an immutable structure, non-native
    classes are normal Python classes at runtime and are fully
    dynamic. Example:
    from mypy_extensions import mypyc_attr
    @mypyc_attr(native_class=False)
    class NonNativeClass:
        ...
    o = NonNativeClass()
    # Ok, even if attribute "foo" not declared in class body
    setattr(o, "foo", 1)
    Classes are native by default in compiled modules, but
    classes that use certain features (such as most metaclasses)
    are implicitly non-native.
    You can also explicitly declare a class as native. In this
    case mypyc will generate an error if it can't compile the
    class as a native class, instead of falling back to
    a non-native class:
    from mypy_extensions import mypyc_attr
    from foo import MyMeta
    # Error: Unsupported metaclass for a native class
    @mypyc_attr(native_class=True)
    class C(metaclass=MyMeta):
        ...
    Since native classes are significantly more efficient that
    non-native classes, you may want to ensure that certain
    classes always compiled as native classes.
- Update to 1.15.0:
    By default, mypy treats bytearray and memoryview values as
    assignable to the bytes type, for historical reasons. Use the
    --strict-bytes flag to disable this behavior. PEP 688
    specified the removal of this special case. The flag will be
    enabled by default in mypy 2.0.
    Contributed by Ali Hamdan (PR 18263) and Shantanu Jain (PR 13952).
    Improvements to Reachability Analysis and Partial Type Handling in Loops
    This change results in mypy better modelling control flow
    within loops and hence detecting several previously ignored
    issues. In some cases, this change may require additional
    explicit variable annotations.
    Contributed by Christoph Tyralla (PR 18180, PR 18433).
    (Speaking of partial types, remember that we plan to enable
    --local-partial-types by default in mypy 2.0.)
    Better Discovery of Configuration Files
    Mypy will now walk up the filesystem (up until a repository
    or file system root) to discover configuration files. See the
    mypy configuration file documentation for more details.
    Contributed by Mikhail Shiryaev and Shantanu Jain (PR 16965, PR 18482)
    Better Line Numbers for Decorators and Slice Expressions
    Mypy now uses more correct line numbers for decorators and
    slice expressions. In some cases, you may have to change the
    location of a # type: ignore comment.
    Contributed by Shantanu Jain (PR 18392, PR 18397).
    Drop Support for Python 3.8
    Mypy no longer supports running with Python 3.8, which has
    reached end-of-life. When running mypy with Python 3.9+, it
    is still possible to type check code that needs to support
    Python 3.8 with the --python-version 3.8 argument. Support
    for this will be dropped in the first half of 2025!

OBS-URL: https://build.opensuse.org/request/show/1281381
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-mypy?expand=0&rev=13
2025-06-01 19:36:30 +00:00
6917d24177 add missing runtime dependency
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mypy?expand=0&rev=35
2025-05-30 11:16:46 +00:00
ad2c1ad96e Add missing BR
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mypy?expand=0&rev=34
2025-05-29 15:34:38 +00:00
79e4785261 - Remove upstreamed mypy-1.14.1-gcc15.patch
- Update to 1.16.0:
    Different Property Getter and Setter Types
    Mypy now supports using different types for a property getter and setter:
    class A:
        _value: int
        @property
        def foo(self) -> int:
            return self._value
        @foo.setter
        def foo(self, x: str | int) -> None:
            try:
                self._value = int(x)
            except ValueError:
                raise Exception(f"'{x}' is not a valid value for 'foo'")
    This was contributed by Ivan Levkivskyi (PR 18510).
    Flexible Variable Redefinitions (Experimental)
    Mypy now allows unannotated variables to be freely redefined
    with different types when using the experimental
    --allow-redefinition-new flag. You will also need to enable
    --local-partial-types. Mypy will now infer a union type when
    different types are assigned to a variable:
    # mypy: allow-redefinition-new, local-partial-types
    def f(n: int, b: bool) -> int | str:
        if b:
            x = n
        else:
            x = str(n)
        # Type of 'x' is int | str here.
        return x

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mypy?expand=0&rev=33
2025-05-29 15:32:58 +00:00
897587eb04 Accepting request 1274642 from devel:languages:python
- Add mypy-1.14.1-gcc15.patch from upstream to fix gcc15 compile
  time error
- Update vendored types_* to the appropriate versions.

OBS-URL: https://build.opensuse.org/request/show/1274642
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-mypy?expand=0&rev=12
2025-05-06 14:40:12 +00:00
a4a237dcd8 - Add mypy-1.14.1-gcc15.patch from upstream to fix gcc15 compile
time error

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mypy?expand=0&rev=31
2025-05-05 14:10:47 +00:00
0b7850e4cc - Update vendored types_* to the appropriate versions.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mypy?expand=0&rev=30
2025-05-05 12:59:34 +00:00
cda7b538b4 Accepting request 1240302 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/1240302
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-mypy?expand=0&rev=11
2025-01-28 13:58:02 +00:00
506a4371c4 - Update to 1.14.1
* Mypyc Improvements
    - Document optimized bytes operations and additional str operations (Jukka Lehtosalo, PR 18242)
    - Add primitives and specialization for ord() (Jukka Lehtosalo, PR 18240)
    - Optimize str.encode with specializations for common used encodings (Valentin Stanciu, PR 18232)
    - Fix fall back to generic operation for staticmethod and classmethod (Advait Dixit, PR 18228)
    - Support unicode surrogates in string literals (Jukka Lehtosalo, PR 18209)
    - Fix index variable in for loop with builtins.enumerate (Advait Dixit, PR 18202)
    - Fix check for enum classes (Advait Dixit, PR 18178)
    - Fix loading type from imported modules (Advait Dixit, PR 18158)
    - Fix initializers of final attributes in class body (Jared Hance, PR 18031)
    - Fix name generation for modules with similar full names (aatle, PR 18001)
    - Fix relative imports in __init__.py (Shantanu, PR 17979)
    - Optimize dunder methods (jairov4, PR 17934)
    - Replace deprecated _PyDict_GetItemStringWithError (Marc Mueller, PR 17930)
    - Fix wheel build for cp313-win (Marc Mueller, PR 17941)
    - Use public PyGen_GetCode instead of vendored implementation (Marc Mueller, PR 17931)
    - Optimize calls to final classes (jairov4, PR 17886)
    - Support ellipsis (...) expressions in class bodies (Newbyte, PR 17923)
    - Sync pythoncapi_compat.h (Marc Mueller, PR 17929)
    - Add runtests.py mypyc-fast for running fast mypyc tests (Jukka Lehtosalo, PR 17906)
  * Stubgen Improvements
    - Do not include mypy generated symbols (Ali Hamdan, PR 18137)
    - Fix FunctionContext.fullname for nested classes (Chad Dombrova, PR 17963)
    - Add flagfile support (Ruslan Sayfutdinov, PR 18061)
    - Add support for PEP 695 and PEP 696 syntax (Ali Hamdan, PR 18054)
  * Stubtest Improvements
    - Allow the use of --show-traceback and --pdb with stubtest (Stephen Morton, PR 18037)
    - Verify __all__ exists in stub (Sebastian Rittau, PR 18005)
    - Stop telling people to use double underscores (Jelle Zijlstra, PR 17897)
  * Documentation Updates
    - Update config file documentation (sobolevn, PR 18103)
    - Improve contributor documentation for Windows (ag-tafe, PR 18097)
    - Correct note about --disallow-any-generics flag in documentation (Abel Sen, PR 18055)
    - Further caution against --follow-imports=skip (Shantanu, PR 18048)
    - Fix the edit page buttton link in documentation (Kanishk Pachauri, PR 17933)
  * Other Notables Fixes and Improvements
    - Show Protocol __call__ for arguments with incompatible types (MechanicalConstruct, PR 18214)
    - Make join and meet symmetric with strict_optional (MechanicalConstruct, PR 18227)
    - Preserve block unreachablility when checking function definitions with constrained TypeVars (Brian Schubert, PR 18217)
    - Do not include non-init fields in the synthesized __replace__ method for dataclasses (Victorien, PR 18221)
    - Disallow TypeVar constraints parameterized by type variables (Brian Schubert, PR 18186)
    - Always complain about invalid varargs and varkwargs (Shantanu, PR 18207)
    - Set default strict_optional state to True (Shantanu, PR 18198)
    - Preserve type variable default None in type alias (Sukhorosov Aleksey, PR 18197)
    - Add checks for invalid usage of continue/break/return in except* block (coldwolverine, PR 18132)
    - Do not consider bare TypeVar not overlapping with None for reachability analysis (Stanislav Terliakov, PR 18138)
    - Special case types.DynamicClassAttribute as property-like (Stephen Morton, PR 18150)
    - Disallow bare ParamSpec in type aliases (Brian Schubert, PR 18174)
    - Move long_description metadata to pyproject.toml (Marc Mueller, PR 18172)
    - Support ==-based narrowing of Optional (Christoph Tyralla, PR 18163)
    - Allow TypedDict assignment of Required item to NotRequired ReadOnly item (Brian Schubert, PR 18164)
    - Allow nesting of Annotated with TypedDict special forms inside TypedDicts (Brian Schubert, PR 18165)
    - Infer generic type arguments for slice expressions (Brian Schubert, PR 18160)
    - Fix checking of match sequence pattern against bounded type variables (Brian Schubert, PR 18091)
    - Fix incorrect truthyness for Enum types and literals (David Salvisberg, PR 17337)
    - Move static project metadata to pyproject.toml (Marc Mueller, PR 18146)
    - Fallback to stdlib json if integer exceeds 64-bit range (q0w, PR 18148)
    - Fix 'or' pattern structural matching exhaustiveness (yihong, PR 18119)
    - Fix type inference of positional parameter in class pattern involving builtin subtype (Brian Schubert, PR 18141)
    - Fix [override] error with no line number when argument node has no line number (Brian Schubert, PR 18122)
    - Fix some dmypy crashes (Ivan Levkivskyi, PR 18098)
    - Fix subtyping between instance type and overloaded (Shantanu, PR 18102)
    - Clean up new_semantic_analyzer config (Shantanu, PR 18071)
    - Issue warning for enum with no members in stub (Shantanu, PR 18068)
    - Fix enum attributes are not members (Terence Honles, PR 17207)
    - Fix crash when checking slice expression with step 0 in tuple index (Brian Schubert, PR 18063)
    - Allow union-with-callable attributes to be overridden by methods (Brian Schubert, PR 18018)
    - Emit [mutable-override] for covariant override of attribute with method (Brian Schubert, PR 18058)
    - Support ParamSpec mapping with functools.partial (Stanislav Terliakov, PR 17355)
    - Fix approved stub ignore, remove normpath (Shantanu, PR 18045)
    - Make disallow-any-unimported flag invertible (Séamus Ó Ceanainn, PR 18030)
    - Filter to possible package paths before trying to resolve a module (falsedrow, PR 18038)
    - Fix overlap check for ParamSpec types (Jukka Lehtosalo, PR 18040)
    - Do not prioritize ParamSpec signatures during overload resolution (Stanislav Terliakov, PR 18033)
    - Fix ternary union for literals (Ivan Levkivskyi, PR 18023)
    - Fix compatibility checks for conditional function definitions using decorators (Brian Schubert, PR 18020)
    - TypeGuard should be bool not Any when matching TypeVar (Evgeniy Slobodkin, PR 17145)
    - Fix convert-cache tool (Shantanu, PR 17974)
    - Fix generator comprehension with mypyc (Shantanu, PR 17969)
    - Fix crash issue when using shadowfile with pretty (Max Chang, PR 17894)
    - Fix multiple nested classes with new generics syntax (Max Chang, PR 17820)
    - Better error for mypy -p package without py.typed (Joe Gordon, PR 17908)
    - Emit error for raise NotImplemented (Brian Schubert, PR 17890)
    - Add is_lvalue attribute to AttributeContext (Brian Schubert, PR 17881)
  - Changes from 1.13
    - Significantly speed up file handling error paths (Shantanu, PR 17920)
    - Use fast path in modulefinder more often (Shantanu, PR 17950)
    - Let mypyc optimise os.path.join (Shantanu, PR 17949)
    - Make is_sub_path faster (Shantanu, PR 17962)
    - Speed up stubs suggestions (Shantanu, PR 17965)
    - Use sha1 for hashing (Shantanu, PR 17953)
    - Use orjson instead of json, when available (Shantanu, PR 17955)
    - Add faster-cache extra, test in CI (Shantanu, PR 17978)

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mypy?expand=0&rev=28
2025-01-25 20:45:00 +00:00
47f73b81c7 Accepting request 1207957 from devel:languages:python
- Update to officially released version 1.12.0:
  - Support Python 3.12 Syntax for Generics (PEP 695)
  - Related improvements are included:
    - Document Python 3.12 type parameter syntax (Jukka
      Lehtosalo, PR 17816)
    - Further documentation updates (Jukka Lehtosalo, PR 17826)
    - Allow Self return types with contravariance (Jukka
      Lehtosalo, PR 17786)
    - Enable new type parameter syntax by default (Jukka
      Lehtosalo, PR 17798)
    - Generate error if new-style type alias used as base class
      (Jukka Lehtosalo, PR 17789)
    - Inherit variance if base class has explicit variance (Jukka
      Lehtosalo, PR 17787)
    - Fix crash on invalid type var reference (Jukka Lehtosalo,
      PR 17788)
    - Fix covariance of frozen dataclasses (Jukka Lehtosalo, PR
      17783)
    - Allow covariance with attribute that has "_" name prefix
      (Jukka Lehtosalo, PR 17782)
    - Support Annotated[...] in new-style type aliases (Jukka
      Lehtosalo, PR 17777)
    - Fix nested generic classes (Jukka Lehtosalo, PR 17776)
    - Add detection and error reporting for the use of incorrect
      expressions within the scope of a type parameter and a type
      alias (Kirill Podoprigora, PR 17560)
  - Basic Support for Python 3.13 This release adds partial
    support for Python 3.13 features and compiled binaries for
    Python 3.13. Mypyc now also supports Python 3.13.
    - Various new stdlib features and changes (through typeshed
      stub improvements)
    - typing.ReadOnly (see below for more)
    - typing.TypeIs (added in mypy 1.10, PEP 742)
    - Type parameter defaults when using the legacy syntax (PEP
    Th696) ese features are not supported yet:
    - warnings.deprecated (PEP 702)
    - Type parameter defaults when using Python 3.12 type
      parameter syntax
  - Mypyc Support for Python 3.13
    - Add additional includes for Python 3.13 (Marc Mueller, PR
      17506)
    - Add another include for Python 3.13 (Marc Mueller, PR
      17509)
    - Fix ManagedDict functions for Python 3.13 (Marc Mueller, PR
      17507)
    - Update mypyc test output for Python 3.13 (Marc Mueller, PR
      17508)
    - Fix PyUnicode functions for Python 3.13 (Marc Mueller, PR
      17504)
    - Fix _PyObject_LookupAttrId for Python 3.13 (Marc Mueller,
      PR 17505)
    - Fix _PyList_Extend for Python 3.13 (Marc Mueller, PR 17503)
    - Fix gen_is_coroutine for Python 3.13 (Marc Mueller, PR
      17501)
    - Fix _PyObject_FastCall for Python 3.13 (Marc Mueller, PR
      17502)
    - Avoid uses of _PyObject_CallMethodOneArg on 3.13 (Jukka
      Lehtosalo, PR 17526)
    - Don't rely on _PyType_CalculateMetaclass on 3.13 (Jukka
      Lehtosalo, PR 17525)
    - Don't use _PyUnicode_FastCopyCharacters on 3.13 (Jukka
      Lehtosalo, PR 17524)
    - Don't use _PyUnicode_EQ on 3.13, as it's no longer exported
      (Jukka Lehtosalo, PR 17523)
  - Inferring Unions for Conditional Expressions
  - You can now use typing.ReadOnly to specity TypedDict items as
    read-only (PEP 705):
  - Python 3.8 End of Life Approaching
  - Planned Changes to Defaults - more details in the full
    Changelog.
  - Documentation Updates
  - Experimental Inline TypedDict Syntax
  - Stubgen Improvements
  - Stubtest Improvements
  - Other Notables Fixes and Improvements
  - Typeshed Updates
- Update types-psutil 6.0.0.20241011, and types-setuptools to
  75.1.0.20241014 (just for testing, these are not openSUSE
  packages of these tools).
- Remove _service* files.

OBS-URL: https://build.opensuse.org/request/show/1207957
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-mypy?expand=0&rev=10
2024-10-15 12:57:52 +00:00
f202d85d68 - Remove _service* files.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mypy?expand=0&rev=26
2024-10-14 13:09:43 +00:00
a4f289e2b7 - Update types-psutil 6.0.0.20241011, and types-setuptools to
75.1.0.20241014 (just for testing, these are not openSUSE
  packages of these tools).

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mypy?expand=0&rev=25
2024-10-14 13:07:55 +00:00
cdc403a514 - Update to officially released version 1.12.0:
- Support Python 3.12 Syntax for Generics (PEP 695)
  - Related improvements are included:
    - Document Python 3.12 type parameter syntax (Jukka
      Lehtosalo, PR 17816)
    - Further documentation updates (Jukka Lehtosalo, PR 17826)
    - Allow Self return types with contravariance (Jukka
      Lehtosalo, PR 17786)
    - Enable new type parameter syntax by default (Jukka
      Lehtosalo, PR 17798)
    - Generate error if new-style type alias used as base class
      (Jukka Lehtosalo, PR 17789)
    - Inherit variance if base class has explicit variance (Jukka
      Lehtosalo, PR 17787)
    - Fix crash on invalid type var reference (Jukka Lehtosalo,
      PR 17788)
    - Fix covariance of frozen dataclasses (Jukka Lehtosalo, PR
      17783)
    - Allow covariance with attribute that has "_" name prefix
      (Jukka Lehtosalo, PR 17782)
    - Support Annotated[...] in new-style type aliases (Jukka
      Lehtosalo, PR 17777)
    - Fix nested generic classes (Jukka Lehtosalo, PR 17776)
    - Add detection and error reporting for the use of incorrect
      expressions within the scope of a type parameter and a type
      alias (Kirill Podoprigora, PR 17560)
  - Basic Support for Python 3.13 This release adds partial
    support for Python 3.13 features and compiled binaries for
    Python 3.13. Mypyc now also supports Python 3.13.
    - Various new stdlib features and changes (through typeshed

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mypy?expand=0&rev=24
2024-10-14 13:04:21 +00:00
fd273b4d22 Accepting request 1206747 from devel:languages:python
- Temporarily switched to using git source before the problems
  with 3.13.0 compatibility are fixed.
- Update to version 1.11.2+git.1728499967.eca206d:
  * Fix union callees with functools.partial (#17903)
  * [mypyc] Add "runtests.py mypyc-fast" for running fast mypyc tests (#17906)
  * Emit error for "raise NotImplemented" (#17890)
  * Document ReadOnly (PEP 705) (#17905)
  * Make ReadOnly TypedDict items covariant (#17904)
  * documentation for TypeIs (#17821)
  * Improvements to functools.partial of types (#17898)
  * Use 3.13.0 for ci tests (#17900)
  * stubtest: Stop telling people to use double underscores (#17897)
  * Add changelog for mypy 1.12 (#17889)
- Remove upstreamed latest-pythons.patch

OBS-URL: https://build.opensuse.org/request/show/1206747
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-mypy?expand=0&rev=9
2024-10-11 15:01:05 +00:00
5f0850ed11 - Temporarily switched to using git source before the problems
with 3.13.0 compatibility are fixed.
- Update to version 1.11.2+git.1728499967.eca206d:
  * Fix union callees with functools.partial (#17903)
  * [mypyc] Add "runtests.py mypyc-fast" for running fast mypyc tests (#17906)
  * Emit error for "raise NotImplemented" (#17890)
  * Document ReadOnly (PEP 705) (#17905)
  * Make ReadOnly TypedDict items covariant (#17904)
  * documentation for TypeIs (#17821)
  * Improvements to functools.partial of types (#17898)
  * Use 3.13.0 for ci tests (#17900)
  * stubtest: Stop telling people to use double underscores (#17897)
  * Add changelog for mypy 1.12 (#17889)
- Remove upstreamed latest-pythons.patch

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mypy?expand=0&rev=22
2024-10-10 12:17:41 +00:00
2d6be309dc Accepting request 1205767 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/1205767
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-mypy?expand=0&rev=8
2024-10-06 15:51:45 +00:00
79f0018e58 - Add upstream latest-pythons.patch to fix tests on latest Python releases
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mypy?expand=0&rev=20
2024-10-04 22:29:10 +00:00
fec364737b Accepting request 1199970 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/1199970
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-mypy?expand=0&rev=7
2024-09-12 14:53:58 +00:00
23720878dc - Update to 1.11.2
* Support Python 3.12 Syntax for Generics (PEP 695)
  * Support for `functools.partial`
  * Stricter Checks for Untyped Overrides
  * Type Inference Improvements
  * Improvements to Detection of Overlapping Overloads
  * Better Support for Type Hints in Expressions
  * Mypyc Improvements
    + Support Python 3.12 syntax for generic functions and classes
    + Support Python 3.12 type alias syntax
    + Fix ParamSpec
    + Inline fast paths of integer unboxing operations
    + Inline tagged integer arithmetic and bitwise operations
    + Allow specifying primitives as pure
  * Changes to Stubtest
    + Ignore `_ios_support`
    + Improve support for Python 3.13
  * Changes to Stubgen
    + Gracefully handle invalid `Optional` and recognize aliases to PEP 604 unions
    + Fix for Python 3.13
    + Preserve enum value initialisers
  * Miscellaneous New Features
    + Add error format support and JSON output option via `--output json`
    + Support `enum.member` in Python 3.11+
    + Support `enum.nonmember` in Python 3.11+
    + Support `namedtuple.__replace__` in Python 3.13
    + Support `rename=True` in collections.namedtuple
    + Add support for `__spec__`
  * Changes to Error Reporting
    + Mention `--enable-incomplete-feature=NewGenericSyntax` in messages

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mypy?expand=0&rev=18
2024-09-11 06:59:56 +00:00
7e97d0a84f Accepting request 1181211 from devel:languages:python
- Update to 1.10.0:
  * Support TypeIs (PEP 742)
  * Support TypeVar Defaults (PEP 696)
  * Support TypeAliasType (PEP 695)
  * Detect Additional Unsafe Uses of super()
  * Fix incorrect inferred type when accessing descriptor on union type
  * Fix crash when expanding invalid Unpack in a Callable alias
  * Fix false positive when string formatting with string enum
  * Narrow individual items when matching a tuple to a sequence pattern
  * Fix false positive from type variable within TypeGuard or TypeIs
  * Improve yield from inference for unions of generators
  * Fix emulating hash method logic in attrs classes
  * Add reverted typeshed commit that uses ParamSpec for functools.wraps
  * Fix type narrowing for types.EllipsisType
  * Fix single item enum match type exhaustion
  * Improve type inference with empty collections
  * Fix override checking for decorated property
  * Fix narrowing on match with function subject
- Drop including types-ast, no longer required.
- Drop patch workaround-parenthesized-context-managers.patch, now
  included upstream.

OBS-URL: https://build.opensuse.org/request/show/1181211
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-mypy?expand=0&rev=6
2024-06-21 14:02:43 +00:00
cb79017320 - Update to 1.10.0:
* Support TypeIs (PEP 742)
  * Support TypeVar Defaults (PEP 696)
  * Support TypeAliasType (PEP 695)
  * Detect Additional Unsafe Uses of super()
  * Fix incorrect inferred type when accessing descriptor on union type
  * Fix crash when expanding invalid Unpack in a Callable alias
  * Fix false positive when string formatting with string enum
  * Narrow individual items when matching a tuple to a sequence pattern
  * Fix false positive from type variable within TypeGuard or TypeIs
  * Improve yield from inference for unions of generators
  * Fix emulating hash method logic in attrs classes
  * Add reverted typeshed commit that uses ParamSpec for functools.wraps
  * Fix type narrowing for types.EllipsisType
  * Fix single item enum match type exhaustion
  * Improve type inference with empty collections
  * Fix override checking for decorated property
  * Fix narrowing on match with function subject
- Drop including types-ast, no longer required.
- Drop patch workaround-parenthesized-context-managers.patch, now
  included upstream.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mypy?expand=0&rev=16
2024-06-17 05:39:18 +00:00
fbbcdc6baf Accepting request 1164520 from devel:languages:python
- Add patch workaround-parenthesized-context-managers.patch:
  * Work around parenthesized context managers issue.
- Stop skipping tests under Python 3.6.
- Drop -x argument to pytest.

OBS-URL: https://build.opensuse.org/request/show/1164520
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-mypy?expand=0&rev=5
2024-04-04 20:26:29 +00:00
dbbbb63c88 - Stop skipping tests under Python 3.6.
- Drop -x argument to pytest.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mypy?expand=0&rev=14
2024-04-04 08:33:29 +00:00
fd23ee145b - Add patch workaround-parenthesized-context-managers.patch:
* Work around parenthesized context managers issue.
- Stop skipping tests that are now fixed.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mypy?expand=0&rev=13
2024-04-04 04:59:52 +00:00
2e67d2f38c Accepting request 1163260 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/1163260
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-mypy?expand=0&rev=4
2024-03-29 12:09:32 +00:00
021fe7c442 Accepting request 1162950 from home:ecsos:python
- Disable self_check under %check in Leap because it does not work 
  and prevent package building.

OBS-URL: https://build.opensuse.org/request/show/1162950
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mypy?expand=0&rev=11
2024-03-28 08:08:12 +00:00
276defde8c Accepting request 1160713 from devel:languages:python
- Clean up SPEC file.
New upstream release 1.9.0
#### Breaking Changes
Because the version of typeshed we use in mypy 1.9 doesn't support 3.7, neither does mypy 1.9. (Jared Hance, PR [16883](https://github.com/python/mypy/pull/16883))
We are planning to enable
[local partial types](https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-local-partial-types) (enabled via the
`--local-partial-types` flag) later this year by default. This change
was announced years ago, but now it's finally happening. This is a
major backward-incompatible change, so we'll probably include it as
part of the upcoming mypy 2.0 release. This makes daemon and
non-daemon mypy runs have the same behavior by default.
Local partial types can also be enabled in the mypy config file:
```
local_partial_types = True
```
We are looking at providing a tool to make it easier to migrate
projects to use `--local-partial-types`, but it's not yet clear whether
this is practical. The migration usually involves adding some
explicit type annotations to module-level and class-level variables.
#### Basic Support for Type Parameter Defaults (PEP 696)
This release contains new experimental support for type parameter
defaults ([PEP 696](https://peps.python.org/pep-0696)). Please try it
out! This feature was contributed by Marc Mueller.
Since this feature will be officially introduced in the next Python
feature release (3.13), you will need to import `TypeVar`, `ParamSpec`
or `TypeVarTuple` from `typing_extensions` to use defaults for now.
This example adapted from the PEP defines a default for `BotT`:
```python
from typing import Generic
from typing_extensions import TypeVar
class Bot: ...
BotT = TypeVar("BotT", bound=Bot, default=Bot)
class Context(Generic[BotT]):
    bot: BotT
class MyBot(Bot): ...
# type is Bot (the default)
reveal_type(Context().bot)
# type is MyBot
reveal_type(Context[MyBot]().bot)
```
#### Type-checking Improvements
 * Fix missing type store for overloads (Marc Mueller, PR [16803](https://github.com/python/mypy/pull/16803))
 * Fix `'WriteToConn' object has no attribute 'flush'` (Charlie Denton, PR [16801](https://github.com/python/mypy/pull/16801))
 * Improve TypeAlias error messages (Marc Mueller, PR [16831](https://github.com/python/mypy/pull/16831))
 * Support narrowing unions that include `type[None]` (Christoph Tyralla, PR [16315](https://github.com/python/mypy/pull/16315))
 * Support TypedDict functional syntax as class base type (anniel-stripe, PR [16703](https://github.com/python/mypy/pull/16703))
 * Accept multiline quoted annotations (Shantanu, PR [16765](https://github.com/python/mypy/pull/16765))
 * Allow unary + in `Literal` (Jelle Zijlstra, PR [16729](https://github.com/python/mypy/pull/16729))
 * Substitute type variables in return type of static methods (Kouroche Bouchiat, PR [16670](https://github.com/python/mypy/pull/16670))
 * Consider TypeVarTuple to be invariant (Marc Mueller, PR [16759](https://github.com/python/mypy/pull/16759))
 * Add `alias` support to `field()` in `attrs` plugin (Nikita Sobolev, PR [16610](https://github.com/python/mypy/pull/16610))
 * Improve attrs hashability detection (Tin Tvrtković, PR [16556](https://github.com/python/mypy/pull/16556))
#### Performance Improvements
 * Speed up finding function type variables (Jukka Lehtosalo, PR [16562](https://github.com/python/mypy/pull/16562))
#### Documentation Updates
 * Document supported values for `--enable-incomplete-feature` in "mypy --help" (Froger David, PR [16661](https://github.com/python/mypy/pull/16661))
 * Update new type system discussion links (thomaswhaley, PR [16841](https://github.com/python/mypy/pull/16841))
 * Add missing class instantiation to cheat sheet (Aleksi Tarvainen, PR [16817](https://github.com/python/mypy/pull/16817))
 * Document how evil `--no-strict-optional` is (Shantanu, PR [16731](https://github.com/python/mypy/pull/16731))
 * Improve mypy daemon documentation note about local partial types (Makonnen Makonnen, PR [16782](https://github.com/python/mypy/pull/16782))
 * Fix numbering error (Stefanie Molin, PR [16838](https://github.com/python/mypy/pull/16838))
 * Various documentation improvements (Shantanu, PR [16836](https://github.com/python/mypy/pull/16836))
#### Stubtest Improvements
 * Ignore private function/method parameters when they are missing from the stub (private parameter names start with a single underscore and have a default) (PR [16507](https://github.com/python/mypy/pull/16507))
 * Ignore a new protocol dunder (Alex Waygood, PR [16895](https://github.com/python/mypy/pull/16895))
 * Private parameters can be omitted (Sebastian Rittau, PR [16507](https://github.com/python/mypy/pull/16507))
 * Add support for setting enum members to "..." (Jelle Zijlstra, PR [16807](https://github.com/python/mypy/pull/16807))
 * Adjust symbol table logic (Shantanu, PR [16823](https://github.com/python/mypy/pull/16823))
 * Fix posisitional-only handling in overload resolution (Shantanu, PR [16750](https://github.com/python/mypy/pull/16750))
#### Stubgen Improvements
 * Fix crash on star unpack of TypeVarTuple (Ali Hamdan, PR [16869](https://github.com/python/mypy/pull/16869))
 * Use PEP 604 unions everywhere (Ali Hamdan, PR [16519](https://github.com/python/mypy/pull/16519))
 * Do not ignore property deleter (Ali Hamdan, PR [16781](https://github.com/python/mypy/pull/16781))
 * Support type stub generation for `staticmethod` (WeilerMarcel, PR [14934](https://github.com/python/mypy/pull/14934))

OBS-URL: https://build.opensuse.org/request/show/1160713
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-mypy?expand=0&rev=3
2024-03-25 20:07:29 +00:00
979976191d - Clean up SPEC file.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mypy?expand=0&rev=9
2024-03-22 14:16:08 +00:00
552d3cfb93 Accepting request 1159070 from home:dancermak:branches:devel:languages:python
new upstream release 1.9.0

OBS-URL: https://build.opensuse.org/request/show/1159070
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mypy?expand=0&rev=8
2024-03-22 13:47:03 +00:00
d5329fb49e Accepting request 1136250 from devel:languages:python
- update to 1.8.0:
  * https://mypy-lang.blogspot.com/2023/12/mypy-18-released.html
  * https://mypy-lang.blogspot.com/2023/11/mypy-17-released.html
  * https://mypy-lang.blogspot.com/2023/10/mypy-16-released.html
- fix dependencies

  - Support better __post_init__ method signature for dataclasses (Nikita Sobolev, PR 15503)
  - Don't explicitly assign NULL values in setup functions (Logan Hunt, PR 15379)
  - Fix crash on non-str docstring (Ali Hamdan, PR 15623)
  - Remove confusing instance variable example in cheat sheet (Adel Atallah, PR 15441)
  - Check for abstract class objects in tuples (Nikita Sobolev, PR 15366)
  - Fix frozen behavior for base classes with direct metaclasses (Wesley Collin Wright, PR 14878)
   - Fixes to float to int conversion (Jukka Lehtosalo, PR 14936)
  - Faster classmethod calls via cls (Jukka Lehtosalo, PR 14789)
  - Fix crash on ParamSpec in incremental mode (Ivan Levkivskyi, PR 14885)
  - Improve documentation of top level mypy: disable-error-code comment (Nikita Sobolev, PR 14810)
  - Add suggestions for pandas-stubs and lxml-stubs (Shantanu, PR 14737)
  - Honor NoReturn as __setitem__ return type to mark unreachable code (sterliakov, PR 12572)
- Sadly, six is still required for tests, re-add to BuildRequires.
  The full release notes can be found here:
  - Fix types of inherited attributes in generic dataclasses (Jukka Lehtosalo, PR 12656)
- add missing g++ compiler for tests

OBS-URL: https://build.opensuse.org/request/show/1136250
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-mypy?expand=0&rev=2
2024-01-03 11:30:34 +00:00
bfba238f1d - update to 1.8.0:
* https://mypy-lang.blogspot.com/2023/12/mypy-18-released.html
  * https://mypy-lang.blogspot.com/2023/11/mypy-17-released.html
  * https://mypy-lang.blogspot.com/2023/10/mypy-16-released.html
- fix dependencies
  - Support better __post_init__ method signature for dataclasses (Nikita Sobolev, PR 15503)
  - Don't explicitly assign NULL values in setup functions (Logan Hunt, PR 15379)
  - Fix crash on non-str docstring (Ali Hamdan, PR 15623)
  - Remove confusing instance variable example in cheat sheet (Adel Atallah, PR 15441)
  - Check for abstract class objects in tuples (Nikita Sobolev, PR 15366)
  - Fix frozen behavior for base classes with direct metaclasses (Wesley Collin Wright, PR 14878)
   - Fixes to float to int conversion (Jukka Lehtosalo, PR 14936)
  - Faster classmethod calls via cls (Jukka Lehtosalo, PR 14789)
  - Fix crash on ParamSpec in incremental mode (Ivan Levkivskyi, PR 14885)
  - Improve documentation of top level mypy: disable-error-code comment (Nikita Sobolev, PR 14810)
  - Add suggestions for pandas-stubs and lxml-stubs (Shantanu, PR 14737)
  - Honor NoReturn as __setitem__ return type to mark unreachable code (sterliakov, PR 12572)
- Sadly, six is still required for tests, re-add to BuildRequires.
  The full release notes can be found here:
  - Fix types of inherited attributes in generic dataclasses (Jukka Lehtosalo, PR 12656)
- add missing g++ compiler for tests

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mypy?expand=0&rev=6
2024-01-02 17:27:14 +00:00
1c58745afc Accepting request 1109212 from devel:languages:python
Renaming mypy to the correct name.

OBS-URL: https://build.opensuse.org/request/show/1109212
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-mypy?expand=0&rev=1
2023-09-06 16:59:32 +00:00
10 changed files with 770 additions and 68 deletions

BIN
mypy-1.16.0.tar.gz LFS Normal file

Binary file not shown.

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b031b9601f1060bf1281feab89697324726ba0c0bae9d7cd7ab4b690940f0b92
size 2891640

4
mypy.obsinfo Normal file
View File

@@ -0,0 +1,4 @@
name: mypy
version: 1.11.2+git.1728499967.eca206d
mtime: 1728499967
commit: eca206d3c96bf4082a0a087c2614deb5af8c4afd

View File

@@ -1,3 +1,708 @@
-------------------------------------------------------------------
Tue Jul 8 08:33:25 UTC 2025 - Markéta Machová <mmachova@suse.com>
- Convert to libalternatives
-------------------------------------------------------------------
Thu May 29 15:25:57 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
- Remove upstreamed mypy-1.14.1-gcc15.patch
- Update to 1.16.0:
Different Property Getter and Setter Types
Mypy now supports using different types for a property getter and setter:
class A:
_value: int
@property
def foo(self) -> int:
return self._value
@foo.setter
def foo(self, x: str | int) -> None:
try:
self._value = int(x)
except ValueError:
raise Exception(f"'{x}' is not a valid value for 'foo'")
This was contributed by Ivan Levkivskyi (PR 18510).
Flexible Variable Redefinitions (Experimental)
Mypy now allows unannotated variables to be freely redefined
with different types when using the experimental
--allow-redefinition-new flag. You will also need to enable
--local-partial-types. Mypy will now infer a union type when
different types are assigned to a variable:
# mypy: allow-redefinition-new, local-partial-types
def f(n: int, b: bool) -> int | str:
if b:
x = n
else:
x = str(n)
# Type of 'x' is int | str here.
return x
Without the new flag, mypy only supports inferring optional
types (X | None) from multiple assignments, but now mypy can
infer arbitrary union types.
An unannotated variable can now also have different types in
different code locations:
# mypy: allow-redefinition-new, local-partial-types
...
if cond():
for x in range(n):
# Type of 'x' is 'int' here
...
else:
for x in ['a', 'b']:
# Type of 'x' is 'str' here
...
We are planning to turn this flag on by default in mypy 2.0,
along with --local-partial-types. The feature is still
experimental and has known issues, and the semantics may
still change in the future. You may need to update or add
type annotations when switching to the new behavior, but if
you encounter anything unexpected, please create a GitHub
issue.
This was contributed by Jukka Lehtosalo (PR 18727, PR 19153).
Stricter Type Checking with Imprecise Types
Mypy can now detect additional errors in code that uses Any
types or has missing function annotations.
When calling dict.get(x, None) on an object of type dict[str,
Any], this now results in an optional type (in the past it
was Any):
def f(d: dict[str, Any]) -> int:
# Error: Return value has type "Any | None" but expected "int"
return d.get("x", None)
Type narrowing using assignments can result in more precise
types in the presence of Any types:
def foo(): ...
def bar(n: int) -> None:
x = foo()
# Type of 'x' is 'Any' here
if n > 5:
x = str(n)
# Type of 'x' is 'str' here
When using --check-untyped-defs, unannotated overrides are
now checked more strictly against superclass definitions.
Related PRs:
Use union types instead of join in binder (Ivan Levkivskyi, PR 18538)
Check superclass compatibility of untyped methods if
--check-untyped-defs is set (Stanislav Terliakov, PR
18970)
Improvements to Attribute Resolution
This release includes several fixes to inconsistent
resolution of attribute, method and descriptor types.
Consolidate descriptor handling (Ivan Levkivskyi, PR 18831)
Make multiple inheritance checking use common semantics (Ivan Levkivskyi, PR 18876)
Make method override checking use common semantics (Ivan Levkivskyi, PR 18870)
Fix descriptor overload selection (Ivan Levkivskyi, PR 18868)
Handle union types when binding self (Ivan Levkivskyi, PR 18867)
Make variable override checking use common semantics (Ivan Levkivskyi, PR 18847)
Make descriptor handling behave consistently (Ivan Levkivskyi, PR 18831)
Make Implementation for Abstract Overloads Optional
The implementation can now be omitted for abstract overloaded methods, even outside stubs:
from abc import abstractmethod
from typing import overload
class C:
@abstractmethod
@overload
def foo(self, x: int) -> int: ...
@abstractmethod
@overload
def foo(self, x: str) -> str: ...
# No implementation required for "foo"
This was contributed by Ivan Levkivskyi (PR 18882).
Option to Exclude Everything in .gitignore
You can now use --exclude-gitignore to exclude everything in
a .gitignore file from the mypy build. This behaves similar
to excluding the paths using --exclude. We might enable this
by default in a future mypy release.
This was contributed by Ivan Levkivskyi (PR 18696).
Selectively Disable Deprecated Warnings
It's now possible to selectively disable warnings generated
from warnings.deprecated using the --deprecated-calls-exclude
option:
# mypy --enable-error-code deprecated
# --deprecated-calls-exclude=foo.A
import foo
foo.A().func() # OK, the deprecated warning is ignored
# file foo.py
from typing_extensions import deprecated
class A:
@deprecated("Use A.func2 instead")
def func(self): pass
...
Contributed by Marc Mueller (PR 18641)
Annotating Native/Non-Native Classes in Mypyc
You can now declare a class as a non-native class when
compiling with mypyc. Unlike native classes, which are
extension classes and have an immutable structure, non-native
classes are normal Python classes at runtime and are fully
dynamic. Example:
from mypy_extensions import mypyc_attr
@mypyc_attr(native_class=False)
class NonNativeClass:
...
o = NonNativeClass()
# Ok, even if attribute "foo" not declared in class body
setattr(o, "foo", 1)
Classes are native by default in compiled modules, but
classes that use certain features (such as most metaclasses)
are implicitly non-native.
You can also explicitly declare a class as native. In this
case mypyc will generate an error if it can't compile the
class as a native class, instead of falling back to
a non-native class:
from mypy_extensions import mypyc_attr
from foo import MyMeta
# Error: Unsupported metaclass for a native class
@mypyc_attr(native_class=True)
class C(metaclass=MyMeta):
...
Since native classes are significantly more efficient that
non-native classes, you may want to ensure that certain
classes always compiled as native classes.
- Update to 1.15.0:
By default, mypy treats bytearray and memoryview values as
assignable to the bytes type, for historical reasons. Use the
--strict-bytes flag to disable this behavior. PEP 688
specified the removal of this special case. The flag will be
enabled by default in mypy 2.0.
Contributed by Ali Hamdan (PR 18263) and Shantanu Jain (PR 13952).
Improvements to Reachability Analysis and Partial Type Handling in Loops
This change results in mypy better modelling control flow
within loops and hence detecting several previously ignored
issues. In some cases, this change may require additional
explicit variable annotations.
Contributed by Christoph Tyralla (PR 18180, PR 18433).
(Speaking of partial types, remember that we plan to enable
--local-partial-types by default in mypy 2.0.)
Better Discovery of Configuration Files
Mypy will now walk up the filesystem (up until a repository
or file system root) to discover configuration files. See the
mypy configuration file documentation for more details.
Contributed by Mikhail Shiryaev and Shantanu Jain (PR 16965, PR 18482)
Better Line Numbers for Decorators and Slice Expressions
Mypy now uses more correct line numbers for decorators and
slice expressions. In some cases, you may have to change the
location of a # type: ignore comment.
Contributed by Shantanu Jain (PR 18392, PR 18397).
Drop Support for Python 3.8
Mypy no longer supports running with Python 3.8, which has
reached end-of-life. When running mypy with Python 3.9+, it
is still possible to type check code that needs to support
Python 3.8 with the --python-version 3.8 argument. Support
for this will be dropped in the first half of 2025!
-------------------------------------------------------------------
Mon May 5 13:29:04 UTC 2025 - Friedrich Haubensak <hsk17@mail.de>
- Add mypy-1.14.1-gcc15.patch from upstream to fix gcc15 compile
time error
-------------------------------------------------------------------
Mon May 5 12:58:47 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
- Update vendored types_* to the appropriate versions.
-------------------------------------------------------------------
Fri Jan 24 15:13:25 UTC 2025 - ecsos <ecsos@opensuse.org>
- Update to 1.14.1
* Mypyc Improvements
- Document optimized bytes operations and additional str operations (Jukka Lehtosalo, PR 18242)
- Add primitives and specialization for ord() (Jukka Lehtosalo, PR 18240)
- Optimize str.encode with specializations for common used encodings (Valentin Stanciu, PR 18232)
- Fix fall back to generic operation for staticmethod and classmethod (Advait Dixit, PR 18228)
- Support unicode surrogates in string literals (Jukka Lehtosalo, PR 18209)
- Fix index variable in for loop with builtins.enumerate (Advait Dixit, PR 18202)
- Fix check for enum classes (Advait Dixit, PR 18178)
- Fix loading type from imported modules (Advait Dixit, PR 18158)
- Fix initializers of final attributes in class body (Jared Hance, PR 18031)
- Fix name generation for modules with similar full names (aatle, PR 18001)
- Fix relative imports in __init__.py (Shantanu, PR 17979)
- Optimize dunder methods (jairov4, PR 17934)
- Replace deprecated _PyDict_GetItemStringWithError (Marc Mueller, PR 17930)
- Fix wheel build for cp313-win (Marc Mueller, PR 17941)
- Use public PyGen_GetCode instead of vendored implementation (Marc Mueller, PR 17931)
- Optimize calls to final classes (jairov4, PR 17886)
- Support ellipsis (...) expressions in class bodies (Newbyte, PR 17923)
- Sync pythoncapi_compat.h (Marc Mueller, PR 17929)
- Add runtests.py mypyc-fast for running fast mypyc tests (Jukka Lehtosalo, PR 17906)
* Stubgen Improvements
- Do not include mypy generated symbols (Ali Hamdan, PR 18137)
- Fix FunctionContext.fullname for nested classes (Chad Dombrova, PR 17963)
- Add flagfile support (Ruslan Sayfutdinov, PR 18061)
- Add support for PEP 695 and PEP 696 syntax (Ali Hamdan, PR 18054)
* Stubtest Improvements
- Allow the use of --show-traceback and --pdb with stubtest (Stephen Morton, PR 18037)
- Verify __all__ exists in stub (Sebastian Rittau, PR 18005)
- Stop telling people to use double underscores (Jelle Zijlstra, PR 17897)
* Documentation Updates
- Update config file documentation (sobolevn, PR 18103)
- Improve contributor documentation for Windows (ag-tafe, PR 18097)
- Correct note about --disallow-any-generics flag in documentation (Abel Sen, PR 18055)
- Further caution against --follow-imports=skip (Shantanu, PR 18048)
- Fix the edit page buttton link in documentation (Kanishk Pachauri, PR 17933)
* Other Notables Fixes and Improvements
- Show Protocol __call__ for arguments with incompatible types (MechanicalConstruct, PR 18214)
- Make join and meet symmetric with strict_optional (MechanicalConstruct, PR 18227)
- Preserve block unreachablility when checking function definitions with constrained TypeVars (Brian Schubert, PR 18217)
- Do not include non-init fields in the synthesized __replace__ method for dataclasses (Victorien, PR 18221)
- Disallow TypeVar constraints parameterized by type variables (Brian Schubert, PR 18186)
- Always complain about invalid varargs and varkwargs (Shantanu, PR 18207)
- Set default strict_optional state to True (Shantanu, PR 18198)
- Preserve type variable default None in type alias (Sukhorosov Aleksey, PR 18197)
- Add checks for invalid usage of continue/break/return in except* block (coldwolverine, PR 18132)
- Do not consider bare TypeVar not overlapping with None for reachability analysis (Stanislav Terliakov, PR 18138)
- Special case types.DynamicClassAttribute as property-like (Stephen Morton, PR 18150)
- Disallow bare ParamSpec in type aliases (Brian Schubert, PR 18174)
- Move long_description metadata to pyproject.toml (Marc Mueller, PR 18172)
- Support ==-based narrowing of Optional (Christoph Tyralla, PR 18163)
- Allow TypedDict assignment of Required item to NotRequired ReadOnly item (Brian Schubert, PR 18164)
- Allow nesting of Annotated with TypedDict special forms inside TypedDicts (Brian Schubert, PR 18165)
- Infer generic type arguments for slice expressions (Brian Schubert, PR 18160)
- Fix checking of match sequence pattern against bounded type variables (Brian Schubert, PR 18091)
- Fix incorrect truthyness for Enum types and literals (David Salvisberg, PR 17337)
- Move static project metadata to pyproject.toml (Marc Mueller, PR 18146)
- Fallback to stdlib json if integer exceeds 64-bit range (q0w, PR 18148)
- Fix 'or' pattern structural matching exhaustiveness (yihong, PR 18119)
- Fix type inference of positional parameter in class pattern involving builtin subtype (Brian Schubert, PR 18141)
- Fix [override] error with no line number when argument node has no line number (Brian Schubert, PR 18122)
- Fix some dmypy crashes (Ivan Levkivskyi, PR 18098)
- Fix subtyping between instance type and overloaded (Shantanu, PR 18102)
- Clean up new_semantic_analyzer config (Shantanu, PR 18071)
- Issue warning for enum with no members in stub (Shantanu, PR 18068)
- Fix enum attributes are not members (Terence Honles, PR 17207)
- Fix crash when checking slice expression with step 0 in tuple index (Brian Schubert, PR 18063)
- Allow union-with-callable attributes to be overridden by methods (Brian Schubert, PR 18018)
- Emit [mutable-override] for covariant override of attribute with method (Brian Schubert, PR 18058)
- Support ParamSpec mapping with functools.partial (Stanislav Terliakov, PR 17355)
- Fix approved stub ignore, remove normpath (Shantanu, PR 18045)
- Make disallow-any-unimported flag invertible (Séamus Ó Ceanainn, PR 18030)
- Filter to possible package paths before trying to resolve a module (falsedrow, PR 18038)
- Fix overlap check for ParamSpec types (Jukka Lehtosalo, PR 18040)
- Do not prioritize ParamSpec signatures during overload resolution (Stanislav Terliakov, PR 18033)
- Fix ternary union for literals (Ivan Levkivskyi, PR 18023)
- Fix compatibility checks for conditional function definitions using decorators (Brian Schubert, PR 18020)
- TypeGuard should be bool not Any when matching TypeVar (Evgeniy Slobodkin, PR 17145)
- Fix convert-cache tool (Shantanu, PR 17974)
- Fix generator comprehension with mypyc (Shantanu, PR 17969)
- Fix crash issue when using shadowfile with pretty (Max Chang, PR 17894)
- Fix multiple nested classes with new generics syntax (Max Chang, PR 17820)
- Better error for mypy -p package without py.typed (Joe Gordon, PR 17908)
- Emit error for raise NotImplemented (Brian Schubert, PR 17890)
- Add is_lvalue attribute to AttributeContext (Brian Schubert, PR 17881)
- Changes from 1.13
- Significantly speed up file handling error paths (Shantanu, PR 17920)
- Use fast path in modulefinder more often (Shantanu, PR 17950)
- Let mypyc optimise os.path.join (Shantanu, PR 17949)
- Make is_sub_path faster (Shantanu, PR 17962)
- Speed up stubs suggestions (Shantanu, PR 17965)
- Use sha1 for hashing (Shantanu, PR 17953)
- Use orjson instead of json, when available (Shantanu, PR 17955)
- Add faster-cache extra, test in CI (Shantanu, PR 17978)
-------------------------------------------------------------------
Mon Oct 14 12:48:06 UTC 2024 - Matej Cepl <mcepl@cepl.eu>
- Update to officially released version 1.12.0:
- Support Python 3.12 Syntax for Generics (PEP 695)
- Related improvements are included:
- Document Python 3.12 type parameter syntax (Jukka
Lehtosalo, PR 17816)
- Further documentation updates (Jukka Lehtosalo, PR 17826)
- Allow Self return types with contravariance (Jukka
Lehtosalo, PR 17786)
- Enable new type parameter syntax by default (Jukka
Lehtosalo, PR 17798)
- Generate error if new-style type alias used as base class
(Jukka Lehtosalo, PR 17789)
- Inherit variance if base class has explicit variance (Jukka
Lehtosalo, PR 17787)
- Fix crash on invalid type var reference (Jukka Lehtosalo,
PR 17788)
- Fix covariance of frozen dataclasses (Jukka Lehtosalo, PR
17783)
- Allow covariance with attribute that has "_" name prefix
(Jukka Lehtosalo, PR 17782)
- Support Annotated[...] in new-style type aliases (Jukka
Lehtosalo, PR 17777)
- Fix nested generic classes (Jukka Lehtosalo, PR 17776)
- Add detection and error reporting for the use of incorrect
expressions within the scope of a type parameter and a type
alias (Kirill Podoprigora, PR 17560)
- Basic Support for Python 3.13 This release adds partial
support for Python 3.13 features and compiled binaries for
Python 3.13. Mypyc now also supports Python 3.13.
- Various new stdlib features and changes (through typeshed
stub improvements)
- typing.ReadOnly (see below for more)
- typing.TypeIs (added in mypy 1.10, PEP 742)
- Type parameter defaults when using the legacy syntax (PEP
Th696) ese features are not supported yet:
- warnings.deprecated (PEP 702)
- Type parameter defaults when using Python 3.12 type
parameter syntax
- Mypyc Support for Python 3.13
- Add additional includes for Python 3.13 (Marc Mueller, PR
17506)
- Add another include for Python 3.13 (Marc Mueller, PR
17509)
- Fix ManagedDict functions for Python 3.13 (Marc Mueller, PR
17507)
- Update mypyc test output for Python 3.13 (Marc Mueller, PR
17508)
- Fix PyUnicode functions for Python 3.13 (Marc Mueller, PR
17504)
- Fix _PyObject_LookupAttrId for Python 3.13 (Marc Mueller,
PR 17505)
- Fix _PyList_Extend for Python 3.13 (Marc Mueller, PR 17503)
- Fix gen_is_coroutine for Python 3.13 (Marc Mueller, PR
17501)
- Fix _PyObject_FastCall for Python 3.13 (Marc Mueller, PR
17502)
- Avoid uses of _PyObject_CallMethodOneArg on 3.13 (Jukka
Lehtosalo, PR 17526)
- Don't rely on _PyType_CalculateMetaclass on 3.13 (Jukka
Lehtosalo, PR 17525)
- Don't use _PyUnicode_FastCopyCharacters on 3.13 (Jukka
Lehtosalo, PR 17524)
- Don't use _PyUnicode_EQ on 3.13, as it's no longer exported
(Jukka Lehtosalo, PR 17523)
- Inferring Unions for Conditional Expressions
- You can now use typing.ReadOnly to specity TypedDict items as
read-only (PEP 705):
- Python 3.8 End of Life Approaching
- Planned Changes to Defaults - more details in the full
Changelog.
- Documentation Updates
- Experimental Inline TypedDict Syntax
- Stubgen Improvements
- Stubtest Improvements
- Other Notables Fixes and Improvements
- Typeshed Updates
- Update types-psutil 6.0.0.20241011, and types-setuptools to
75.1.0.20241014 (just for testing, these are not openSUSE
packages of these tools).
- Remove _service* files.
-------------------------------------------------------------------
Wed Oct 09 22:17:25 UTC 2024 - mcepl@cepl.eu
- Temporarily switched to using git source before the problems
with 3.13.0 compatibility are fixed.
- Update to version 1.11.2+git.1728499967.eca206d:
* Fix union callees with functools.partial (#17903)
* [mypyc] Add "runtests.py mypyc-fast" for running fast mypyc tests (#17906)
* Emit error for "raise NotImplemented" (#17890)
* Document ReadOnly (PEP 705) (#17905)
* Make ReadOnly TypedDict items covariant (#17904)
* documentation for TypeIs (#17821)
* Improvements to functools.partial of types (#17898)
* Use 3.13.0 for ci tests (#17900)
* stubtest: Stop telling people to use double underscores (#17897)
* Add changelog for mypy 1.12 (#17889)
- Remove upstreamed latest-pythons.patch
-------------------------------------------------------------------
Fri Oct 4 14:11:11 UTC 2024 - Markéta Machová <mmachova@suse.com>
- Add upstream latest-pythons.patch to fix tests on latest Python releases
-------------------------------------------------------------------
Tue Sep 10 15:01:11 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Update to 1.11.2
* Support Python 3.12 Syntax for Generics (PEP 695)
* Support for `functools.partial`
* Stricter Checks for Untyped Overrides
* Type Inference Improvements
* Improvements to Detection of Overlapping Overloads
* Better Support for Type Hints in Expressions
* Mypyc Improvements
+ Support Python 3.12 syntax for generic functions and classes
+ Support Python 3.12 type alias syntax
+ Fix ParamSpec
+ Inline fast paths of integer unboxing operations
+ Inline tagged integer arithmetic and bitwise operations
+ Allow specifying primitives as pure
* Changes to Stubtest
+ Ignore `_ios_support`
+ Improve support for Python 3.13
* Changes to Stubgen
+ Gracefully handle invalid `Optional` and recognize aliases to PEP 604 unions
+ Fix for Python 3.13
+ Preserve enum value initialisers
* Miscellaneous New Features
+ Add error format support and JSON output option via `--output json`
+ Support `enum.member` in Python 3.11+
+ Support `enum.nonmember` in Python 3.11+
+ Support `namedtuple.__replace__` in Python 3.13
+ Support `rename=True` in collections.namedtuple
+ Add support for `__spec__`
* Changes to Error Reporting
+ Mention `--enable-incomplete-feature=NewGenericSyntax` in messages
+ Do not report plugin-generated methods with `explicit-override`
+ Use and display namespaces for function type variables
+ Fix false positive for Final local scope variable in Protocol
+ Use Never in more messages, use ambiguous in join
+ Log full path to config file in verbose output
+ Added `[prop-decorator]` code for unsupported property decorators (#14461)
+ Suppress second error message with `:=` and `[truthy-bool]`
+ Generate error for assignment of functional Enum to variable of different name
+ Fix error reporting on cached run after uninstallation of third party library
* Fixes for Crashes
+ Fix daemon crash on invalid type in TypedDict
+ Fix crash and bugs related to `partial()`
+ Fix crash when overriding with unpacked TypedDict
+ Fix crash on TypedDict unpacking for ParamSpec
+ Fix crash involving recursive union of tuples
+ Fix crash on invalid callable property override
+ Fix crash on unpacking self in NamedTuple
+ Fix crash on recursive alias with an optional type
+ Fix crash on type comment inside generic definitions
* Changes to Documentation
+ Use inline config in documentation for optional error codes
+ Use lower-case generics in documentation
+ Add documentation for show-error-code-links
+ Update CONTRIBUTING.md to include commands for Windows
* Other Notable Improvements and Fixes
+ Fix ParamSpec inference against TypeVarTuple
+ Fix explicit type for `partial`
+ Always allow lambda calls
+ Fix isinstance checks with PEP 604 unions containing None
+ Fix self-referential upper bound in new-style type variables
+ Consider overlap between instances and callables
+ Allow new-style self-types in classmethods
+ Fix isinstance with type aliases to PEP 604 unions
+ Properly handle unpacks in overlap checks
+ Fix type application for classes with generic constructors
+ Update `typing_extensions` to >=4.6.0 to fix Python 3.12 error
+ Avoid "does not return" error in lambda
+ Fix bug with descriptors in non-strict-optional mode
+ Dont leak unreachability from lambda body to surrounding scope
+ Fix issues with non-ASCII characters on Windows
+ Fix for type narrowing of negative integer literals
+ Fix confusion between .py and .pyi files in mypy daemon
+ Fix type of `tuple[X, Y]` expression
+ Don't forget that a `TypedDict` was wrapped in `Unpack`
after a `name-defined` error occurred
+ Mark annotated argument as having an explicit, not inferred type
+ Don't consider Enum private attributes as enum members
+ Fix Literal strings containing pipe characters
- Update BuildRequires from setup.py
-------------------------------------------------------------------
Mon Jun 17 05:39:04 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 1.10.0:
* Support TypeIs (PEP 742)
* Support TypeVar Defaults (PEP 696)
* Support TypeAliasType (PEP 695)
* Detect Additional Unsafe Uses of super()
* Fix incorrect inferred type when accessing descriptor on union type
* Fix crash when expanding invalid Unpack in a Callable alias
* Fix false positive when string formatting with string enum
* Narrow individual items when matching a tuple to a sequence pattern
* Fix false positive from type variable within TypeGuard or TypeIs
* Improve yield from inference for unions of generators
* Fix emulating hash method logic in attrs classes
* Add reverted typeshed commit that uses ParamSpec for functools.wraps
* Fix type narrowing for types.EllipsisType
* Fix single item enum match type exhaustion
* Improve type inference with empty collections
* Fix override checking for decorated property
* Fix narrowing on match with function subject
- Drop including types-ast, no longer required.
- Drop patch workaround-parenthesized-context-managers.patch, now
included upstream.
-------------------------------------------------------------------
Thu Apr 4 08:32:32 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch workaround-parenthesized-context-managers.patch:
* Work around parenthesized context managers issue.
- Stop skipping tests under Python 3.6.
- Drop -x argument to pytest.
-------------------------------------------------------------------
Wed Mar 27 15:59:56 UTC 2024 - ecsos <ecsos@opensuse.org>
- Disable self_check under %check in Leap because it does not work
and prevent package building.
-------------------------------------------------------------------
Fri Mar 22 13:48:55 UTC 2024 - Matej Cepl <mcepl@cepl.eu>
- Clean up SPEC file.
-------------------------------------------------------------------
Mon Mar 18 14:33:02 UTC 2024 - Dan Čermák <dcermak@suse.com>
New upstream release 1.9.0
#### Breaking Changes
Because the version of typeshed we use in mypy 1.9 doesn't support 3.7, neither does mypy 1.9. (Jared Hance, PR [16883](https://github.com/python/mypy/pull/16883))
We are planning to enable
[local partial types](https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-local-partial-types) (enabled via the
`--local-partial-types` flag) later this year by default. This change
was announced years ago, but now it's finally happening. This is a
major backward-incompatible change, so we'll probably include it as
part of the upcoming mypy 2.0 release. This makes daemon and
non-daemon mypy runs have the same behavior by default.
Local partial types can also be enabled in the mypy config file:
```
local_partial_types = True
```
We are looking at providing a tool to make it easier to migrate
projects to use `--local-partial-types`, but it's not yet clear whether
this is practical. The migration usually involves adding some
explicit type annotations to module-level and class-level variables.
#### Basic Support for Type Parameter Defaults (PEP 696)
This release contains new experimental support for type parameter
defaults ([PEP 696](https://peps.python.org/pep-0696)). Please try it
out! This feature was contributed by Marc Mueller.
Since this feature will be officially introduced in the next Python
feature release (3.13), you will need to import `TypeVar`, `ParamSpec`
or `TypeVarTuple` from `typing_extensions` to use defaults for now.
This example adapted from the PEP defines a default for `BotT`:
```python
from typing import Generic
from typing_extensions import TypeVar
class Bot: ...
BotT = TypeVar("BotT", bound=Bot, default=Bot)
class Context(Generic[BotT]):
bot: BotT
class MyBot(Bot): ...
# type is Bot (the default)
reveal_type(Context().bot)
# type is MyBot
reveal_type(Context[MyBot]().bot)
```
#### Type-checking Improvements
* Fix missing type store for overloads (Marc Mueller, PR [16803](https://github.com/python/mypy/pull/16803))
* Fix `'WriteToConn' object has no attribute 'flush'` (Charlie Denton, PR [16801](https://github.com/python/mypy/pull/16801))
* Improve TypeAlias error messages (Marc Mueller, PR [16831](https://github.com/python/mypy/pull/16831))
* Support narrowing unions that include `type[None]` (Christoph Tyralla, PR [16315](https://github.com/python/mypy/pull/16315))
* Support TypedDict functional syntax as class base type (anniel-stripe, PR [16703](https://github.com/python/mypy/pull/16703))
* Accept multiline quoted annotations (Shantanu, PR [16765](https://github.com/python/mypy/pull/16765))
* Allow unary + in `Literal` (Jelle Zijlstra, PR [16729](https://github.com/python/mypy/pull/16729))
* Substitute type variables in return type of static methods (Kouroche Bouchiat, PR [16670](https://github.com/python/mypy/pull/16670))
* Consider TypeVarTuple to be invariant (Marc Mueller, PR [16759](https://github.com/python/mypy/pull/16759))
* Add `alias` support to `field()` in `attrs` plugin (Nikita Sobolev, PR [16610](https://github.com/python/mypy/pull/16610))
* Improve attrs hashability detection (Tin Tvrtković, PR [16556](https://github.com/python/mypy/pull/16556))
#### Performance Improvements
* Speed up finding function type variables (Jukka Lehtosalo, PR [16562](https://github.com/python/mypy/pull/16562))
#### Documentation Updates
* Document supported values for `--enable-incomplete-feature` in "mypy --help" (Froger David, PR [16661](https://github.com/python/mypy/pull/16661))
* Update new type system discussion links (thomaswhaley, PR [16841](https://github.com/python/mypy/pull/16841))
* Add missing class instantiation to cheat sheet (Aleksi Tarvainen, PR [16817](https://github.com/python/mypy/pull/16817))
* Document how evil `--no-strict-optional` is (Shantanu, PR [16731](https://github.com/python/mypy/pull/16731))
* Improve mypy daemon documentation note about local partial types (Makonnen Makonnen, PR [16782](https://github.com/python/mypy/pull/16782))
* Fix numbering error (Stefanie Molin, PR [16838](https://github.com/python/mypy/pull/16838))
* Various documentation improvements (Shantanu, PR [16836](https://github.com/python/mypy/pull/16836))
#### Stubtest Improvements
* Ignore private function/method parameters when they are missing from the stub (private parameter names start with a single underscore and have a default) (PR [16507](https://github.com/python/mypy/pull/16507))
* Ignore a new protocol dunder (Alex Waygood, PR [16895](https://github.com/python/mypy/pull/16895))
* Private parameters can be omitted (Sebastian Rittau, PR [16507](https://github.com/python/mypy/pull/16507))
* Add support for setting enum members to "..." (Jelle Zijlstra, PR [16807](https://github.com/python/mypy/pull/16807))
* Adjust symbol table logic (Shantanu, PR [16823](https://github.com/python/mypy/pull/16823))
* Fix posisitional-only handling in overload resolution (Shantanu, PR [16750](https://github.com/python/mypy/pull/16750))
#### Stubgen Improvements
* Fix crash on star unpack of TypeVarTuple (Ali Hamdan, PR [16869](https://github.com/python/mypy/pull/16869))
* Use PEP 604 unions everywhere (Ali Hamdan, PR [16519](https://github.com/python/mypy/pull/16519))
* Do not ignore property deleter (Ali Hamdan, PR [16781](https://github.com/python/mypy/pull/16781))
* Support type stub generation for `staticmethod` (WeilerMarcel, PR [14934](https://github.com/python/mypy/pull/14934))
-------------------------------------------------------------------
Tue Jan 2 17:24:56 UTC 2024 - Dirk Müller <dmueller@suse.com>
- update to 1.8.0:
* https://mypy-lang.blogspot.com/2023/12/mypy-18-released.html
* https://mypy-lang.blogspot.com/2023/11/mypy-17-released.html
* https://mypy-lang.blogspot.com/2023/10/mypy-16-released.html
- fix dependencies
-------------------------------------------------------------------
Wed Aug 30 18:31:19 UTC 2023 - Martin Schreiner <martin.schreiner@suse.com>
@@ -39,7 +744,7 @@ Sun Aug 13 06:30:29 UTC 2023 - Sebastian Wagner <sebix@sebix.at>
- Fix strict optional handling in dataclasses (Ivan Levkivskyi, PR 15571)
- Support optional types for custom dataclass descriptors (Marc Mueller, PR 15628)
- Add __slots__ attribute to dataclasses (Nikita Sobolev, PR 15649)
- Support better __post_init__ method signature for dataclasses (Nikita Sobolev, PR 15503)
- Support better __post_init__ method signature for dataclasses (Nikita Sobolev, PR 15503)
- Mypyc Improvements
- Support unsigned 8-bit native integer type: mypy_extensions.u8 (Jukka Lehtosalo, PR 15564)
- Support signed 16-bit native integer type: mypy_extensions.i16 (Jukka Lehtosalo, PR 15464)
@@ -47,16 +752,16 @@ Sun Aug 13 06:30:29 UTC 2023 - Sebastian Wagner <sebix@sebix.at>
- Document more unsupported features and update supported features (Richard Si, PR 15524)
- Fix final NamedTuple classes (Richard Si, PR 15513)
- Use C99 compound literals for undefined tuple values (Jukka Lehtosalo, PR 15453)
- Don't explicitly assign NULL values in setup functions (Logan Hunt, PR 15379)
- Don't explicitly assign NULL values in setup functions (Logan Hunt, PR 15379)
- Stubgen Improvements
- Teach stubgen to work with complex and unary expressions (Nikita Sobolev, PR 15661)
- Support ParamSpec and TypeVarTuple (Ali Hamdan, PR 15626)
- Fix crash on non-str docstring (Ali Hamdan, PR 15623)
- Fix crash on non-str docstring (Ali Hamdan, PR 15623)
- Documentation Updates
- Add documentation for additional error codes (Ivan Levkivskyi, PR 15539)
- Improve documentation of type narrowing (Ilya Priven, PR 15652)
- Small improvements to protocol documentation (Shantanu, PR 15460)
- Remove confusing instance variable example in cheat sheet (Adel Atallah, PR 15441)
- Remove confusing instance variable example in cheat sheet (Adel Atallah, PR 15441)
- Other Notable Fixes and Improvements
- Constant fold additional unary and binary expressions (Richard Si, PR 15202)
- Exclude the same special attributes from Protocol as CPython (Kyle Benesch, PR 15490)
@@ -74,7 +779,7 @@ Sun Aug 13 06:30:29 UTC 2023 - Sebastian Wagner <sebix@sebix.at>
- Remove parameters that no longer exist from NamedTuple._make() (Alex Waygood, PR 15578)
- Allow using typing.Self in __new__ with an explicit @staticmethod decorator (Erik Kemperman, PR 15353)
- Fix self types in subclass methods without Self annotation (Ivan Levkivskyi, PR 15541)
- Check for abstract class objects in tuples (Nikita Sobolev, PR 15366)
- Check for abstract class objects in tuples (Nikita Sobolev, PR 15366)
- Typeshed Updates
- Typeshed is now modular and distributed as separate PyPI packages for everything except the standard library stubs. Please see git log for full list of typeshed changes.
@@ -150,7 +855,7 @@ Sun May 7 09:54:51 UTC 2023 - Sebastian Wagner <sebix@sebix.at>
- Support implicit default for "init" parameter in field specifiers (Wesley Collin Wright and Jukka Lehtosalo, PR 15010)
- Support descriptors in dataclass transform (Jukka Lehtosalo, PR 15006)
- Fix frozen_default in incremental mode (Wesley Collin Wright)
- Fix frozen behavior for base classes with direct metaclasses (Wesley Collin Wright, PR 14878)
- Fix frozen behavior for base classes with direct metaclasses (Wesley Collin Wright, PR 14878)
- Mypyc: Native Floats
- Mypyc now uses a native, unboxed representation for values of type float. Previously these were heap-allocated Python objects. Native floats are faster and use less memory. Code that uses floating-point operations heavily can be several times faster when using native floats.
- Various float operations and math functions also now have optimized implementations. Refer to the documentation for a full list.
@@ -162,7 +867,7 @@ Sun May 7 09:54:51 UTC 2023 - Sebastian Wagner <sebix@sebix.at>
- Related changes:
- Use a native unboxed representation for floats (Jukka Lehtosalo, PR 14880)
- Document native floats and integers (Jukka Lehtosalo, PR 14927)
- Fixes to float to int conversion (Jukka Lehtosalo, PR 14936)
- Fixes to float to int conversion (Jukka Lehtosalo, PR 14936)
- Mypyc: Native Integers
- Mypyc now supports signed 32-bit and 64-bit integer types in addition to the arbitrary-precision int type. You can use the types mypy_extensions.i32 and mypy_extensions.i64 to speed up code that uses integer operations heavily.
- Refer to the documentation for more information. This feature was contributed by Jukka Lehtosalo.
@@ -170,20 +875,20 @@ Sun May 7 09:54:51 UTC 2023 - Sebastian Wagner <sebix@sebix.at>
- Support iterating over a TypedDict (Richard Si, PR 14747)
- Faster coercions between different tuple types (Jukka Lehtosalo, PR 14899)
- Faster calls via type aliases (Jukka Lehtosalo, PR 14784)
- Faster classmethod calls via cls (Jukka Lehtosalo, PR 14789)
- Faster classmethod calls via cls (Jukka Lehtosalo, PR 14789)
- Fixes to Crashes
- Fix crash on class-level import in protocol definition (Ivan Levkivskyi, PR 14926)
- Fix crash on single item union of alias (Ivan Levkivskyi, PR 14876)
- Fix crash on ParamSpec in incremental mode (Ivan Levkivskyi, PR 14885)
- Fix crash on ParamSpec in incremental mode (Ivan Levkivskyi, PR 14885)
- Documentation Updates
- Update adopting --strict documentation for 1.0 (Shantanu, PR 14865)
- Some minor documentation tweaks (Jukka Lehtosalo, PR 14847)
- Improve documentation of top level mypy: disable-error-code comment (Nikita Sobolev, PR 14810)
- Improve documentation of top level mypy: disable-error-code comment (Nikita Sobolev, PR 14810)
- Error Reporting Improvements
- Add error code to typing_extensions suggestion (Shantanu, PR 14881)
- Add a separate error code for top-level await (Nikita Sobolev, PR 14801)
- Dont suggest two obsolete stub packages (Jelle Zijlstra, PR 14842)
- Add suggestions for pandas-stubs and lxml-stubs (Shantanu, PR 14737)
- Add suggestions for pandas-stubs and lxml-stubs (Shantanu, PR 14737)
- Other Fixes and Improvements
- Multiple inheritance considers callable objects as subtypes of functions (Christoph Tyralla, PR 14855)
- stubtest: Respect @final runtime decorator and enforce it in stubs (Nikita Sobolev, PR 14922)
@@ -200,7 +905,7 @@ Sun May 7 09:54:51 UTC 2023 - Sebastian Wagner <sebix@sebix.at>
- Fix unpack with overloaded __iter__ method (Nikita Sobolev, PR 14817)
- Reduce size of JSON data in mypy cache (dosisod, PR 14808)
- Improve “used before definition” checks when a local definition has the same name as a global definition (Stas Ilinskiy, PR 14517)
- Honor NoReturn as __setitem__ return type to mark unreachable code (sterliakov, PR 12572)
- Honor NoReturn as __setitem__ return type to mark unreachable code (sterliakov, PR 12572)
-------------------------------------------------------------------
Wed Apr 12 12:37:48 UTC 2023 - Matej Cepl <mcepl@suse.com>
@@ -213,11 +918,11 @@ Wed Apr 12 12:37:48 UTC 2023 - Matej Cepl <mcepl@suse.com>
- Typeshed updates
- Plenty of fixes
- Removed upstreamed patch testI64Cast-fix.patch
-------------------------------------------------------------------
Tue Apr 11 07:15:55 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
- Sadly, six is still required for tests, re-add to BuildRequires.
- Sadly, six is still required for tests, re-add to BuildRequires.
-------------------------------------------------------------------
Tue Feb 14 06:02:49 UTC 2023 - Matej Cepl <mcepl@suse.com>
@@ -292,7 +997,7 @@ Tue Sep 27 16:01:57 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>
* Fix bad C generated for multiple assignment (Jukka Lehtosalo, PR 13147)
* Update, simplify check version test (Shantanu, PR 13125)
The full release notes can be found here:
The full release notes can be found here:
https://mypy-lang.blogspot.com/2022/09/mypy-0981-released.html
-------------------------------------------------------------------
@@ -487,7 +1192,7 @@ Tue Jun 21 09:00:36 UTC 2022 - Sebastian Wagner <sebix+novell.com@sebix.at>
- Avoid conflicts between type variables defined in different classes (Jukka Lehtosalo, PR 12590)
- Fix __slots__ and __deletable__ in incremental mode (Jukka Lehtosalo, PR 12645)
- Fix issue with ParamSpec serialization (Jukka Lehtosalo, PR 12654)
- Fix types of inherited attributes in generic dataclasses (Jukka Lehtosalo, PR 12656)
- Fix types of inherited attributes in generic dataclasses (Jukka Lehtosalo, PR 12656)
-------------------------------------------------------------------
Mon Mar 28 15:33:14 UTC 2022 - Matej Cepl <mcepl@suse.com>
@@ -651,7 +1356,7 @@ Fri Dec 31 19:58:41 UTC 2021 - Ben Greiner <code@bnavigator.de>
-------------------------------------------------------------------
Fri Dec 31 17:17:41 UTC 2021 - Sebastian Wagner <sebix+novell.com@sebix.at>
- add missing g++ compiler for tests
- add missing g++ compiler for tests
-------------------------------------------------------------------
Fri Dec 31 16:40:37 UTC 2021 - Sebastian Wagner <sebix+novell.com@sebix.at>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-mypy
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,46 +16,46 @@
#
%{?sle15_python_module_pythons}
%define types_psutil_version 7.0.0.20250401
%define types_setuptools_version 78.1.0.20250329
%bcond_without test
%define skip_python2 1
%define typed_ast_version 1.5.8.7
%define types_psutil_version 5.9.5.16
%define types_setuptools_version 68.1.0.0
%bcond_without libalternatives
%{?sle15_python_module_pythons}
Name: python-mypy
Version: 1.5.1
Version: 1.16.0
Release: 0
Summary: Optional static typing for Python
License: MIT
URL: https://www.mypy-lang.org/
Source0: https://files.pythonhosted.org/packages/source/m/mypy/mypy-%{version}.tar.gz
# Source0: mypy-%%{version}.tar.gz
# License Source1: Apache-2.0. Only for the test suite, not packaged here.
Source1: https://files.pythonhosted.org/packages/source/t/types-typed-ast/types-typed-ast-%{typed_ast_version}.tar.gz
Source1: https://files.pythonhosted.org/packages/source/t/types_psutil/types_psutil-%{types_psutil_version}.tar.gz
# License Source2: Apache-2.0. Only for the test suite, not packaged here.
Source2: https://files.pythonhosted.org/packages/source/t/types-psutil/types-psutil-%{types_psutil_version}.tar.gz
# License Source3: Apache-2.0. Only for the test suite, not packaged here.
Source3: https://files.pythonhosted.org/packages/source/t/types-setuptools/types-setuptools-%{types_setuptools_version}.tar.gz
Source2: https://files.pythonhosted.org/packages/source/t/types_setuptools/types_setuptools-%{types_setuptools_version}.tar.gz
Source99: python-mypy-rpmlintrc
BuildRequires: %{python_module exceptiongroup}
BuildRequires: %{python_module mypy_extensions >= 1.0.0}
BuildRequires: %{python_module pathspec}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module tomli >= 1.1.0 if %python-base < 3.11}
BuildRequires: %{python_module typed-ast >= 1.4.0 if %python-base < 3.8}
BuildRequires: %{python_module typing_extensions >= 3.10}
BuildRequires: %{python_module tomli >= 1.1.0}
BuildRequires: %{python_module typing_extensions >= 4.6.0}
BuildRequires: %{python_module wheel}
BuildRequires: alts
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: alts
Requires: python-mypy_extensions >= 0.4.3
Requires: python-pathspec
Requires: python-typing_extensions >= 3.10
Requires: (python-tomli >= 1.1.0 if python3-base < 3.11)
Requires: (python-typed-ast >= 1.4.0 if python3-base < 3.8)
Requires(post): update-alternatives
Requires(postun):update-alternatives
Requires: (python-tomli >= 1.1.0 if python-base < 3.11)
Suggests: python-psutil >= 4.0
BuildArch: noarch
%if "%{python_flavor}" == "python3" || "%{?python_provides}" == "python3"
Provides: mypy = %{version}
Obsoletes: mypy < %{version}
%endif
Suggests: python-psutil >= 4.0
BuildArch: noarch
%if %{with test}
BuildRequires: %{python_module attrs >= 18}
BuildRequires: %{python_module devel}
@@ -63,11 +63,9 @@ BuildRequires: %{python_module filelock >= 3.3}
BuildRequires: %{python_module importlib-metadata >= 4.6.1}
BuildRequires: %{python_module lxml >= 4}
BuildRequires: %{python_module psutil >= 4}
BuildRequires: %{python_module pytest >= 6.2}
BuildRequires: %{python_module pytest >= 8.1}
BuildRequires: %{python_module pytest-forked >= 1.3}
BuildRequires: %{python_module pytest-xdist >= 1.34}
BuildRequires: %{python_module six}
BuildRequires: %{python_module typed-ast >= 1.4.0}
BuildRequires: %{python_module virtualenv >= 20.6}
BuildRequires: gcc-c++
%endif
@@ -89,22 +87,22 @@ Mypy's type system features type inference, gradual typing, generics
and union types.
%prep
%setup -n mypy-%{version} -a1 -a2 -a3
%setup -q -a1 -n mypy-%{version}
%setup -q -T -D -a2 -n mypy-%{version}
%autopatch -p1
sed -i '/env python3/d' ./mypy/stubgenc.py
sed -i '/env python3/d' ./mypy/stubgen.py
mkdir mystubs
mv types-typed-ast-%{typed_ast_version}/typed_ast-stubs* mystubs/
mv types-setuptools-%{types_setuptools_version}/setuptools-stubs* mystubs/
mv types-psutil-%{types_psutil_version}/psutil-stubs* mystubs/
mv types_setuptools-%{types_setuptools_version}/setuptools-stubs* mystubs/
mv types_psutil-%{types_psutil_version}/psutil-stubs* mystubs/
# "E: wrong-script-end-of-line-encoding" and "E: spurious-executable-perm", file is not needed anyways
rm docs/make.bat
%build
%python_build
%pyproject_wheel
# building docs fails due to missing theme 'furo'
#pushd docs
#%%make_build html
@@ -112,31 +110,31 @@ rm docs/make.bat
#popd
%install
%python_install
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/dmypy
%python_clone -a %{buildroot}%{_bindir}/mypy
%python_clone -a %{buildroot}%{_bindir}/mypyc
%python_clone -a %{buildroot}%{_bindir}/stubgen
%python_clone -a %{buildroot}%{_bindir}/stubtest
%python_group_libalternatives mypy dmypy mypyc stubgen stubtest
# solve "W: python-doc-in-package" in 3.9, 3.10 and 3.11, but not in 3.8 (thus -f to ignore the error)
%python_expand rm -rf %{buildroot}%{$python_sitelib}/mypyc/doc
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%if %{with test}
%check
%if 0%{?suse_version} > 1600
%{python_expand # self-check with manually provided stubs for typed_ast
export PYTHONPATH=%{buildroot}%{$python_sitelib}:./mystubs
$python -m mypy --config-file mypy_self_check.ini -p mypy
}
%endif
unset PYTHONPATH
# cannot compile unoptimized with suse headers
export MYPYC_OPT_LEVEL=2
if [ $(getconf LONG_BIT) -ne 64 ]; then
# gh#python/mypy#11148
donttest+=" or testSubclassSpecialize or testMultiModuleSpecialize"
# fails only in python36 (EOL)
python36_donttest+=" or testIntOps"
fi
# the fake test_module is not in the modulepath without pytest-xdist
# or with pytest-xdist >= 2.3 -- https://github.com/python/mypy/issues/11019
@@ -145,21 +143,19 @@ donttest+=" or teststubtest"
donttest+=" or testMathOps or testFloatOps"
# fails on Python 3.11.4, see gh#python/mypy#15446. Patch db5b5af1201fff03465b0684d16b6489a62a3d78 does not apply clean, better wait for a new upstream version
donttest+=" or PEP561Suite"
%pytest -n auto -k "not (testallexcept ${donttest} ${$python_donttest})" -x
%pytest -n auto -k "not (testallexcept ${donttest})"
%endif
%post
%python_install_alternative mypy dmypy mypyc stubgen stubtest
%postun
%python_uninstall_alternative mypy
%pre
%python_libalternatives_reset_alternative mypy
%files %{python_files}
%doc docs/
%license LICENSE
%{python_sitelib}/mypy
%{python_sitelib}/mypyc
%{python_sitelib}/mypy-%{version}*-info
# %%{python_sitelib}/mypy-%%{version}.dist-info
%{python_sitelib}/mypy-*.dist-info
%python_alternative %{_bindir}/dmypy
%python_alternative %{_bindir}/mypy
%python_alternative %{_bindir}/mypyc

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4e9b219efb625d3d04f6bf106934f87cab49aa41a94b0a3b3089403f47a79228
size 14060

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2bc9b0c0818f77bdcec619970e452b320a423bb3ac074f5f8bc9300ac281c4ae
size 32689

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f7795f6f9d597b35212314040b993f6613b51d81738edce3c1e3a3e9ef655124
size 5581

Binary file not shown.

Binary file not shown.