[med-svn] [Git][med-team/python-xopen][upstream] New upstream version 1.1.0

Nilesh Patra gitlab at salsa.debian.org
Sun Jan 24 07:36:10 GMT 2021



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


Commits:
a86084cc by Nilesh Patra at 2021-01-24T13:02:09+05:30
New upstream version 1.1.0
- - - - -


12 changed files:

- + .github/workflows/ci.yml
- − .travis.yml
- PKG-INFO
- README.rst
- setup.py
- src/xopen.egg-info/PKG-INFO
- src/xopen.egg-info/SOURCES.txt
- src/xopen.egg-info/requires.txt
- src/xopen/__init__.py
- src/xopen/_version.py
- tests/test_xopen.py
- tox.ini


Changes:

=====================================
.github/workflows/ci.yml
=====================================
@@ -0,0 +1,86 @@
+name: CI
+
+on: [push, pull_request]
+
+jobs:
+  lint:
+    timeout-minutes: 5
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        python-version: [3.7]
+        toxenv: [flake8, mypy]
+    steps:
+    - uses: actions/checkout at v2
+    - name: Set up Python ${{ matrix.python-version }}
+      uses: actions/setup-python at v2
+      with:
+        python-version: ${{ matrix.python-version }}
+    - name: Install dependencies
+      run: python -m pip install tox
+    - name: Run tox ${{ matrix.toxenv }}
+      run: tox -e ${{ matrix.toxenv }}
+
+  test:
+    timeout-minutes: 5
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os: [ubuntu-latest]
+        python-version: [3.6, 3.7, 3.8, 3.9, pypy3]
+        include:
+        - os: macos-latest
+          python-version: 3.7
+        - os: ubuntu-20.04
+          python-version: 3.7
+          with-isal: true
+    steps:
+    - name: Install pigz
+      run: >
+          if [[ ${{ startsWith(matrix.os, 'macos') }} = true ]]; then
+            brew install pigz;
+          else
+            sudo apt-get install pigz;
+          fi
+    - name: Install isal
+      if: matrix.with-isal && !startsWith(matrix.os, 'macos')
+      run: sudo apt-get install isal libisal-dev
+    - uses: actions/checkout at v2
+    - name: Set up Python ${{ matrix.python-version }}
+      uses: actions/setup-python at v2
+      with:
+        python-version: ${{ matrix.python-version }}
+    - name: Install dependencies
+      run: python -m pip install tox
+    - name: Test
+      run: tox -e py
+      if: matrix.with-isal == null
+    - name: Test with isal
+      run: tox -e isal
+      if: matrix.with-isal
+    - name: Upload coverage report
+      uses: codecov/codecov-action at v1
+
+  deploy:
+    timeout-minutes: 5
+    runs-on: ubuntu-latest
+    needs: [lint, test]
+    if: startsWith(github.ref, 'refs/tags')
+    steps:
+    - uses: actions/checkout at v2
+      with:
+        fetch-depth: 0  # required for setuptools_scm
+    - name: Set up Python
+      uses: actions/setup-python at v2
+      with:
+        python-version: 3.7
+    - name: Make distributions
+      run: |
+        python setup.py sdist
+        python -m pip wheel --no-deps -w dist/ .
+        ls -l dist/
+    - name: Publish to PyPI
+      uses: pypa/gh-action-pypi-publish at v1.4.1
+      with:
+        user: __token__
+        password: ${{ secrets.pypi_password }}


