[med-svn] [Git][med-team/cyvcf2][master] 4 commits: New upstream version 0.30.24

Andreas Tille (@tille) gitlab at salsa.debian.org
Mon Nov 27 16:01:04 GMT 2023



Andreas Tille pushed to branch master at Debian Med / cyvcf2


Commits:
105e625e by Andreas Tille at 2023-11-27T16:35:54+01:00
New upstream version 0.30.24
- - - - -
0980cc4f by Andreas Tille at 2023-11-27T16:35:54+01:00
routine-update: New upstream version

- - - - -
b704ff59 by Andreas Tille at 2023-11-27T16:35:55+01:00
Update upstream source from tag 'upstream/0.30.24'

Update to upstream version '0.30.24'
with Debian dir f0b2c5576ebcb0a5f05654e83579c8723d6abe7d
- - - - -
61a57c46 by Andreas Tille at 2023-11-27T16:36:00+01:00
routine-update: Build-Depends: s/dh-python/dh-sequence-python3/

- - - - -


9 changed files:

- + .github/workflows/build.yml
- + .github/workflows/wheels.yml
- CHANGES.md
- cyvcf2/__init__.py
- cyvcf2/cyvcf2.pxd
- cyvcf2/cyvcf2.pyx
- debian/changelog
- debian/control
- debian/rules


Changes:

=====================================
.github/workflows/build.yml
=====================================
@@ -0,0 +1,37 @@
+name: Build
+
+on: [push, pull_request]
+
+jobs:
+  build:
+    name: Run tests on Python ${{ matrix.python-version }}
+    runs-on: ubuntu-20.04
+    strategy:
+      matrix:
+        python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
+
+    steps:
+    - uses: actions/checkout at v3
+      with:
+        submodules: true
+    - name: Set up Python ${{ matrix.python-version }}
+      uses: actions/setup-python at v4
+      with:
+        python-version: ${{ matrix.python-version }}
+    - name: Install
+      run: |
+        sudo apt-get update
+        sudo apt-get install libcurl4-openssl-dev
+        pip install -r requirements.txt
+        pip install pytest pytest-cov
+        git submodule update --init --recursive
+        cd htslib
+        autoheader && autoconf && autoreconf --install
+        ./configure --enable-s3 --disable-lzma --disable-bz2
+        make
+        cd ..
+        CYTHONIZE=1 python setup.py build_ext -i
+    - name: Test
+      run: |
+        pytest --cov cyvcf2 --cov-report term-missing
+


