Skip to content

Commit

Permalink
Update python-nptyping to version 2.5.0 / rev 4 via SR 1147711
Browse files Browse the repository at this point in the history
https://build.opensuse.org/request/show/1147711
by user mcepl + anag+factory
- Did the upstream just released different tarball with the same
  version number? Yes, they did!
- Rebased patches
- Update to 2.5.0
  * Added the column wildcard in structure expressions to allow
    expressing 'a structure with at least ...'.
  * Fixed the help text for functions that use nptyping types as
    hints.
  * Fixed the distribution of dataframe.pyi that was missing.
  * Fixed the sdist to include tests and dependencies.
- Fix the test suite.
  * The -k parameter for unittests does not know negative patterns
  * Don't test with beartype and typeguard:
    gh#ramonhagenaars/nptyping#115
  * Drop skip-pyright-tests.patch, delete file instead
  * Drop skip_pandas.patch.
  • Loading branch information
mcepl authored and bmwiedemann committed Feb 20, 2024
1 parent f1e1867 commit 3415c08
Show file tree
Hide file tree
Showing 9 changed files with 134 additions and 101 deletions.
Binary file modified .files
Binary file not shown.
24 changes: 24 additions & 0 deletions .rev
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,28 @@
</comment>
<requestid>1041858</requestid>
</revision>
<revision rev="4" vrev="1">
<srcmd5>d314ae55cb7bc7e026f09e876ef4eb1b</srcmd5>
<version>2.5.0</version>
<time>1708460100</time>
<user>anag+factory</user>
<comment>- Did the upstream just released different tarball with the same
version number? Yes, they did!
- Rebased patches
- Update to 2.5.0
* Added the column wildcard in structure expressions to allow
expressing 'a structure with at least ...'.
* Fixed the help text for functions that use nptyping types as
hints.
* Fixed the distribution of dataframe.pyi that was missing.
* Fixed the sdist to include tests and dependencies.
- Fix the test suite.
* The -k parameter for unittests does not know negative patterns
* Don't test with beartype and typeguard:
gh#ramonhagenaars/nptyping#115
* Drop skip-pyright-tests.patch, delete file instead
* Drop skip_pandas.patch.
</comment>
<requestid>1147711</requestid>
</revision>
</revisionlist>
1 change: 0 additions & 1 deletion nptyping-2.4.1.tar.gz

This file was deleted.

1 change: 1 addition & 0 deletions nptyping-2.5.0.tar.gz
24 changes: 24 additions & 0 deletions python-nptyping.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
-------------------------------------------------------------------
Tue Feb 20 08:10:28 UTC 2024 - Matej Cepl <[email protected]>

- Did the upstream just released different tarball with the same
version number? Yes, they did!
- Rebased patches

-------------------------------------------------------------------
Fri Feb 16 12:21:58 UTC 2024 - Ben Greiner <[email protected]>

- Update to 2.5.0
* Added the column wildcard in structure expressions to allow
expressing 'a structure with at least ...'.
* Fixed the help text for functions that use nptyping types as
hints.
* Fixed the distribution of dataframe.pyi that was missing.
* Fixed the sdist to include tests and dependencies.
- Fix the test suite.
* The -k parameter for unittests does not know negative patterns
* Don't test with beartype and typeguard:
gh#ramonhagenaars/nptyping#115
* Drop skip-pyright-tests.patch, delete file instead
* Drop skip_pandas.patch.

-------------------------------------------------------------------
Fri Dec 9 11:44:19 UTC 2022 - Daniel Garcia <[email protected]>

Expand Down
50 changes: 30 additions & 20 deletions python-nptyping.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# spec file for package python-nptyping
#
# Copyright (c) 2022 SUSE LLC
# 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
Expand All @@ -16,40 +16,45 @@
#