=====================================
.travis.yml deleted
=====================================
@@ -1,67 +0,0 @@
-language: python
-
-dist: focal
-
-cache:
-  directories:
-    - $HOME/.cache/pip
-
-python:
-  - "3.5"
-  - "3.6"
-  - "3.7"
-  - "3.8"
-  - "3.9"
-  - "pypy3"
-
-install:
-  - sudo apt-get update && sudo apt-get install -y pigz
-  - pip install --upgrade coverage codecov
-  - pip install .
-
-script:
-  - python setup.py --version  # Detect encoding problems
-  - coverage run -m pytest
-
-after_success:
-  - coverage combine
-  - codecov
-
-env:
-  global:
-    - TWINE_USERNAME=marcelm
-
-jobs:
-  include:
-    - stage: deploy
-      services:
-        - docker
-      python: "3.6"
-      install: python3 -m pip install twine
-      if: tag IS present
-      script:
-        - |
-          python3 setup.py sdist
-          python3 -m pip wheel -w dist/ .
-          ls -l dist/
-          python3 -m twine upload dist/xopen-*
-
-    - stage: test
-      name: flake8
-      python: "3.6"
-      install: python3 -m pip install flake8
-      script: flake8 src/ tests/
-
-    - stage: test
-      name: mypy
-      python: "3.6"
-      install: python3 -m pip install mypy
-      script: mypy src/
-
-    - stage: test
-      name: igzip
-      python: "3.6"
-      install:
-        - sudo apt-get update && sudo apt-get install -y pigz isal
-        - pip install --upgrade coverage codecov
-        - pip install .


=====================================
PKG-INFO
=====================================
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: xopen
-Version: 1.0.1
+Version: 1.1.0
 Summary: Open compressed files transparently
 Home-page: https://github.com/marcelm/xopen/
 Author: Marcel Martin
@@ -38,12 +38,21 @@ Description: .. image:: https://travis-ci.org/marcelm/xopen.svg?branch=master
         available. For gzip compression levels 1 to 3,
         `igzip <https://github.com/intel/isa-l/>`_ is used for an even greater speedup.
         
+        For use cases where using only the main thread is desired xopen can be used
+        with ``threads=0``. This will use `python-isal
+        <https://github.com/pycompression/python-isal>`_ (which binds isa-l) if
+        python-isal is installed (automatic on Linux systems, as it is a requirement).
+        For installation instructions for python-isal please
+        checkout the `python-isal homepage
+        <https://github.com/pycompression/python-isal>`_. If python-isal is not
+        available ``gzip.open`` is used.
+        
         This module has originally been developed as part of the `Cutadapt
         tool <https://cutadapt.readthedocs.io/>`_ that is used in bioinformatics to
         manipulate sequencing data. It has been in successful use within that software
         for a few years.
         
-        ``xopen`` is compatible with Python versions 3.5 and later.
+        ``xopen`` is compatible with Python versions 3.6 and later.
         
         
         Usage
@@ -94,6 +103,12 @@ Description: .. image:: https://travis-ci.org/marcelm/xopen.svg?branch=master
         
         Changes
         -------
+        v1.1.0
+        ~~~~~~
+        * Python 3.5 support is dropped.
+        * On Linux systems, `python-isal <https://github.com/pycompression/python-isal>`_
+          is now added as a requirement. This will speed up the reading of gzip files
+          significantly when no external processes are used.
         
         v1.0.0
         ~~~~~~
@@ -162,5 +177,5 @@ Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: License :: OSI Approved :: MIT License
 Classifier: Programming Language :: Python :: 3
-Requires-Python: >=3.5
+Requires-Python: >=3.6
 Provides-Extra: dev


=====================================
README.rst
=====================================
@@ -30,12 +30,21 @@ when reading ``.gz`` files, so it is used both for reading and writing if it is
 available. For gzip compression levels 1 to 3,
 `igzip <https://github.com/intel/isa-l/>`_ is used for an even greater speedup.
 
+For use cases where using only the main thread is desired xopen can be used
+with ``threads=0``. This will use `python-isal
+<https://github.com/pycompression/python-isal>`_ (which binds isa-l) if
+python-isal is installed (automatic on Linux systems, as it is a requirement).
+For installation instructions for python-isal please
+checkout the `python-isal homepage
+<https://github.com/pycompression/python-isal>`_. If python-isal is not
+available ``gzip.open`` is used.
+
 This module has originally been developed as part of the `Cutadapt
 tool <https://cutadapt.readthedocs.io/>`_ that is used in bioinformatics to
 manipulate sequencing data. It has been in successful use within that software
 for a few years.
 
-``xopen`` is compatible with Python versions 3.5 and later.
+``xopen`` is compatible with Python versions 3.6 and later.
 
 
 Usage
@@ -86,6 +95,12 @@ If you also want to open S3 files, you may want to use that module instead.
 
 Changes
 -------
