[med-svn] [Git][python-team/packages/python-pynndescent][master] 5 commits: Refresh patches with gbp pq

Benjamin Drung (@bdrung) gitlab at salsa.debian.org
Sat Jun 1 00:07:41 BST 2024



Benjamin Drung pushed to branch master at Debian Python Team / packages / python-pynndescent


Commits:
7cfd65e3 by Benjamin Drung at 2024-06-01T00:21:14+02:00
Refresh patches with gbp pq

```
gbp pq import
gbp pq export
```

- - - - -
13dc6540 by Benjamin Drung at 2024-06-01T00:22:09+02:00
Run wrap-and-sort

- - - - -
cc0cbe0e by Benjamin Drung at 2024-06-01T00:27:54+02:00
test: load pynndescent_bug_np.npz from relative path

The test `test_bad_data` will fail to load the test data
`pynndescent_bug_np.npz` in case the current directory is not the
repositories root directory.

Load the `pynndescent_bug_np.npz` test data relative from the test file
to not rely on the current directory.

Forwarded: https://github.com/lmcinnes/pynndescent/pull/243
Signed-off-by: Benjamin Drung <benjamin.drung at canonical.com>

- - - - -
6278140b by Benjamin Drung at 2024-06-01T00:37:10+02:00
Hard-code __version__ during build

Running the test during package build fails because pynndescent is not
installed yet:

```
dh_auto_test -- --system=custom --test-args="PYTHONPATH={build_dir} {interpreter} -m pytest -v /<<PKGBUILDDIR>>/pynndescent/tests"
I: pybuild base:311: PYTHONPATH=/<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_pynndescent/build python3.12 -m pytest -v /<<PKGBUILDDIR>>/pynndescent/tests
ImportError while loading conftest '/<<PKGBUILDDIR>>/pynndescent/tests/conftest.py'.
pynndescent/__init__.py:22: in <module>
    __version__ = importlib_metadata.version("pynndescent")
E   importlib.metadata.PackageNotFoundError: No package metadata was found for pynndescent
```

So just hard-code `__version__` during build

- - - - -
1f3919a4 by Benjamin Drung at 2024-06-01T00:37:39+02:00
Release python-pynndescent 0.5.11-1

Signed-off-by: Benjamin Drung <benjamin.drung at canonical.com>

- - - - -


7 changed files:

- debian/changelog
- debian/control
- debian/patches/arm.patch
- debian/patches/series
- + debian/patches/test-load-pynndescent_bug_np.npz-from-relative-path.patch
- debian/rules
- debian/tests/control


Changes:

=====================================
debian/changelog
=====================================
@@ -1,10 +1,15 @@
-python-pynndescent (0.5.11-1) UNRELEASED; urgency=medium
+python-pynndescent (0.5.11-1) unstable; urgency=medium
 