%define modname nptyping
# pyright is a nodejs package and nobody dares to package it for openSUSE
%bcond_with pyright
# beartype and typeguard: https://github.com/ramonhagenaars/nptyping/issues/115
%bcond_with beartype
%bcond_with typeguard
# mypy tests expect pandas_stubs, which are not in the distribution
%bcond_with pandas_stubs
Name: python-nptyping
Version: 2.4.1
Version: 2.5.0
Release: 0
Summary: Type hints for NumPy
License: MIT
URL: https://github.com/ramonhagenaars/nptyping
Source: https://github.com/ramonhagenaars/%{modname}/archive/refs/tags/v%{version}.tar.gz#/%{modname}-%{version}.tar.gz
# PATCH-FIX-OPENSUSE use_system_packages.patch gh#ramonhagenaars/nptyping#72 [email protected]
# Don't need to build the wheel a second time, when creating venv for install check, allow use of system packages
Patch0: use_system_packages.patch
Source: https://files.pythonhosted.org/packages/source/n/nptyping/nptyping-%{version}.tar.gz
# PATCH-FIX-UPSTREAM skip_on_other_archs.patch gh#ramonhagenaars/nptyping#73 [email protected]
# test_instance_check_performance doesn't seem to work well on some architectures
Patch1: skip_on_other_archs.patch
# PATCH-FIX-OPENSUSE skip-pyright-tests.patch [email protected] -- pyright is a nodejs package and nobody dares to package it for openSUSE
Patch2: skip-pyright-tests.patch
Patch0: skip_on_other_archs.patch
# PATCH-FIX-OPENSUSE use_system_packages.patch gh#ramonhagenaars/nptyping#72 [email protected]
# Don't need to build the wheel a second time, when creating venv for install check, allow use of system packages
Patch1: use_system_packages.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: unzip
Requires: python-numpy >= 1.20.0
Requires: (python-numpy >= 1.21.5 with python-numpy < 2)
%if 0%{python_version_nodots} < 310
Requires: python-typing_extensions >= 4.0.0
Requires: (python-typing_extensions >= 4.0.0 with python-typing_extensions < 5)
%endif
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module beartype}
BuildRequires: %{python_module feedparser}
BuildRequires: %{python_module mypy}
BuildRequires: %{python_module numpy >= 1.20.0}
%{?_with_pandas_stubs:BuildRequires: %{python_module mypy}}
%{?_with_beartype:BuildRequires: %{python_module beartype}}
%{?_with_typeguard:BuildRequires: %{python_module typeguard}}
BuildRequires: %{python_module numpy >= 1.20.0 with %python-numpy < 2}
BuildRequires: %{python_module pandas}
BuildRequires: %{python_module typeguard}
BuildRequires: %{python_module typing_extensions < 5 if %python-base < 3.10}
BuildRequires: %{python_module typing_extensions >= 4.0.0 if %python-base < 3.10}
# /SECTION
%python_subpackages
Expand All @@ -60,6 +65,8 @@ Type hints for NumPy.
%prep
%autosetup -p1 -n nptyping-%{version}

sed -i -e 's/\r//g' README.md

%build
%pyproject_wheel

Expand All @@ -71,13 +78,16 @@ Type hints for NumPy.
# wheel in dist/ used by test/test_wheel.py
mkdir -p dist/
cp build/nptyping-%{version}-py3-none-any.whl dist/
# There's no python-pandas-stubs package in Factory yet
%pyunittest -v -k 'not test_mypi'
%{!?_with_pyright:rm tests/test_pyright.py}
%{!?_with_beartype:rm tests/test_beartype.py}
%{!?_with_typeguard:rm tests/test_typeguard.py}
%{!?_with_pandas_stubs:rm tests/test_mypy.py tests/pandas_/test_mypy_dataframe.py tests/pandas_/test_fork_sync.py}
%pyunittest -v

%files %{python_files}
%doc README.md
%license LICENSE
%{python_sitelib}/%{modname}
%{python_sitelib}/%{modname}-%{version}*-info
%{python_sitelib}/nptyping
%{python_sitelib}/nptyping-%{version}.dist-info

%changelog
30 changes: 0 additions & 30 deletions skip-pyright-tests.patch

This file was deleted.

34 changes: 17 additions & 17 deletions skip_on_other_archs.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
--- a/tests/test_performance.py
+++ b/tests/test_performance.py
@@ -1,5 +1,6 @@
from timeit import Timer
-from unittest import TestCase
+import platform
+import unittest