+v1.1.0
+~~~~~~
+* Python 3.5 support is dropped.
+* On Linux systems, `python-isal <https://github.com/pycompression/python-isal>`_
+  is now added as a requirement. This will speed up the reading of gzip files
+  significantly when no external processes are used.
 
 v1.0.0
 ~~~~~~


=====================================
setup.py
=====================================
@@ -19,8 +19,9 @@ setup(
     package_data={"xopen": ["py.typed"]},
     extras_require={
         'dev': ['pytest'],
+        ':sys_platform=="linux" and python_implementation != "PyPy"': ['isal>=0.3.0']
     },
-    python_requires='>=3.5',
+    python_requires='>=3.6',
     classifiers=[
         "Development Status :: 5 - Production/Stable",
         "License :: OSI Approved :: MIT License",


=====================================
src/xopen.egg-info/PKG-INFO
=====================================
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: xopen
-Version: 1.0.1
+Version: 1.1.0
 Summary: Open compressed files transparently
 Home-page: https://github.com/marcelm/xopen/
 Author: Marcel Martin
@@ -38,12 +38,21 @@ Description: .. image:: https://travis-ci.org/marcelm/xopen.svg?branch=master
         available. For gzip compression levels 1 to 3,
         `igzip <https://github.com/intel/isa-l/>`_ is used for an even greater speedup.
         
+        For use cases where using only the main thread is desired xopen can be used
+        with ``threads=0``. This will use `python-isal
+        <https://github.com/pycompression/python-isal>`_ (which binds isa-l) if
+        python-isal is installed (automatic on Linux systems, as it is a requirement).
+        For installation instructions for python-isal please
+        checkout the `python-isal homepage
+        <https://github.com/pycompression/python-isal>`_. If python-isal is not
+        available ``gzip.open`` is used.
+        
         This module has originally been developed as part of the `Cutadapt
         tool <https://cutadapt.readthedocs.io/>`_ that is used in bioinformatics to
         manipulate sequencing data. It has been in successful use within that software
         for a few years.
         
-        ``xopen`` is compatible with Python versions 3.5 and later.
+        ``xopen`` is compatible with Python versions 3.6 and later.
         
         
         Usage
@@ -94,6 +103,12 @@ Description: .. image:: https://travis-ci.org/marcelm/xopen.svg?branch=master
         
         Changes
         -------
+        v1.1.0
+        ~~~~~~
+        * Python 3.5 support is dropped.
+        * On Linux systems, `python-isal <https://github.com/pycompression/python-isal>`_
+          is now added as a requirement. This will speed up the reading of gzip files
+          significantly when no external processes are used.
         
         v1.0.0
         ~~~~~~
@@ -162,5 +177,5 @@ Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: License :: OSI Approved :: MIT License
 Classifier: Programming Language :: Python :: 3
-Requires-Python: >=3.5
+Requires-Python: >=3.6
 Provides-Extra: dev


=====================================
src/xopen.egg-info/SOURCES.txt
=====================================
@@ -1,13 +1,13 @@
 .codecov.yml
 .editorconfig
 .gitignore
-.travis.yml
 LICENSE
 README.rst
 pyproject.toml
 setup.cfg
 setup.py
 tox.ini
+.github/workflows/ci.yml
 src/xopen/__init__.py
 src/xopen/_version.py
 src/xopen/_version.pyi


=====================================
src/xopen.egg-info/requires.txt
=====================================
@@ -1,3 +1,6 @@
 
+[:sys_platform=="linux" and python_implementation != "PyPy"]
+isal>=0.3.0
+
 [dev]
 pytest


=====================================
src/xopen/__init__.py
=====================================
@@ -27,6 +27,12 @@ try:
 except ImportError:
     lzma = None  # type: ignore
 
+try:
+    from isal import igzip, isal_zlib  # type: ignore
+except ImportError:
+    igzip = None
+    isal_zlib = None
+
 try:
     import fcntl
     # fcntl.F_SETPIPE_SZ will be available in python 3.10.
@@ -470,31 +476,47 @@ def _open_xz(filename, mode: str) -> IO:
     return lzma.open(filename, mode)
 
 
+def _open_gz_external(filename, mode, compresslevel, threads):
+    if 'r' in mode:
+        try:
+            return PipedIGzipReader(filename, mode)
+        except (OSError, ValueError):
+            # No igzip installed or version does not support reading
+            # concatenated files.
+            return PipedGzipReader(filename, mode, threads=threads)
+    else:
+        try:
+            return PipedIGzipWriter(filename, mode, compresslevel)
+        except (OSError, ValueError):
+            # No igzip installed or compression level higher than 3
+            return PipedGzipWriter(filename, mode, compresslevel,
+                                   threads=threads)
+
+
 def _open_gz(filename, mode: str, compresslevel, threads):
     if threads != 0:
         try:
-            if 'r' in mode:
-                try:
-                    return PipedIGzipReader(filename, mode)
-                except (OSError, ValueError):
-                    # No igzip installed or version does not support reading
-                    # concatenated files.
-                    return PipedGzipReader(filename, mode, threads=threads)
-            else:
-                try:
-                    return PipedIGzipWriter(filename, mode, compresslevel)
-                except (OSError, ValueError):
-                    # No igzip installed or compression level higher than 3
-                    return PipedGzipWriter(filename, mode, compresslevel, threads=threads)
+            return _open_gz_external(filename, mode, compresslevel, threads)
         except OSError:
             pass  # We try without threads.
 
     if 'r' in mode:
+        if igzip is not None:
+            return igzip.open(filename, mode)
         return gzip.open(filename, mode)
-    else:
-        # Override gzip.open's default of 9 for consistency with command-line gzip.
-        return gzip.open(filename, mode,
-                         compresslevel=6 if compresslevel is None else compresslevel)
+
+    if igzip is not None:
+        try:
+            return igzip.open(filename, mode,
+                              compresslevel=isal_zlib.ISAL_DEFAULT_COMPRESSION
+                              if compresslevel is None else compresslevel)
+        except ValueError:
+            # Compression level not supported, move to built-in gzip.
+            pass
+
+    # Override gzip.open's default of 9 for consistency with command-line gzip.
+    return gzip.open(filename, mode,
+                     compresslevel=6 if compresslevel is None else compresslevel)
 
 
 def _detect_format_from_content(filename: str) -> Optional[str]:


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


=====================================
tests/test_xopen.py
=====================================
@@ -431,7 +431,7 @@ def test_concatenated_gzip_function():
 
 
 @pytest.mark.skipif(
-    not hasattr(fcntl, "F_GETPIPE_SZ") and _MAX_PIPE_SIZE is not None,
+    not hasattr(fcntl, "F_GETPIPE_SZ") or _MAX_PIPE_SIZE is None,
     reason="Pipe size modifications not available on this platform.")
 def test_pipesize_changed(tmpdir):
     path = Path(str(tmpdir), "hello.gz")


=====================================
tox.ini
=====================================
@@ -1,20 +1,34 @@
 [tox]
-envlist = flake8,mypy,py35,py36,py37,py38,py39,pypy3
+envlist = flake8,mypy,py36,py37,py38,py39,pypy3
 
 [testenv]
-deps = pytest
+deps =
+    pytest
+    coverage
 setenv = PYTHONDEVMODE = 1
-commands = pytest --doctest-modules --pyargs src/xopen tests
+commands =
+    coverage run --concurrency=multiprocessing -m pytest --doctest-modules src/xopen/ tests/
+    coverage combine
+    coverage report
+    coverage xml
+
+[testenv:isal]
+deps =
+    pytest
+    coverage
+    isal
 
 [testenv:flake8]
 basepython = python3.6
 deps = flake8
 commands = flake8 src/ tests/
+skip_install = true
 
 [testenv:mypy]
 basepython = python3.6
 deps = mypy
 commands = mypy src/
+skip_install = true
 
 [flake8]
 max-line-length = 99



View it on GitLab: https://salsa.debian.org/med-team/python-xopen/-/commit/a86084cc094e86ce8069045feeb236d937ef2b45

-- 
View it on GitLab: https://salsa.debian.org/med-team/python-xopen/-/commit/a86084cc094e86ce8069045feeb236d937ef2b45
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/20210124/10685fcb/attachment-0001.html>


More information about the debian-med-commit mailing list