15
0
Files
python-flake8-pyi/python-flake8-pyi.spec

84 lines
2.7 KiB
RPMSpec
Raw Normal View History

#
# spec file for package python-flake8-pyi
#
# Copyright (c) 2024 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/
#
- update to 23.11.0: * Y058: Use `Iterator` rather than `Generator` as the return value for simple `__iter__` methods, and `AsyncIterator` rather than `AsyncGenerator` as the return value for simple `__aiter__` methods. * Y059: `Generic[]` should always be the last base class, if it is present in the bases of a class. * Y060, which flags redundant inheritance from `Generic[]`. * Y061: Do not use `None` inside a `Literal[]` slice. * For example, use `Literal["foo"] | None` instead of `Literal["foo", None]`. * Y022 and Y037 now flag more imports from `typing_extensions`. * Y034 now attempts to avoid flagging methods inside classes that inherit from `builtins.type`, `abc.ABCMeta` and/or `enum.EnumMeta`. Classes that have one or more of these as bases are metaclasses, and PEP 673 forbids the use of `typing(_extensions).Self` for metaclasses. * Attempting to import `typing_extensions.Text` now causes Y039 to be emitted rather than Y023. * Y053 will no longer be emitted for the argument to `@typing_extensions.deprecated`. * Introduce Y090, which warns if you have an annotation such as `tuple[int]` or `Tuple[int]`. These mean "a tuple of length 1, in which the sole element is of type `int`". This is sometimes what you want, but more usually you'll want `tuple[int, ...]`, which means "a tuple of arbitrary (possibly 0) length, in which all elements are of type `int`". * Y011 now ignores `sentinel` and `_typeshed.sentinel` in default values. * Y011/Y014/Y015: Allow math constants math.inf, math.nan, math.e, OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=21
2023-12-05 21:09:18 +00:00
%{?sle15_python_module_pythons}
Name: python-flake8-pyi
Version: 24.9.0
Release: 0
Summary: A plugin for flake8 to enable linting .pyi files
License: MIT
Group: Development/Languages/Python
URL: https://github.com/ambv/flake8-pyi
- Add set-tests-python-path.patch to fix tests inside osc build environment, running the flake8 process with shell=True and forcing the PYTHONPATH. - Update to 23.1.2: * Y011/Y014/Y015: Increase the maximum character length of literal numbers in default values from 7 to 10, allowing hexadecimal representation of 32-bit integers. Contributed by Avasam. - 23.1.1 New error codes: * Y052: Disallow default values in global or class namespaces where the assignment does not have a type annotation. Stubs should be explicit about the type of all variables in the stub; without type annotations, the type checker is forced to make inferences, which may have unpredictable consequences. Enum members are excluded from this check, as are various special assignments such as __all__ and __match_args__. Other changes: * Disallow numeric default values where len(str(default)) > 7. If a function has a default value where the string representation is greater than 7 characters, it is likely to be an implementation detail or a constant that varies depending on the system you're running on, such as sys.maxsize. * Disallow str or bytes defaults where the default is >50 characters long, for similar reasons. * Allow ast.Attribute nodes as default values for a small number of special cases, such as sys.maxsize and sys.executable. * Fewer Y020 false positives are now emitted when encountering default values in stub files. - 23.1.0 Bugfixes: OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=17
2023-03-06 15:56:20 +00:00
Source: https://files.pythonhosted.org/packages/source/f/flake8-pyi/flake8_pyi-%{version}.tar.gz
# PATCH-FIX-OPENSUSE set-tests-python-path.patch, patch to fix
# PYTHONPATH resolution for tests running inside osc
Patch0: set-tests-python-path.patch
2023-08-25 18:47:40 +00:00
BuildRequires: %{python_module base >= 3.8.0}
- update to 23.11.0: * Y058: Use `Iterator` rather than `Generator` as the return value for simple `__iter__` methods, and `AsyncIterator` rather than `AsyncGenerator` as the return value for simple `__aiter__` methods. * Y059: `Generic[]` should always be the last base class, if it is present in the bases of a class. * Y060, which flags redundant inheritance from `Generic[]`. * Y061: Do not use `None` inside a `Literal[]` slice. * For example, use `Literal["foo"] | None` instead of `Literal["foo", None]`. * Y022 and Y037 now flag more imports from `typing_extensions`. * Y034 now attempts to avoid flagging methods inside classes that inherit from `builtins.type`, `abc.ABCMeta` and/or `enum.EnumMeta`. Classes that have one or more of these as bases are metaclasses, and PEP 673 forbids the use of `typing(_extensions).Self` for metaclasses. * Attempting to import `typing_extensions.Text` now causes Y039 to be emitted rather than Y023. * Y053 will no longer be emitted for the argument to `@typing_extensions.deprecated`. * Introduce Y090, which warns if you have an annotation such as `tuple[int]` or `Tuple[int]`. These mean "a tuple of length 1, in which the sole element is of type `int`". This is sometimes what you want, but more usually you'll want `tuple[int, ...]`, which means "a tuple of arbitrary (possibly 0) length, in which all elements are of type `int`". * Y011 now ignores `sentinel` and `_typeshed.sentinel` in default values. * Y011/Y014/Y015: Allow math constants math.inf, math.nan, math.e, OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=21
2023-12-05 21:09:18 +00:00
BuildRequires: %{python_module hatch_vcs}
- Add set-tests-python-path.patch to fix tests inside osc build environment, running the flake8 process with shell=True and forcing the PYTHONPATH. - Update to 23.1.2: * Y011/Y014/Y015: Increase the maximum character length of literal numbers in default values from 7 to 10, allowing hexadecimal representation of 32-bit integers. Contributed by Avasam. - 23.1.1 New error codes: * Y052: Disallow default values in global or class namespaces where the assignment does not have a type annotation. Stubs should be explicit about the type of all variables in the stub; without type annotations, the type checker is forced to make inferences, which may have unpredictable consequences. Enum members are excluded from this check, as are various special assignments such as __all__ and __match_args__. Other changes: * Disallow numeric default values where len(str(default)) > 7. If a function has a default value where the string representation is greater than 7 characters, it is likely to be an implementation detail or a constant that varies depending on the system you're running on, such as sys.maxsize. * Disallow str or bytes defaults where the default is >50 characters long, for similar reasons. * Allow ast.Attribute nodes as default values for a small number of special cases, such as sys.maxsize and sys.executable. * Fewer Y020 false positives are now emitted when encountering default values in stub files. - 23.1.0 Bugfixes: OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=17
2023-03-06 15:56:20 +00:00
BuildRequires: %{python_module hatchling}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module wheel}
BuildRequires: python-rpm-macros
# SECTION test requirements
BuildRequires: %{python_module attrs}
2023-08-25 18:47:40 +00:00
BuildRequires: %{python_module flake8 >= 6.0.0}
BuildRequires: %{python_module pyflakes >= 2.1.1}
# Use pytest directly to bypass setup.py test dependencies
BuildRequires: %{python_module pytest}
- Add set-tests-python-path.patch to fix tests inside osc build environment, running the flake8 process with shell=True and forcing the PYTHONPATH. - Update to 23.1.2: * Y011/Y014/Y015: Increase the maximum character length of literal numbers in default values from 7 to 10, allowing hexadecimal representation of 32-bit integers. Contributed by Avasam. - 23.1.1 New error codes: * Y052: Disallow default values in global or class namespaces where the assignment does not have a type annotation. Stubs should be explicit about the type of all variables in the stub; without type annotations, the type checker is forced to make inferences, which may have unpredictable consequences. Enum members are excluded from this check, as are various special assignments such as __all__ and __match_args__. Other changes: * Disallow numeric default values where len(str(default)) > 7. If a function has a default value where the string representation is greater than 7 characters, it is likely to be an implementation detail or a constant that varies depending on the system you're running on, such as sys.maxsize. * Disallow str or bytes defaults where the default is >50 characters long, for similar reasons. * Allow ast.Attribute nodes as default values for a small number of special cases, such as sys.maxsize and sys.executable. * Fewer Y020 false positives are now emitted when encountering default values in stub files. - 23.1.0 Bugfixes: OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=17
2023-03-06 15:56:20 +00:00
BuildRequires: %{python_module black}
BuildRequires: %{python_module flake8-bugbear}
- update to 23.11.0: * Y058: Use `Iterator` rather than `Generator` as the return value for simple `__iter__` methods, and `AsyncIterator` rather than `AsyncGenerator` as the return value for simple `__aiter__` methods. * Y059: `Generic[]` should always be the last base class, if it is present in the bases of a class. * Y060, which flags redundant inheritance from `Generic[]`. * Y061: Do not use `None` inside a `Literal[]` slice. * For example, use `Literal["foo"] | None` instead of `Literal["foo", None]`. * Y022 and Y037 now flag more imports from `typing_extensions`. * Y034 now attempts to avoid flagging methods inside classes that inherit from `builtins.type`, `abc.ABCMeta` and/or `enum.EnumMeta`. Classes that have one or more of these as bases are metaclasses, and PEP 673 forbids the use of `typing(_extensions).Self` for metaclasses. * Attempting to import `typing_extensions.Text` now causes Y039 to be emitted rather than Y023. * Y053 will no longer be emitted for the argument to `@typing_extensions.deprecated`. * Introduce Y090, which warns if you have an annotation such as `tuple[int]` or `Tuple[int]`. These mean "a tuple of length 1, in which the sole element is of type `int`". This is sometimes what you want, but more usually you'll want `tuple[int, ...]`, which means "a tuple of arbitrary (possibly 0) length, in which all elements are of type `int`". * Y011 now ignores `sentinel` and `_typeshed.sentinel` in default values. * Y011/Y014/Y015: Allow math constants math.inf, math.nan, math.e, OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=21
2023-12-05 21:09:18 +00:00
BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module typing}
# /SECTION
BuildRequires: fdupes
Requires: python-attrs
2023-08-25 18:47:40 +00:00
Requires: python-base >= 3.8.0
Requires: python-flake8 >= 6.0.0
Requires: python-pyflakes >= 2.1.1
Requires: python-typing
BuildArch: noarch
%python_subpackages
%description
A plugin for Flake8 that provides specializations for type hinting stub
files. Especially interesting for linting typeshed.
%prep
- Add set-tests-python-path.patch to fix tests inside osc build environment, running the flake8 process with shell=True and forcing the PYTHONPATH. - Update to 23.1.2: * Y011/Y014/Y015: Increase the maximum character length of literal numbers in default values from 7 to 10, allowing hexadecimal representation of 32-bit integers. Contributed by Avasam. - 23.1.1 New error codes: * Y052: Disallow default values in global or class namespaces where the assignment does not have a type annotation. Stubs should be explicit about the type of all variables in the stub; without type annotations, the type checker is forced to make inferences, which may have unpredictable consequences. Enum members are excluded from this check, as are various special assignments such as __all__ and __match_args__. Other changes: * Disallow numeric default values where len(str(default)) > 7. If a function has a default value where the string representation is greater than 7 characters, it is likely to be an implementation detail or a constant that varies depending on the system you're running on, such as sys.maxsize. * Disallow str or bytes defaults where the default is >50 characters long, for similar reasons. * Allow ast.Attribute nodes as default values for a small number of special cases, such as sys.maxsize and sys.executable. * Fewer Y020 false positives are now emitted when encountering default values in stub files. - 23.1.0 Bugfixes: OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=17
2023-03-06 15:56:20 +00:00
%autosetup -p1 -n flake8_pyi-%{version}
sed -i '1{\,^#!%{_bindir}/env python,d}' pyi.py
%build
- Add set-tests-python-path.patch to fix tests inside osc build environment, running the flake8 process with shell=True and forcing the PYTHONPATH. - Update to 23.1.2: * Y011/Y014/Y015: Increase the maximum character length of literal numbers in default values from 7 to 10, allowing hexadecimal representation of 32-bit integers. Contributed by Avasam. - 23.1.1 New error codes: * Y052: Disallow default values in global or class namespaces where the assignment does not have a type annotation. Stubs should be explicit about the type of all variables in the stub; without type annotations, the type checker is forced to make inferences, which may have unpredictable consequences. Enum members are excluded from this check, as are various special assignments such as __all__ and __match_args__. Other changes: * Disallow numeric default values where len(str(default)) > 7. If a function has a default value where the string representation is greater than 7 characters, it is likely to be an implementation detail or a constant that varies depending on the system you're running on, such as sys.maxsize. * Disallow str or bytes defaults where the default is >50 characters long, for similar reasons. * Allow ast.Attribute nodes as default values for a small number of special cases, such as sys.maxsize and sys.executable. * Fewer Y020 false positives are now emitted when encountering default values in stub files. - 23.1.0 Bugfixes: OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=17
2023-03-06 15:56:20 +00:00
%pyproject_wheel
%install
- Add set-tests-python-path.patch to fix tests inside osc build environment, running the flake8 process with shell=True and forcing the PYTHONPATH. - Update to 23.1.2: * Y011/Y014/Y015: Increase the maximum character length of literal numbers in default values from 7 to 10, allowing hexadecimal representation of 32-bit integers. Contributed by Avasam. - 23.1.1 New error codes: * Y052: Disallow default values in global or class namespaces where the assignment does not have a type annotation. Stubs should be explicit about the type of all variables in the stub; without type annotations, the type checker is forced to make inferences, which may have unpredictable consequences. Enum members are excluded from this check, as are various special assignments such as __all__ and __match_args__. Other changes: * Disallow numeric default values where len(str(default)) > 7. If a function has a default value where the string representation is greater than 7 characters, it is likely to be an implementation detail or a constant that varies depending on the system you're running on, such as sys.maxsize. * Disallow str or bytes defaults where the default is >50 characters long, for similar reasons. * Allow ast.Attribute nodes as default values for a small number of special cases, such as sys.maxsize and sys.executable. * Fewer Y020 false positives are now emitted when encountering default values in stub files. - 23.1.0 Bugfixes: OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=17
2023-03-06 15:56:20 +00:00
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%pytest -v tests
%files %{python_files}
%license LICENSE
- Remove LICENSE source, it's now in the release - Remove python_module macro definition - Update to 22.10.0: # Bugfixes: - Do not emit Y020 for empty strings. Y020 concerns "quoted annotations", - but an empty string can never be a quoted annotation. - Add special-casing so that Y020 is not emitted for __slots__ definitions - inside class blocks. - Expand Y035 to cover __slots__ definitions as well as __match_args__ and - __all__ definitions. - Expand Y015 so that errors are emitted for assignments to negative numbers. # Other changes: - Since v22.8.1, flake8-pyi has emitted a FutureWarning if run with flake8<5, warning that the plugin would soon become incompatible with flake8<5. Due to some issues that mean that some users are unable to upgrade to flake8>=5, however, flake8-pyi no longer intends to remove support for running the plugin with flake8<5 before Python 3.7 has reached end-of-life. As such, the FutureWarning is no longer emitted. - 22.8.2: # New error codes: - Y047: Detect unused TypeAlias declarations. - Y049: Detect unused TypedDict definitions. - Y050: Prefer typing_extensions.Never for argument annotations over typing.NoReturn. - Y051: Detect redundant unions between Literal types and builtin supertypes (e.g. Literal["foo"] | str, or Literal[5] | int). # Other enhancements: - Support mypy_extensions.TypedDict. - 22.8.1: - Add support for flake8 >= 5.0.0. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=13
2022-11-04 15:51:21 +00:00
%doc README.md
%{python_sitelib}/pyi.py*
%{pycache_only %{python_sitelib}/__pycache__/pyi.*.py*}
- Add set-tests-python-path.patch to fix tests inside osc build environment, running the flake8 process with shell=True and forcing the PYTHONPATH. - Update to 23.1.2: * Y011/Y014/Y015: Increase the maximum character length of literal numbers in default values from 7 to 10, allowing hexadecimal representation of 32-bit integers. Contributed by Avasam. - 23.1.1 New error codes: * Y052: Disallow default values in global or class namespaces where the assignment does not have a type annotation. Stubs should be explicit about the type of all variables in the stub; without type annotations, the type checker is forced to make inferences, which may have unpredictable consequences. Enum members are excluded from this check, as are various special assignments such as __all__ and __match_args__. Other changes: * Disallow numeric default values where len(str(default)) > 7. If a function has a default value where the string representation is greater than 7 characters, it is likely to be an implementation detail or a constant that varies depending on the system you're running on, such as sys.maxsize. * Disallow str or bytes defaults where the default is >50 characters long, for similar reasons. * Allow ast.Attribute nodes as default values for a small number of special cases, such as sys.maxsize and sys.executable. * Fewer Y020 false positives are now emitted when encountering default values in stub files. - 23.1.0 Bugfixes: OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=17
2023-03-06 15:56:20 +00:00
%{python_sitelib}/flake8_pyi-%{version}*-info
%changelog