=====================================
.github/workflows/wheels.yml
=====================================
@@ -0,0 +1,145 @@
+name: Wheels
+
+on:
+  push:
+    branches:
+      - main
+    tags:
+      - 'v*.*.*'
+  workflow_dispatch:
+    inputs:
+      debug_enabled:
+        description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
+        required: false
+        default: false
+  schedule:
+    # run weekly on a Monday
+    - cron: '0 0 * * 1'
+
+jobs:
+  build_wheels:
+    name: Build wheels on ${{ matrix.os }}
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os: [ubuntu-20.04, macos-latest]
+
+    steps:
+    - uses: actions/checkout at v3
+      with:
+        submodules: true
+    - uses: actions/setup-python at v4
+      name: Install Python
+      with:
+        python-version: "3.7"
+
+    - name: Install cibuildwheel
+      run: |
+        python -m pip install -U cibuildwheel
+
+    - name: Build wheels for Linux
+      if: matrix.os == 'ubuntu-20.04'
+      run: |
+        python -m cibuildwheel --output-dir wheelhouse
+      env:
+        CIBW_SKIP: "pp* *i686* *musllinux*"
+        CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
+        CIBW_BEFORE_BUILD_LINUX: "{project}/ci/linux-deps"
+        CIBW_TEST_COMMAND: "{project}/ci/test"
+        CIBW_ENVIRONMENT: "CYTHONIZE=1 LIBDEFLATE=1 LDFLAGS='-L/usr/lib64/openssl11' CPPFLAGS='-I/usr/include/openssl11' C_INCLUDE_PATH='/root/include' LIBRARY_PATH='/root/lib'"
+        CIBW_REPAIR_WHEEL_COMMAND_LINUX: LD_LIBRARY_PATH='/root/lib' auditwheel repair -w {dest_dir} {wheel}
+
+    - name: Build wheels for Mac OS x86
+      if: matrix.os == 'macos-latest'
+      run: |
+        python -m cibuildwheel --output-dir wheelhouse
+      env:
+        CIBW_SKIP: "pp* *i686*"
+        CIBW_ARCHS_MACOS: "x86_64"
+        CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
+        CIBW_BEFORE_BUILD_MACOS: "{project}/ci/osx-deps"
+        CIBW_TEST_COMMAND: "{project}/ci/test"
+        CIBW_ENVIRONMENT: "CYTHONIZE=1 LIBDEFLATE=1 C_INCLUDE_PATH='/usr/local/include' LIBRARY_PATH='/usr/local/lib'"
+        # https://cibuildwheel.readthedocs.io/en/stable/faq/#macos-passing-dyld_library_path-to-delocate
+        CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
+          DYLD_LIBRARY_PATH=/usr/local/lib delocate-listdeps {wheel} &&
+          DYLD_LIBRARY_PATH=/usr/local/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}
+        LDFLAGS: "-L/usr/local/opt/openssl at 1.1/lib"
+        CPPFLAGS: "-I/usr/local/opt/openssl at 1.1/include"
+        PKG_CONFIG_PATH: "/usr/local/opt/openssl at 1.1/lib/pkgconfig"
+
+    - name: Build wheels for Mac OS arm64
+      # don't build with libdeflate, see https://github.com/brentp/cyvcf2/issues/252
+      if: matrix.os == 'macos-latest'
+      run: |
+        python -m cibuildwheel --output-dir wheelhouse
+      env:
+        CIBW_SKIP: "pp* *i686*"
+        CIBW_ARCHS_MACOS: "arm64"
+        CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
+        CIBW_BEFORE_BUILD_MACOS: "{project}/ci/osx-arm64-deps"
+        CIBW_TEST_COMMAND: "{project}/ci/test"
+        CIBW_TEST_SKIP: "*-macosx_arm64"
+        CIBW_ENVIRONMENT: "CYTHONIZE=1 C_INCLUDE_PATH='/usr/local/include' LIBRARY_PATH='/usr/local/lib'"
+        # https://cibuildwheel.readthedocs.io/en/stable/faq/#macos-passing-dyld_library_path-to-delocate
+        CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
+          DYLD_LIBRARY_PATH=/usr/local/lib delocate-listdeps {wheel} &&
+          DYLD_LIBRARY_PATH=/usr/local/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}
+        LDFLAGS: "-L/usr/local/opt/openssl at 1.1/lib"
+        CPPFLAGS: "-I/usr/local/opt/openssl at 1.1/include"
+        PKG_CONFIG_PATH: "/usr/local/opt/openssl at 1.1/lib/pkgconfig"
+
+    # Enable tmate debugging of manually-triggered workflows if the input option was provided
+    - name: Setup tmate session
+      if: ${{ always() && github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
+      uses: mxschmitt/action-tmate at v3
+
+    - uses: actions/upload-artifact at v2
+      with:
+        path: ./wheelhouse/*.whl
+
+  build_sdist:
+    name: Build source distribution
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout at v2
+
+      - uses: actions/setup-python at v2
+        name: Install Python
+        with:
+          python-version: "3.7"
+
+      - name: Install dependencies
+        run: |
+          sudo apt-get update
+          sudo apt-get install libcurl4-openssl-dev libbz2-dev liblzma-dev libssl-dev
+          git submodule update --init --recursive
+          cd htslib
+          autoheader && autoconf && autoreconf --install
+          ./configure --enable-libcurl --enable-s3 --enable-lzma --enable-bz2
+          make
+          cd ..
+          pip install -r requirements.txt
+
+      - name: Build sdist
+        run: CYTHONIZE=1 python setup.py sdist
+
+      - uses: actions/upload-artifact at v2
+        with:
+          path: dist/*.tar.gz
+
+  upload_pypi:
+    needs: [build_wheels, build_sdist]
+    runs-on: ubuntu-latest
+    # upload to PyPI on every tag starting with 'v'
+    if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
+    steps:
+      - uses: actions/download-artifact at v2
+        with:
+          name: artifact
+          path: dist
+
+      - uses: pypa/gh-action-pypi-publish at release/v1
+        with:
+          user: __token__
+          password: ${{ secrets.PYPI_API_TOKEN }}


=====================================
CHANGES.md
=====================================
@@ -1,3 +1,10 @@
+# v0.30.24
++ fix memory leak in raw_header (#281)
+
+# v0.30.23
++ set samples to empty when given empty list.
++ Prevent memory leak if user calls VCF.close() (#280)
+
 # v0.30.19
 + raise exception (instead of segfault) when calling num_called, etc. on variant without genotypes (#262 from @davmlaw)
 


=====================================
cyvcf2/__init__.py
=====================================
@@ -2,4 +2,4 @@ from .cyvcf2 import (VCF, Variant, Writer, r_ as r_unphased, par_relatedness,
                      par_het)
 Reader = VCFReader = VCF
 
-__version__ = "0.30.22"
+__version__ = "0.30.24"


=====================================
cyvcf2/cyvcf2.pxd
=====================================
@@ -23,6 +23,7 @@ cdef extern from "htslib/kstring.h":
         char *s;
 
     char *ks_release(kstring_t *s)
+    void ks_free(kstring_t *s)
 
 cdef extern from "htslib/hfile.h":
     ctypedef struct hFILE:


=====================================
cyvcf2/cyvcf2.pyx
=====================================
@@ -342,14 +342,19 @@ cdef class VCF(HTSFile):
         samples: list
             list of samples to extract.
         """
+        cdef bint is_null = 0
         if samples is None:
             samples = "-".encode()
         if isinstance(samples, list):
             samples = to_bytes(",".join(samples))
+            is_null = len(samples) == 0
         else:
             samples = to_bytes(samples)
 
-        ret = bcf_hdr_set_samples(self.hdr, <const char *>samples, 0)
+        if is_null:
+            ret = bcf_hdr_set_samples(self.hdr, NULL, 0)
+        else:
+            ret = bcf_hdr_set_samples(self.hdr, <const char *>samples, 0)
         assert ret >= 0, ("error setting samples", ret)
         self.n_samples = bcf_hdr_nsamples(self.hdr)
         if ret != 0 and samples != "-":
@@ -559,7 +564,7 @@ cdef class VCF(HTSFile):
     contains = __contains__
 
     def __dealloc__(self):
-        if self.hts != NULL and self.hdr != NULL:
+        if self.hdr != NULL:
             bcf_hdr_destroy(self.hdr)
             self.hdr = NULL
         self.close()
@@ -598,12 +603,15 @@ cdef class VCF(HTSFile):
             return [str(self.hdr.samples[i].decode('utf-8')) for i in range(self.n_samples)]
 
     property raw_header:
-         "string of the raw header from the VCF"
-         def __get__(self):
-             cdef kstring_t s
-             s.s, s.l, s.m = NULL, 0, 0
-             bcf_hdr_format(self.hdr, 0, &s)
-             return from_bytes(s.s)
+        "string of the raw header from the VCF"
+        def __get__(self):
+            cdef kstring_t s
+            s.s, s.l, s.m = NULL, 0, 0
+            bcf_hdr_format(self.hdr, 0, &s)
+
+            python_str = str(from_bytes(s.s))
+            ks_free(&s)
+            return python_str
 
     property seqlens:
         "list of chromosome lengths, if defined in the VCF header"


=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+cyvcf2 (0.30.24-1) UNRELEASED; urgency=medium
+
+  * Team upload.
+  * New upstream version
+  * Build-Depends: s/dh-python/dh-sequence-python3/ (routine-update)
+
+ -- Andreas Tille <tille at debian.org>  Mon, 27 Nov 2023 16:35:54 +0100
+
 cyvcf2 (0.30.22-1) unstable; urgency=medium
 
   * Team Upload.


=====================================
debian/control
=====================================
@@ -6,7 +6,7 @@ Section: science
 Testsuite: autopkgtest-pkg-python
 Priority: optional
 Build-Depends: debhelper-compat (= 13),
-               dh-python,
+               dh-sequence-python3,
                zlib1g-dev,
                cython3,
                python3-setuptools,


=====================================
debian/rules
=====================================
@@ -12,7 +12,7 @@ export DEB_BUILD_MAINT_OPTIONS=hardening=+all
 export CYTHONIZE=1
 
 %:
-	dh $@ --with python3 --buildsystem=pybuild
+	dh $@ --buildsystem=pybuild
 
 override_dh_install:
 	dh_numpy3



View it on GitLab: https://salsa.debian.org/med-team/cyvcf2/-/compare/4b7c5a6e9f76e13c17404bf38c77f9f54476f336...61a57c46874dea5270bdaae7bc99e8ba1bf6369e

-- 
View it on GitLab: https://salsa.debian.org/med-team/cyvcf2/-/compare/4b7c5a6e9f76e13c17404bf38c77f9f54476f336...61a57c46874dea5270bdaae7bc99e8ba1bf6369e
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/20231127/acf46e57/attachment-0001.htm>


More information about the debian-med-commit mailing list