-  * New upstream version
+  [ Andreas Tille ]
+  * Team upload.
+  * New upstream version (Closes: #1057598)
   * Build-Depends: s/dh-python/dh-sequence-python3/ (routine-update)
-  TODO: bug #1057598  FTBFS: ImportError: Numba could not be imported.
 
- -- Andreas Tille <tille at debian.org>  Thu, 14 Dec 2023 11:10:56 +0100
+  [ Benjamin Drung ]
+  * test: load pynndescent_bug_np.npz from relative path
+  * Hard-code __version__ during build to fix running test during build
+
+ -- Benjamin Drung <bdrung at debian.org>  Sat, 01 Jun 2024 00:37:17 +0200
 
 python-pynndescent (0.5.8-2) unstable; urgency=medium
 


=====================================
debian/control
=====================================
@@ -5,14 +5,14 @@ Section: python
 Priority: optional
 Build-Depends: debhelper-compat (= 13),
                dh-sequence-python3,
-               python3-setuptools,
                python3-all,
                python3-joblib <!nocheck>,
                python3-llvmlite <!nocheck>,
                python3-numba <!nocheck>,
+               python3-pytest <!nocheck>,
                python3-scipy <!nocheck>,
-               python3-sklearn <!nocheck>,
-               python3-pytest <!nocheck>
+               python3-setuptools,
+               python3-sklearn <!nocheck>
 Standards-Version: 4.6.2
 Vcs-Browser: https://salsa.debian.org/python-team/packages/python-pynndescent
 Vcs-Git: https://salsa.debian.org/python-team/packages/python-pynndescent.git
@@ -20,9 +20,8 @@ Homepage: https://github.com/lmcinnes/pynndescent/
 Rules-Requires-Root: no
 
 Package: python3-pynndescent
-Architecture: any-amd64 arm64 mips64el ppc64el s390x ia64 ppc64 riscv64 sparc64 alpha
-Depends: ${python3:Depends},
-         ${misc:Depends}
+Architecture: any-amd64 alpha arm64 ia64 mips64el ppc64 ppc64el riscv64 s390x sparc64
+Depends: ${misc:Depends}, ${python3:Depends}
 Description: nearest neighbor descent for approximate nearest neighbors
  PyNNDescent is a Python nearest neighbor descent for approximate nearest
  neighbors. It provides a Python implementation of Nearest Neighbor


=====================================
debian/patches/arm.patch
=====================================
@@ -1,9 +1,18 @@
-Description: Some tests fail on arm, skip.
-Author: Nilesh Patra <nilesh at debian.org>
-Last-Update: 2023-02-12
+From: Nilesh Patra <nilesh at debian.org>
+Date: Sun, 12 Feb 2023 01:31:00 +0530
+Subject: Some tests fail on arm, skip.
+
+---
+ pynndescent/tests/test_distances.py    | 10 ++++++++++
+ pynndescent/tests/test_pynndescent_.py |  4 ++++
+ pynndescent/tests/test_rank.py         |  4 ++++
+ 3 files changed, 18 insertions(+)
+
+diff --git a/pynndescent/tests/test_distances.py b/pynndescent/tests/test_distances.py
+index 83898a1..d366446 100644
 --- a/pynndescent/tests/test_distances.py
 +++ b/pynndescent/tests/test_distances.py
-@@ -9,6 +9,7 @@ from scipy.version import full_version a
+@@ -9,6 +9,7 @@ from scipy.version import full_version as scipy_full_version
  from sklearn.metrics import pairwise_distances
  from sklearn.neighbors import BallTree
  from sklearn.preprocessing import normalize
@@ -11,7 +20,7 @@ Last-Update: 2023-02-12
  
  
  @pytest.mark.parametrize(
-@@ -106,6 +107,9 @@ def test_binary_check(binary_data, metri
+@@ -106,6 +107,9 @@ def test_binary_check(binary_data, metric):
      ],
  )
  def test_sparse_spatial_check(sparse_spatial_data, metric, decimal=6):
@@ -41,9 +50,11 @@ Last-Update: 2023-02-12
      test_data = np.random.random(size=(10, 100))
      # sparsify
      test_data[test_data <= 0.5] = 0.0
+diff --git a/pynndescent/tests/test_pynndescent_.py b/pynndescent/tests/test_pynndescent_.py
+index b36fded..6be146b 100644
 --- a/pynndescent/tests/test_pynndescent_.py
 +++ b/pynndescent/tests/test_pynndescent_.py
-@@ -11,9 +11,13 @@ from sklearn.preprocessing import normal
+@@ -11,9 +11,13 @@ from sklearn.preprocessing import normalize
  import pickle
  import joblib
  import scipy
@@ -57,6 +68,8 @@ Last-Update: 2023-02-12
  
  def test_nn_descent_neighbor_accuracy(nn_data, seed):
      knn_indices, _ = NNDescent(
+diff --git a/pynndescent/tests/test_rank.py b/pynndescent/tests/test_rank.py
+index e75d96a..6e89798 100644
 --- a/pynndescent/tests/test_rank.py
 +++ b/pynndescent/tests/test_rank.py
 @@ -1,9 +1,13 @@


=====================================
debian/patches/series
=====================================
@@ -1 +1,2 @@
 arm.patch
+test-load-pynndescent_bug_np.npz-from-relative-path.patch


=====================================
debian/patches/test-load-pynndescent_bug_np.npz-from-relative-path.patch
=====================================
@@ -0,0 +1,37 @@
+From: Benjamin Drung <benjamin.drung at canonical.com>
+Date: Sat, 1 Jun 2024 00:12:56 +0200
+Subject: test: load pynndescent_bug_np.npz from relative path
+
+The test `test_bad_data` will fail to load the test data
+`pynndescent_bug_np.npz` in case the current directory is not the
+repositories root directory.
+
+Load the `pynndescent_bug_np.npz` test data relative from the test file
+to not rely on the current directory.
+
+Forwarded: https://github.com/lmcinnes/pynndescent/pull/243
+Signed-off-by: Benjamin Drung <benjamin.drung at canonical.com>
+---
+ pynndescent/tests/test_pynndescent_.py | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/pynndescent/tests/test_pynndescent_.py b/pynndescent/tests/test_pynndescent_.py
+index 6be146b..cc59d14 100644
+--- a/pynndescent/tests/test_pynndescent_.py
++++ b/pynndescent/tests/test_pynndescent_.py
+@@ -1,6 +1,7 @@
+ import os
+ import io
+ import re
++import pathlib
+ import pytest
+ from contextlib import redirect_stdout
+ 
+@@ -688,5 +689,6 @@ def test_tree_no_split(small_data, sparse_small_data, metric):
+ 
+ @pytest.mark.skipif('NUMBA_DISABLE_JIT' in os.environ, reason="Too expensive for disabled Numba")
+ def test_bad_data():
+-    data = np.sqrt(np.load("pynndescent/tests/test_data/pynndescent_bug_np.npz")['arr_0'])
++    test_data_dir = pathlib.Path(__file__).parent / "test_data"
++    data = np.sqrt(np.load(test_data_dir / "pynndescent_bug_np.npz")['arr_0'])
+     index = NNDescent(data, metric="cosine")


=====================================
debian/rules
=====================================
@@ -1,11 +1,18 @@
 #!/usr/bin/make -f
 
+include /usr/share/dpkg/pkg-info.mk
+
 export PYBUILD_NAME=pynndescent
 export PYTHONPATH=$(CURDIR)
 
 %:
 	dh $@ --buildsystem=pybuild
 
+# Avoid chicken-egg problem with importlib.metadata.version()
+override_dh_auto_build:
+	sed -i "s/^__version__.*/__version__ = '$(DEB_VERSION_UPSTREAM)'/" pynndescent/__init__.py
+	dh_auto_build
+
 override_dh_auto_test:
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
 	dh_auto_test -- --system=custom --test-args="PYTHONPATH={build_dir} {interpreter} -m pytest -v $(CURDIR)/pynndescent/tests"


=====================================
debian/tests/control
=====================================
@@ -1,4 +1,4 @@
 Tests: run-unit-test
-Depends: @, python3-pytest, python3-all
+Depends: python3-all, python3-pytest, @
 Restrictions: allow-stderr
-Architecture: amd64 arm64 mips64el ppc64el s390x ia64 ppc64 riscv64 sparc64 alpha
+Architecture: alpha amd64 arm64 ia64 mips64el ppc64 ppc64el riscv64 s390x sparc64



View it on GitLab: https://salsa.debian.org/python-team/packages/python-pynndescent/-/compare/b972a7f420e3ebcc0186eabd61dd5b4461183b63...1f3919a49f59e210154317c180b27ed67e7eac1d

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://salsa.debian.org/python-team/packages/python-pynndescent/-/compare/b972a7f420e3ebcc0186eabd61dd5b4461183b63...1f3919a49f59e210154317c180b27ed67e7eac1d
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20240531/70bd60ad/attachment-0001.htm>


More information about the debian-med-commit mailing list