[med-svn] [Git][med-team/cyvcf2][upstream] New upstream version 0.30.24
Andreas Tille (@tille)
gitlab at salsa.debian.org
Mon Nov 27 16:01:15 GMT 2023
Andreas Tille pushed to branch upstream at Debian Med / cyvcf2
Commits:
105e625e by Andreas Tille at 2023-11-27T16:35:54+01:00
New upstream version 0.30.24
- - - - -
6 changed files:
- + .github/workflows/build.yml
- + .github/workflows/wheels.yml
- CHANGES.md
- cyvcf2/__init__.py
- cyvcf2/cyvcf2.pxd
- cyvcf2/cyvcf2.pyx
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"
View it on GitLab: https://salsa.debian.org/med-team/cyvcf2/-/commit/105e625ed6ee5b1588270efcaeb85a9a5192a6d8
--
View it on GitLab: https://salsa.debian.org/med-team/cyvcf2/-/commit/105e625ed6ee5b1588270efcaeb85a9a5192a6d8
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/3f7e6049/attachment-0001.htm>
More information about the debian-med-commit
mailing list