import numpy as np

from timeit import Timer
-from unittest import TestCase
+import platform
+import unittest

import numpy as np

@@ -10,7 +11,9 @@ from nptyping import (
)


-class PerformanceTest(TestCase):
+@unittest.skipIf(platform.machine in ('i586', 'aarch64'),
+ "not supported on this architecture")
+class PerformanceTest(unittest.TestCase):
def test_instance_check_performance(self):

arr = np.random.randn(42, 42, 3, 5)
)


-class PerformanceTest(TestCase):
+@unittest.skipIf(platform.machine in ('i586', 'aarch64'),
+ "not supported on this architecture")
+class PerformanceTest(unittest.TestCase):
def test_instance_check_performance(self):

arr = np.random.randn(42, 42, 3, 5)
71 changes: 38 additions & 33 deletions use_system_packages.patch
Original file line number Diff line number Diff line change
@@ -1,35 +1,40 @@
---
tests/test_wheel.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
tests/test_wheel.py | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)

Index: nptyping-2.2.0/tests/test_wheel.py
===================================================================
--- nptyping-2.2.0.orig/tests/test_wheel.py
+++ nptyping-2.2.0/tests/test_wheel.py
@@ -80,12 +80,8 @@ class WheelTest(TestCase):

def test_wheel_is_built_correctly(self):
with working_dir(_ROOT):
- subprocess.check_output(f"{sys.executable} -m invoke wheel", shell=True)
wheel_files = glob(f"dist/*{__version__}*.whl")
- src_files = glob(f"dist/*{__version__}*.tar.gz")
-
self.assertEqual(1, len(wheel_files))
- self.assertEqual(1, len(src_files))

with ZipFile(_ROOT / Path(wheel_files[0]), "r") as zip_:
files_in_wheel = set(
@@ -98,10 +94,9 @@ class WheelTest(TestCase):

def test_wheel_can_be_installed(self):
with working_dir(Path(self.temp_dir.name)):
- venv.create(_VENV_NAME, with_pip=False)
- # For some reason, with_pip=True fails, so we do it separately.
- subprocess.check_output(
- f"{self.py} -m ensurepip --upgrade --default-pip", shell=True
+ venv.create(_VENV_NAME, system_site_packages=True, with_pip=True)
+ print(
+ f"{self.pip} install {_ROOT / 'dist' / _WHEEL_NAME}"
)
subprocess.check_output(
f"{self.pip} install {_ROOT / 'dist' / _WHEEL_NAME}", shell=True
--- a/tests/test_wheel.py
+++ b/tests/test_wheel.py
@@ -90,12 +90,9 @@ class WheelTest(TestCase):

def test_wheel_is_built_correctly(self):
with working_dir(_ROOT):
- subprocess.check_output(f"{sys.executable} -m invoke wheel", shell=True)
wheel_files = glob(f"dist/*{__version__}*.whl")
- src_files = glob(f"dist/*{__version__}*.tar.gz")

self.assertEqual(1, len(wheel_files))
- self.assertEqual(1, len(src_files))

with ZipFile(_ROOT / Path(wheel_files[0]), "r") as zip_:
files_in_wheel = set(
@@ -108,17 +105,13 @@ class WheelTest(TestCase):

def test_wheel_can_be_installed(self):
with working_dir(Path(self.temp_dir.name)):
- venv.create(_VENV_NAME, with_pip=False)
- # For some reason, with_pip=True fails, so we do it separately.
- subprocess.check_output(
- f"{self.py} -m ensurepip --upgrade --default-pip", shell=True
+ venv.create(_VENV_NAME, system_site_packages=True, with_pip=True)
+ print(
+ f"{self.pip} install {_ROOT / 'dist' / _WHEEL_NAME}"
)
subprocess.check_output(
f"{self.py} -m pip install --upgrade pip", shell=True
)
- subprocess.check_output(
- f"{self.pip} install {_ROOT / 'dist' / _WHEEL_NAME}", shell=True
- )
# No errors raised? Then the install succeeded.

def test_basic_nptyping_code(self):

0 comments on commit 3415c08

Please sign in to comment.