14
0
forked from pool/python-mypy

- 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
This commit is contained in:
2025-05-29 15:32:58 +00:00
committed by Git OBS Bridge
commit 79e4785261
17 changed files with 2569 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

28
latest-pythons.patch Normal file
View File

@@ -0,0 +1,28 @@
From 1a2c8e2a4df21532e4952191cad74ae50083f4ad Mon Sep 17 00:00:00 2001
From: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Date: Sat, 28 Sep 2024 14:20:45 -0700
Subject: [PATCH] Fix tests on latest Python 3.13 (and 3.12) (#17849)
Related to python/cpython@c6c3d970ba54f4ad4c4151bb262cef96d3299480
(python/cpython#121329), thanks to brianschubert for noticing
---
mypyc/test-data/run-dicts.test | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mypyc/test-data/run-dicts.test b/mypyc/test-data/run-dicts.test
index 58b862e3f303..d4f5b945309e 100644
--- a/mypyc/test-data/run-dicts.test
+++ b/mypyc/test-data/run-dicts.test
@@ -157,7 +157,11 @@ else:
try:
clear_during_iter(d)
except RuntimeError as e:
- assert str(e) == "OrderedDict changed size during iteration"
+ assert str(e) in (
+ "OrderedDict changed size during iteration",
+ # Error message changed in Python 3.13 and some 3.12 patch version
+ "OrderedDict mutated during iteration",
+ )
else:
assert False

3
mypy-1.10.0.tar.gz Normal file
View File

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

3
mypy-1.11.2.tar.gz Normal file
View File

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

BIN
mypy-1.12.0.tar.gz LFS Normal file

Binary file not shown.

38
mypy-1.14.1-gcc15.patch Normal file
View File

@@ -0,0 +1,38 @@
github.com/python/mypy/issues/18698
github.com/python/mypy/pull/18699
github.com/python/mypy/commit/0808624
From 0808624c67331f52c2d503ad8afe4f1087b0371c Mon Sep 17 00:00:00 2001
From: "Michael R. Crusoe" <1330696+mr-c@users.noreply.github.com>
Date: Tue, 18 Feb 2025 00:45:37 +0100
Subject: [PATCH] pythoncapi_compat: don't define Py_NULL if it is already
defined (#18699)
Fixes: #18698
This is a naive fix for the gcc 15 error when compiling for Python 3.12
---
mypyc/lib-rt/pythoncapi_compat.h | 2 ++
1 file changed, 2 insertions(+)
Index: mypy-1.14.1/mypyc/lib-rt/pythoncapi_compat.h
===================================================================
--- mypy-1.14.1.orig/mypyc/lib-rt/pythoncapi_compat.h 2024-12-30 15:26:58.000000000 +0100
+++ mypy-1.14.1/mypyc/lib-rt/pythoncapi_compat.h 2025-05-05 16:10:16.167068167 +0200
@@ -30,6 +30,7 @@
# define _Py_CAST(type, expr) ((type)(expr))
#endif
+#ifndef _Py_NULL
// Static inline functions should use _Py_NULL rather than using directly NULL
// to prevent C++ compiler warnings. On C23 and newer and on C++11 and newer,
// _Py_NULL is defined as nullptr.
@@ -39,6 +40,7 @@
#else
# define _Py_NULL NULL
#endif
+#endif
// Cast argument to PyObject* type.
#ifndef _PyObject_CAST

BIN
mypy-1.14.1.tar.gz LFS Normal file

Binary file not shown.

BIN
mypy-1.16.0.tar.gz LFS Normal file

Binary file not shown.

4
mypy.obsinfo Normal file
View File

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

2
python-mypy-rpmlintrc Normal file
View File

@@ -0,0 +1,2 @@
addFilter("zero-length .*/usr/lib/python.*/site-packages/mypy/typeshed/.*\.pyi")
addFilter("devel-file-in-non-devel-package")

2282
python-mypy.changes Normal file

File diff suppressed because it is too large Load Diff

164
python-mypy.spec Normal file
View File

@@ -0,0 +1,164 @@
#
# spec file for package python-mypy
#
# 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
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define types_psutil_version 7.0.0.20250401
%define types_setuptools_version 78.1.0.20250329
%bcond_without test
%{?sle15_python_module_pythons}
Name: python-mypy
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_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_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 pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module tomli >= 1.1.0}
BuildRequires: %{python_module typing_extensions >= 4.6.0}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-mypy_extensions >= 0.4.3
Requires: python-typing_extensions >= 3.10
Requires: (python-tomli >= 1.1.0 if python-base < 3.11)
Requires(post): update-alternatives
Requires(postun): update-alternatives
Suggests: python-psutil >= 4.0
BuildArch: noarch
%if "%{python_flavor}" == "python3" || "%{?python_provides}" == "python3"
Provides: mypy = %{version}
Obsoletes: mypy < %{version}
%endif
%if %{with test}
BuildRequires: %{python_module attrs >= 18}
BuildRequires: %{python_module devel}
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 >= 8.1}
BuildRequires: %{python_module pytest-forked >= 1.3}
BuildRequires: %{python_module pytest-xdist >= 1.34}
BuildRequires: %{python_module virtualenv >= 20.6}
BuildRequires: gcc-c++
%endif
# SECTION docs
BuildRequires: python3-Sphinx >= 1.4.4
BuildRequires: python3-sphinx_rtd_theme >= 0.1.9
# /SECTION
%python_subpackages
%description
Mypy is an optional static type checker for Python that aims to
combine the benefits of both dynamic (or "duck") typing as well as
static typing.
Mypy type checks standard Python programs. It can catch many
programming errors by analyzing programs without having to run them.
There is basically no runtime overhead when run using any Python VM.
Mypy's type system features type inference, gradual typing, generics
and union types.
%prep
%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_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
%pyproject_wheel
# building docs fails due to missing theme 'furo'
#pushd docs
#%%make_build html
#rm build/html/.buildinfo
#popd
%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
# 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"
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
donttest+=" or teststubtest"
# gh#python/mypy#15221
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})"
%endif
%post
%python_install_alternative mypy dmypy mypyc stubgen stubtest
%postun
%python_uninstall_alternative mypy
%files %{python_files}
%doc docs/
%license LICENSE
%{python_sitelib}/mypy
%{python_sitelib}/mypyc
# %%{python_sitelib}/mypy-%%{version}.dist-info
%{python_sitelib}/mypy-*.dist-info
%python_alternative %{_bindir}/dmypy
%python_alternative %{_bindir}/mypy
%python_alternative %{_bindir}/mypyc
%python_alternative %{_bindir}/stubgen
%python_alternative %{_bindir}/stubtest
%changelog

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.