2022-11-28 04:04:00 +00:00
#
2023-09-01 17:05:19 +00:00
# spec file for package python-mypy
2022-11-28 04:04:00 +00:00
#
Accepting request 1240190 from home:ecsos:python
- 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/request/show/1240190
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
# Copyright (c) 2025 SUSE LLC
2022-11-28 04:04:00 +00:00
#
# 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/
#
2025-05-05 12:59:34 +00:00
%define types_psutil_version 7.0.0.20250401
%define types_setuptools_version 78.1.0.20250329
2022-11-28 04:04:00 +00:00
%bcond_without test
2025-08-12 13:00:05 +00:00
%if 0%{?suse_version} > 1500
2025-07-08 08:37:30 +00:00
%bcond_without libalternatives
2025-08-12 13:00:05 +00:00
%else
%bcond_with libalternatives
%endif
2025-05-05 12:59:34 +00:00
%{?sle15_python_module_pythons}
2023-09-01 17:05:19 +00:00
Name : python-mypy
2025-07-16 10:53:00 +00:00
Version : 1.17.0
2022-11-28 04:04:00 +00:00
Release : 0
Summary : Optional static typing for Python
License : MIT
2023-09-01 17:05:19 +00:00
URL : https://www.mypy-lang.org/
- 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
Source0 : https://files.pythonhosted.org/packages/source/m/mypy/mypy-%{version} .tar.gz
# Source0: mypy-%%{version}.tar.gz
2022-11-28 04:04:00 +00:00
# License Source1: Apache-2.0. Only for the test suite, not packaged here.
2025-05-05 14:10:47 +00:00
Source1 : https://files.pythonhosted.org/packages/source/t/types_psutil/types_psutil-%{types_psutil_version} .tar.gz
2023-05-08 15:30:06 +00:00
# License Source2: Apache-2.0. Only for the test suite, not packaged here.
2025-05-05 14:10:47 +00:00
Source2 : https://files.pythonhosted.org/packages/source/t/types_setuptools/types_setuptools-%{types_setuptools_version} .tar.gz
2023-09-01 17:05:19 +00:00
Source99 : python-mypy-rpmlintrc
2024-03-22 14:16:08 +00:00
BuildRequires : %{python_module exceptiongroup}
2023-09-01 17:05:19 +00:00
BuildRequires : %{python_module mypy_extensions >= 1.0.0}
2025-05-29 15:34:38 +00:00
BuildRequires : %{python_module pathspec}
2024-03-22 14:16:08 +00:00
BuildRequires : %{python_module pip}
2022-11-28 04:04:00 +00:00
BuildRequires : %{python_module setuptools}
2024-03-22 13:47:03 +00:00
BuildRequires : %{python_module tomli >= 1.1.0}
2024-09-11 06:59:56 +00:00
BuildRequires : %{python_module typing_extensions >= 4.6.0}
2023-09-01 17:05:19 +00:00
BuildRequires : %{python_module wheel}
2022-11-28 04:04:00 +00:00
BuildRequires : fdupes
BuildRequires : python-rpm-macros
Requires : python-mypy_extensions >= 0.4.3
2025-05-30 11:16:46 +00:00
Requires : python-pathspec
2022-11-28 04:04:00 +00:00
Requires : python-typing_extensions >= 3.10
- 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
Requires : (python-tomli >= 1.1.0 if python-base < 3.11)
2025-05-05 12:59:34 +00:00
Suggests : python-psutil >= 4.0
BuildArch : noarch
2022-11-28 04:04:00 +00:00
%if "%{python_flavor}" == "python3" || "%{?python_provides}" == "python3"
Provides : mypy = %{version}
Obsoletes : mypy < %{version}
%endif
2025-07-28 13:20:04 +00:00
%if %{with libalternatives}
BuildRequires : alts
Requires : alts
%else
Requires(post) : update-alternatives
Requires(postun) : update-alternatives
%endif
2022-11-28 04:04:00 +00:00
%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}
2024-06-17 05:39:18 +00:00
BuildRequires : %{python_module pytest >= 8.1}
2022-11-28 04:04:00 +00:00
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 " d u c k " ) 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
2025-05-05 12:59:34 +00:00
%setup -q -a1 -n mypy-%{version}
2025-05-05 14:10:47 +00:00
%setup -q -T -D -a2 -n mypy-%{version}
2023-05-08 15:30:06 +00:00
%autopatch -p1
2022-11-28 04:04:00 +00:00
sed -i '/env python3/d' ./mypy/stubgenc.py
sed -i '/env python3/d' ./mypy/stubgen.py
mkdir mystubs
2025-05-05 12:59:34 +00:00
mv types_setuptools-%{types_setuptools_version} /setuptools-stubs* mystubs/
mv types_psutil-%{types_psutil_version} /psutil-stubs* mystubs/
2022-11-28 04:04:00 +00:00
2023-09-01 17:05:19 +00:00
# "E: wrong-script-end-of-line-encoding" and "E: spurious-executable-perm", file is not needed anyways
rm docs/make.bat
2022-11-28 04:04:00 +00:00
%build
2024-03-22 14:16:08 +00:00
%pyproject_wheel
2022-11-28 04:04:00 +00:00
# building docs fails due to missing theme 'furo'
#pushd docs
#%%make_build html
#rm build/html/.buildinfo
#popd
%install
2024-03-22 14:16:08 +00:00
%pyproject_install
2022-11-28 04:04:00 +00:00
%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
2025-07-08 08:37:30 +00:00
%python_group_libalternatives mypy dmypy mypyc stubgen stubtest
2023-09-01 17:05:19 +00:00
# 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
2022-11-28 04:04:00 +00:00
%python_expand %fdupes %{buildroot} %{$python_sitelib}
%if %{with test}
%check
2024-03-28 08:08:12 +00:00
%if 0%{?suse_version} > 1600
2022-11-28 04:04:00 +00:00
%{python_expand # self-check with manually provided stubs for typed_ast
2023-05-08 15:30:06 +00:00
export PYTHONPATH=%{buildroot} %{$python_sitelib}:./mystubs
2022-11-28 04:04:00 +00:00
$python -m mypy --config-file mypy_self_check.ini -p mypy
}
2024-03-28 08:08:12 +00:00
%endif
2022-11-28 04:04:00 +00:00
unset PYTHONPATH
# cannot compile unoptimized with suse headers
export MYPYC_OPT_LEVEL=2
if [ $(getconf LONG_BIT) -ne 64 ]; then
2023-05-08 15:30:06 +00:00
# gh#python/mypy#11148
2022-11-28 04:04:00 +00:00
donttest+=" o r t e s t S u b c l a s s S p e c i a l i z e o r t e s t M u l t i M o d u l e S p e c i a l i z e "
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+=" o r t e s t s t u b t e s t "
2024-04-04 08:33:29 +00:00
# gh#python/mypy#15221
donttest+=" o r t e s t M a t h O p s o r t e s t F l o a t O p s "
2023-09-01 17:05:19 +00:00
# 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+=" o r P E P 5 6 1 S u i t e "
2024-04-04 08:33:29 +00:00
%pytest -n auto -k " n o t ( t e s t a l l e x c e p t $ { d o n t t e s t } ) "
2022-11-28 04:04:00 +00:00
%endif
2025-07-08 08:37:30 +00:00
%pre
%python_libalternatives_reset_alternative mypy
2025-07-28 13:20:04 +00:00
%post
%python_install_alternative mypy dmypy mypyc stubgen stubtest
%postun
%python_uninstall_alternative mypy
2022-11-28 04:04:00 +00:00
%files %{python_files}
%doc docs/
%license LICENSE
%{python_sitelib} /mypy
%{python_sitelib} /mypyc
2025-05-05 12:59:34 +00:00
# %%{python_sitelib}/mypy-%%{version}.dist-info
2024-10-10 12:17:41 +00:00
%{python_sitelib} /mypy-*.dist-info
2022-11-28 04:04:00 +00:00
%python_alternative %{_bindir} /dmypy
%python_alternative %{_bindir} /mypy
%python_alternative %{_bindir} /mypyc
%python_alternative %{_bindir} /stubgen
%python_alternative %{_bindir} /stubtest
%changelog