[med-svn] [Git][med-team/python-xopen][master] 4 commits: New upstream version 1.2.1

Nilesh Patra (@nilesh) gitlab at salsa.debian.org
Tue Oct 19 11:24:55 BST 2021



Nilesh Patra pushed to branch master at Debian Med / python-xopen


Commits:
01d726c2 by Nilesh Patra at 2021-10-19T15:45:11+05:30
New upstream version 1.2.1
- - - - -
1435c436 by Nilesh Patra at 2021-10-19T15:45:11+05:30
Update upstream source from tag 'upstream/1.2.1'

Update to upstream version '1.2.1'
with Debian dir d810804a9bbd6fa7e94fe926d07e54f84d89f7b0
- - - - -
134aff3f by Nilesh Patra at 2021-10-19T15:45:58+05:30
Remove patches, marged usptream

- - - - -
2a303c1b by Nilesh Patra at 2021-10-19T15:46:34+05:30
Upload to unstable

- - - - -


8 changed files:

- PKG-INFO
- debian/changelog
- − debian/patches/i386.patch
- − debian/patches/series
- src/xopen.egg-info/PKG-INFO
- src/xopen/__init__.py
- src/xopen/_version.py
- tests/test_xopen.py


Changes:

=====================================
PKG-INFO
=====================================
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: xopen
-Version: 1.2.0
+Version: 1.2.1
 Summary: Open compressed files transparently
 Home-page: https://github.com/pycompression/xopen/
 Author: Marcel Martin et al.


=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+python-xopen (1.2.1-1) unstable; urgency=medium
+
+  * New upstream version 1.2.1
+  * Remove patches, marged usptream
+
+ -- Nilesh Patra <nilesh at debian.org>  Tue, 19 Oct 2021 15:46:02 +0530
+
 python-xopen (1.2.0-2) unstable; urgency=medium
 
   * d/p/i386.patch: Fix FTBFS and debci on 32 bit arches


=====================================
debian/patches/i386.patch deleted
=====================================
@@ -1,30 +0,0 @@
-From: Marcel Martin <marcel.martin at scilifelab.se>
-Date: Thu, 30 Sep 2021 19:03:50 +0200
-Subject: [PATCH] Avoid MemoryError during tests on 32-bit architectures
-
-Thanks to @nileshpatra!
-
-Closes #76
----
- tests/test_xopen.py | 7 +++++--
- 1 file changed, 5 insertions(+), 2 deletions(-)
-
-diff --git a/tests/test_xopen.py b/tests/test_xopen.py
-index 74d45d5..d9da91a 100644
---- a/tests/test_xopen.py
-+++ b/tests/test_xopen.py
-@@ -630,8 +630,11 @@ def test_xopen_falls_back_to_bzip2_open(lacking_pbzip2_permissions):
- 
- def test_open_many_writers(tmp_path, ext):
-     files = []
--    for i in range(1, 61):
--        path = tmp_path / f"{i:03d}.txt.{ext}"
-+    # Because lzma.open allocates a lot of memory,
-+    # open fewer files to avoid MemoryError on 32-bit architectures
-+    n = 21 if ext == ".xz" else 61
-+    for i in range(1, n):
-+        path = tmp_path / f"{i:03d}.txt{ext}"
-         f = xopen(path, "wb", threads=2)
-         f.write(b"hello")
-         files.append(f)
-


=====================================
debian/patches/series deleted
=====================================
@@ -1 +0,0 @@
-i386.patch


=====================================
src/xopen.egg-info/PKG-INFO
=====================================
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: xopen
-Version: 1.2.0
+Version: 1.2.1
 Summary: Open compressed files transparently
 Home-page: https://github.com/pycompression/xopen/
 Author: Marcel Martin et al.


=====================================
src/xopen/__init__.py
=====================================
@@ -732,10 +732,20 @@ def xopen(
         detected_format = _detect_format_from_content(filename)
 
     if detected_format == "gz":
-        return _open_gz(filename, mode, compresslevel, threads)
+        opened_file = _open_gz(filename, mode, compresslevel, threads)
     elif detected_format == "xz":
-        return _open_xz(filename, mode)
+        opened_file = _open_xz(filename, mode)
     elif detected_format == "bz2":
-        return _open_bz2(filename, mode, threads)
+        opened_file = _open_bz2(filename, mode, threads)
     else:
-        return open(filename, mode)
+        opened_file = open(filename, mode)
+
+    # The "write" method for GzipFile is very costly. Lots of python calls are
+    # made. To a lesser extent this is true for LzmaFile and BZ2File. By
+    # putting a buffer in between, the expensive write method is called much
+    # less. The effect is very noticeable when writing small units such as
+    # lines or FASTQ records.
+    if (isinstance(opened_file, (gzip.GzipFile, bz2.BZ2File, lzma.LZMAFile))
+            and "w" in mode):
+        opened_file = io.BufferedWriter(opened_file)  # type: ignore
+    return opened_file


=====================================
src/xopen/_version.py
=====================================
@@ -1,5 +1,5 @@
 # coding: utf-8
 # file generated by setuptools_scm
 # don't change, don't track in version control
-version = '1.2.0'
-version_tuple = (1, 2, 0)
+version = '1.2.1'
+version_tuple = (1, 2, 1)


=====================================
tests/test_xopen.py
=====================================
@@ -532,14 +532,16 @@ def test_write_no_threads(tmpdir, ext):
     klass = klasses[ext]
     path = str(tmpdir.join(f"out.{ext}"))
     with xopen(path, "wb", threads=0) as f:
-        assert isinstance(f, klass), f
+        assert isinstance(f, io.BufferedWriter)
+        if ext:
+            assert isinstance(f.raw, klass), f
 
 
 def test_write_gzip_no_threads_no_isal(tmpdir, xopen_without_igzip):
     import gzip
     path = str(tmpdir.join("out.gz"))
     with xopen_without_igzip(path, "wb", threads=0) as f:
-        assert isinstance(f, gzip.GzipFile), f
+        assert isinstance(f.raw, gzip.GzipFile), f
 
 
 def test_write_stdout():
@@ -630,8 +632,11 @@ def test_xopen_falls_back_to_bzip2_open(lacking_pbzip2_permissions):
 
 def test_open_many_writers(tmp_path, ext):
     files = []
-    for i in range(1, 61):
-        path = tmp_path / f"{i:03d}.txt.{ext}"
+    # Because lzma.open allocates a lot of memory,
+    # open fewer files to avoid MemoryError on 32-bit architectures
+    n = 21 if ext == ".xz" else 61
+    for i in range(1, n):
+        path = tmp_path / f"{i:03d}.txt{ext}"
         f = xopen(path, "wb", threads=2)
         f.write(b"hello")
         files.append(f)



View it on GitLab: https://salsa.debian.org/med-team/python-xopen/-/compare/c94b8d4d9aad47675bab79d15dbb1d58a50bdf5b...2a303c1b5f926c2bcf3a84b41e00dc0b5aa7d853

-- 
View it on GitLab: https://salsa.debian.org/med-team/python-xopen/-/compare/c94b8d4d9aad47675bab79d15dbb1d58a50bdf5b...2a303c1b5f926c2bcf3a84b41e00dc0b5aa7d853
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/20211019/1e8de832/attachment-0001.htm>


More information about the debian-med-commit mailing list