[med-svn] [Git][med-team/python-pbcore][master] 3 commits: numpy2.patch: new: workaround overflow errors with numpy 2.
Étienne Mollier (@emollier)
gitlab at salsa.debian.org
Thu Feb 27 21:39:29 GMT 2025
Étienne Mollier pushed to branch master at Debian Med / python-pbcore
Commits:
25bde02c by Étienne Mollier at 2025-02-27T22:36:43+01:00
numpy2.patch: new: workaround overflow errors with numpy 2.
Closes: #1095090
- - - - -
c7d89545 by Étienne Mollier at 2025-02-27T22:38:15+01:00
d/control: declare compliance to standards version 4.7.2.
- - - - -
4c62488f by Étienne Mollier at 2025-02-27T22:39:02+01:00
d/changelog: ready for upload to unstable.
- - - - -
4 changed files:
- debian/changelog
- debian/control
- + debian/patches/numpy2.patch
- debian/patches/series
Changes:
=====================================
debian/changelog
=====================================
@@ -1,5 +1,6 @@
-python-pbcore (2.1.2+dfsg-11) UNRELEASED; urgency=medium
+python-pbcore (2.1.2+dfsg-11) unstable; urgency=medium
+ [ Andreas Tille ]
* d/p/remove-pkg-resources.patch: replace the usages of pkg_resources
with importlib.resources for Python 3.13 compatibility (Thanks for the
patch to Vladimir Petko)
@@ -8,7 +9,12 @@ python-pbcore (2.1.2+dfsg-11) UNRELEASED; urgency=medium
* Make the build reproducible (Thanks for the patch to Chris Lamb)
Closes: #1089095
- -- Andreas Tille <tille at debian.org> Sun, 16 Feb 2025 15:01:30 +0100
+ [ Étienne Mollier ]
+ * numpy2.patch: new: workaround overflow errors with numpy 2.
+ (Closes: #1095090)
+ * d/control: declare compliance to standards version 4.7.2.
+
+ -- Étienne Mollier <emollier at debian.org> Thu, 27 Feb 2025 22:38:34 +0100
python-pbcore (2.1.2+dfsg-10) unstable; urgency=medium
=====================================
debian/control
=====================================
@@ -23,7 +23,7 @@ Build-Depends: debhelper-compat (= 13),
python3-xmlschema <!nocheck>,
pylint,
python3-coverage
-Standards-Version: 4.7.0
+Standards-Version: 4.7.2
Vcs-Browser: https://salsa.debian.org/med-team/python-pbcore
Vcs-Git: https://salsa.debian.org/med-team/python-pbcore.git
Homepage: https://github.com/PacificBiosciences/pbcore
=====================================
debian/patches/numpy2.patch
=====================================
@@ -0,0 +1,66 @@
+Description: workaround overflow errors with numpy 2.
+ These changes fix various overflow errors caught since numpy 2 by
+ restoring the former behavior by emulating the situation when overflows
+ weren't trapped. The -1 error code in unsigned types is handled by
+ setting the value to the maximum unsigned integer instead, and large
+ index values not fitting in 32-bit are guarded with modulo operation.
+ .
+ The change also includes a slight modification to account for weirder
+ base 16 numbers caught by end user upstream, resolving the following
+ error:
+ .
+ File "/home/shuaiw/miniconda3/envs/methy2/lib/python3.11/site-packages/pbcore/io/align/BamIO.py", line 218, in __init__
+ self._loadReadGroupInfo()
+ File "/home/shuaiw/miniconda3/envs/methy2/lib/python3.11/site-packages/pbcore/io/align/BamIO.py", line 89, in _loadReadGroupInfo
+ rgID = rgAsInt(rg["ID"])
+ ^^^^^^^^^^^^^^^^^
+ File "/home/shuaiw/miniconda3/envs/methy2/lib/python3.11/site-packages/pbcore/io/align/_BamSupport.py", line 70, in rgAsInt
+ return np.int32(int(rgIdString.split("/")[0], 16))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ ValueError: invalid literal for int() with base 16: 'cb4d472d-100C60F6'
+ .
+ I'm reluctant to formally send that patch upstream, as it feels like a
+ workaround where the right answer would probably be to bump the type
+ sizes to 64-bit. However, I do not know what is the actually correct
+ approach.
+Author: Étienne Mollier <emollier at debian.org>
+Bug: https://github.com/PacificBiosciences/pbcore/issues/127
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1095090
+Last-Update: 2025-02-27
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- python-pbcore.orig/pbcore/io/align/BamAlignment.py
++++ python-pbcore/pbcore/io/align/BamAlignment.py
+@@ -532,7 +532,11 @@
+ if data.dtype == np.int8:
+ gapCode = ord("-")
+ else:
+- gapCode = data.dtype.type(-1)
++ try:
++ gapCode = data.dtype.type(-1)
++ except OverflowError:
++ # Hack: accomodate for unsigned types with numpy 2+.
++ gapCode = data.dtype.type(np.iinfo(data.dtype).max)
+ uc = self.unrolledCigar(orientation=orientation)
+ alnData = np.repeat(np.array(gapCode, dtype=data.dtype), len(uc))
+ gapMask = (uc == gapOp)
+--- python-pbcore.orig/pbcore/io/align/_BamSupport.py
++++ python-pbcore/pbcore/io/align/_BamSupport.py
+@@ -1,6 +1,7 @@
+ # Author: David Alexander
+
+ import numpy as np
++import re
+
+
+ class UnavailableFeature(Exception):
+@@ -63,7 +64,8 @@
+ # qId calculation from RG ID string
+ #
+ def rgAsInt(rgIdString):
+- return np.int32(int(rgIdString.split("/")[0], 16))
++ return np.int32(int(re.sub("-", "", rgIdString.split("/")[0]), 16)
++ % (np.iinfo(np.int32).max+1))
+
+ #
+ # Kinetics: decode the scheme we are using to encode approximate frame
=====================================
debian/patches/series
=====================================
@@ -5,3 +5,4 @@ seek-curdir-for-xml.patch
numpy_1.24.patch
no-intersphinx.patch
remove-pkg-resources.patch
+numpy2.patch
View it on GitLab: https://salsa.debian.org/med-team/python-pbcore/-/compare/43041cd9372dc0624ef0be241a30529366700c23...4c62488f41f536f3548e69535fe3029744e72472
--
View it on GitLab: https://salsa.debian.org/med-team/python-pbcore/-/compare/43041cd9372dc0624ef0be241a30529366700c23...4c62488f41f536f3548e69535fe3029744e72472
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/20250227/2e13e3b7/attachment-0001.htm>
More information about the debian-med-commit
mailing list