14
0
forked from pool/python-mypy
Files
python-mypy/python-mypy.spec

181 lines
6.3 KiB
RPMSpec
Raw Permalink Normal View History

#
# spec file for package python-mypy
#
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
#
# 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
%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif
%{?sle15_python_module_pythons}
Name: python-mypy
2025-07-16 10:53:00 +00:00
Version: 1.17.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 pathspec}
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-pathspec
Requires: python-typing_extensions >= 3.10
2024-01-02 17:27:14 +00:00
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
%if %{with libalternatives}
BuildRequires: alts
Requires: alts
%else
Requires(post): update-alternatives
Requires(postun): update-alternatives
%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
%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"
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
%pre
%python_libalternatives_reset_alternative mypy
%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