Skip to content

Commit

Permalink
hictkpy: add v1.0.0 (#51561)
Browse files Browse the repository at this point in the history
* Update Conan profiles

* Update build config to be in line with hictk's recipe

* Update patch files

* Update build script

* Bump version

* Update about section

* Update requirements

* Update test requirements

* Update package version pinning

* Make tests verbose

* Enable parallel builds

* Ensure the correct sysroot is used when building on macOS

* Ensure the correct sysroot is used when building on Linux

* Help CMake find NumPy headers

* Export env variables in build script

* Update checksum
  • Loading branch information
robomics authored Oct 31, 2024
1 parent 5046efd commit 114feee
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 94 deletions.
13 changes: 0 additions & 13 deletions recipes/hictkpy/CMakeLists.txt.patch

This file was deleted.

42 changes: 28 additions & 14 deletions recipes/hictkpy/build.sh
Original file line number Diff line number Diff line change
@@ -1,40 +1,54 @@
#!/bin/bash

# export CMAKE_BUILD_PARALLEL_LEVEL=${CPU_COUNT}
CMAKE_BUILD_PARALLEL_LEVEL=${CPU_COUNT}

scratch=$(mktemp -d)
export CONAN_HOME="$scratch/conan"

# shellcheck disable=SC2064
trap "rm -rf '$scratch'" EXIT

declare -a CMAKE_PLATFORM_FLAGS
if [[ ${HOST} =~ .*darwin.* ]]; then
export MACOSX_DEPLOYMENT_TARGET=10.15 # Required to use std::filesystem
CMAKE_PLATFORM_FLAGS+=(-DCMAKE_OSX_SYSROOT="${CONDA_BUILD_SYSROOT}")
if [[ "$OSX_ARCH" == 'x86_64' ]]; then
# https://conda-forge.org/docs/maintainer/knowledge_base/#newer-c-features-with-old-sdk
CFLAGS+=' -D_LIBCPP_DISABLE_AVAILABILITY'
CXXFLAGS+=' -D_LIBCPP_DISABLE_AVAILABILITY'
fi
CMAKE_ARGS+=" -DCMAKE_OSX_SYSROOT=${CONDA_BUILD_SYSROOT}"
conan_profile='apple-clang'
else
CMAKE_PLATFORM_FLAGS+=(-DCMAKE_TOOLCHAIN_FILE="${RECIPE_DIR}/cross-linux.cmake")
conan_profile='gcc'
# Workaround missing LLVMgold.so on Linux
CMAKE_ARGS+=' -DCMAKE_LINKER_TYPE=LLD'
CMAKE_ARGS+=" -DCMAKE_TOOLCHAIN_FILE=${RECIPE_DIR}/cross-linux.cmake"
conan_profile='clang'
fi

# Remember to update these profiles when bioconda's compiler toolchains are updated
mkdir -p "$CONAN_HOME/profiles/"
ln -s "${RECIPE_DIR}/conan_profiles/$conan_profile" "$CONAN_HOME/profiles/default"

# explicitly set CMAKE_OSX_DEPLOYMENT_TARGET
patch CMakeLists.txt < "${RECIPE_DIR}/CMakeLists.txt.patch"

# Remove unnecessary dependencies from conanfile.txt
patch conanfile.txt < "${RECIPE_DIR}/conanfile.txt.patch"
# Remove unnecessary dependencies from conanfile.py
patch conanfile.py < "${RECIPE_DIR}/conanfile.py.patch"

# Build hictkpy as a shared library
patch pyproject.toml < "${RECIPE_DIR}/pyproject.toml.patch"

CMAKE_ARGS+=" -DPython_EXECUTABLE=$PYTHON"
# See https://github.com/conda-forge/conda-forge.github.io/pull/2321
Python_INCLUDE_DIR="$("$PYTHON" -c 'import sysconfig; print(sysconfig.get_path("include"))')"
Python_NumPy_INCLUDE_DIR="$("$PYTHON" -c 'import numpy; print(numpy.get_include())')"

CMAKE_ARGS+=" -DPython_EXECUTABLE:PATH=${PYTHON}"
CMAKE_ARGS+=" -DPython_INCLUDE_DIR:PATH=${Python_INCLUDE_DIR}"
CMAKE_ARGS+=" -DPython_NumPy_INCLUDE_DIR=${Python_NumPy_INCLUDE_DIR}"
CMAKE_ARGS+=" -DPython3_EXECUTABLE:PATH=${PYTHON}"
CMAKE_ARGS+=" -DPython3_INCLUDE_DIR:PATH=${Python_INCLUDE_DIR}"
CMAKE_ARGS+=" -DPython3_NumPy_INCLUDE_DIR=${Python_NumPy_INCLUDE_DIR}"

echo "CFLAGS='$CFLAGS'"
echo "CXXFLAGS='$CXXFLAGS'"
echo "CMAKE_ARGS='$CMAKE_ARGS'"

echo "$CMAKE_ARGS"
export CMAKE_ARGS
export CMAKE_ARGS CMAKE_BUILD_PARALLEL_LEVEL CFLAGS CXXFLAGS

SETUPTOOLS_SCM_PRETEND_VERSION="$PKG_VERSION" \
"$PYTHON" -m pip install "$SRC_DIR" -vv
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler=clang
compiler.cppstd=17
compiler.libcxx=libstdc++11
compiler.version=13
compiler.version=18
os=Linux
90 changes: 90 additions & 0 deletions recipes/hictkpy/conanfile.py.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
diff --git a/conanfile.py b/conanfile.py
index a7d5c74..c08b356 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -35,21 +35,11 @@ class HictkpyConan(ConanFile):
return 17

def requirements(self):
- self.requires("arrow/17.0.0#81be2aa6c49800df8cc163adf4b99e9f")
- self.requires("boost/1.86.0#cd839a2082585255010f9e82eea94c7f", force=True)
self.requires("bshoshany-thread-pool/4.1.0#be1802a8768416a6c9b1393cf0ce5e9c")
self.requires("concurrentqueue/1.0.4#1e48e1c712bcfd892087c9c622a51502")
- self.requires("eigen/3.4.0#2e192482a8acff96fe34766adca2b24c")
- self.requires("fast_float/6.1.5#e067b96a6271d1b4c255858ca9805bdd")
- self.requires("fmt/11.0.2#5c7438ef4d5d69ab106a41e460ce11f3", force=True)
- self.requires("hdf5/1.14.4.3#df1467d7374938c231edbe10e83f2bb4", force=True)
- self.requires("highfive/2.10.0#3d1bd25944a57fa1bc30a0a22923d528")
- self.requires("libdeflate/1.22#f95aebe763153ccbc4cc76c023e42e5a")
self.requires("parallel-hashmap/1.4.0#36ac84df77219748440cdb0f23624d56")
self.requires("readerwriterqueue/1.0.6#aaa5ff6fac60c2aee591e9e51b063b83")
self.requires("span-lite/0.11.0#519fd49fff711674cfed8cd17d4ed422")
- self.requires("spdlog/1.14.1#972bbf70be1da4bc57ea589af0efde03")
- self.requires("zstd/1.5.6#afefe79a309bc2a7b9f56c2093504c8b", force=True)

def validate(self):
if self.settings.get_safe("compiler.cppstd"):
@@ -58,63 +48,3 @@ class HictkpyConan(ConanFile):
def configure(self):
if self.settings.compiler in ["clang", "gcc"]:
self.settings.compiler.libcxx = "libstdc++11"
-
- self.options["arrow"].compute = True
- self.options["arrow"].parquet = False
- self.options["arrow"].with_boost = True
- self.options["arrow"].with_re2 = True
- self.options["arrow"].with_thrift = False
- self.options["boost"].system_no_deprecated = True
- self.options["boost"].asio_no_deprecated = True
- self.options["boost"].filesystem_no_deprecated = True
- self.options["boost"].filesystem_version = 4
- self.options["boost"].zlib = False
- self.options["boost"].bzip2 = False
- self.options["boost"].lzma = False
- self.options["boost"].zstd = False
- self.options["boost"].without_atomic = False
- self.options["boost"].without_charconv = True
- self.options["boost"].without_chrono = True
- self.options["boost"].without_cobalt = True
- self.options["boost"].without_container = True
- self.options["boost"].without_context = True
- self.options["boost"].without_contract = True
- self.options["boost"].without_coroutine = True
- self.options["boost"].without_date_time = True
- self.options["boost"].without_exception = True
- self.options["boost"].without_fiber = True
- self.options["boost"].without_filesystem = False
- self.options["boost"].without_graph = True
- self.options["boost"].without_graph_parallel = True
- self.options["boost"].without_iostreams = True
- self.options["boost"].without_json = True
- self.options["boost"].without_locale = True
- self.options["boost"].without_log = True
- self.options["boost"].without_math = True
- self.options["boost"].without_mpi = True
- self.options["boost"].without_nowide = True
- self.options["boost"].without_process = False
- self.options["boost"].without_program_options = True
- self.options["boost"].without_python = True
- self.options["boost"].without_random = True
- self.options["boost"].without_regex = True
- self.options["boost"].without_serialization = True
- self.options["boost"].without_stacktrace = True
- self.options["boost"].without_system = False
- self.options["boost"].without_test = True
- self.options["boost"].without_thread = True
- self.options["boost"].without_timer = True
- self.options["boost"].without_type_erasure = True
- self.options["boost"].without_url = True
- self.options["boost"].without_wave = True
- self.options["fmt"].header_only = True
- self.options["hdf5"].enable_cxx = False
- self.options["hdf5"].hl = False
- self.options["hdf5"].threadsafe = False
- self.options["hdf5"].parallel = False
- self.options["highfive"].with_boost = False
- self.options["highfive"].with_eigen = False
- self.options["highfive"].with_opencv = False
- self.options["highfive"].with_xtensor = False
- self.options["spdlog"].header_only = True
- self.options["zstd"].build_programs = False
35 changes: 0 additions & 35 deletions recipes/hictkpy/conanfile.txt.patch

This file was deleted.

8 changes: 8 additions & 0 deletions recipes/hictkpy/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
c_compiler: # [linux]
- clang # [linux]
c_compiler_version: # [linux]
- 18 # [linux]
cxx_compiler: # [linux]
- clangxx # [linux]
cxx_compiler_version: # [linux]
- 18 # [linux]
49 changes: 28 additions & 21 deletions recipes/hictkpy/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,61 +1,68 @@
{% set name = "hictkpy" %}
{% set version = "0.0.5" %}
{% set sha256 = "e9576a1a719ce378873da15b76e9f7e699748c0486901607e4d7e87c3f0c6556" %}
{% set version = "1.0.0" %}
{% set sha256 = "a12c05cba9395ce39eb742b5d1e1a6e0cc0179a5b6981ae8a828ff9aee2c64ce" %}

package:
name: {{ name|lower }}
version: {{ version }}

build:
number: 2
number: 0
skip: True # [py < 39]
run_exports:
- {{ pin_subpackage('hictkpy', max_pin='x.x') }}
- {{ pin_subpackage('hictkpy', max_pin='x') }}

source:
url: https://github.com/paulsengroup/{{ name }}/archive/refs/tags/v{{ version }}.tar.gz
url: https://pypi.python.org/packages/source/h/{{ name }}/{{ name }}-{{ version }}.tar.gz
sha256: {{ sha256 }}

requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- cmake >=3.25
- cmake >=3.29
- conan >=2
- make
- fast_float >=5
- fmt >=10
- highfive >=2.7
- spdlog >=1.12
- eigen >=3.4
- fast_float >=6
- fmt >=11
- highfive >=2.9
- spdlog >=1.14

host:
- python
- pip
- hdf5 >=1.12
- libdeflate
- scikit-build-core
- libarrow >=16
- libdeflate >=1
- lld # [linux]
- nanobind >=2
- numpy
- scikit-build-core >=0.10
- setuptools_scm
- zstd >=1.5

run:
- python
- hdf5 >=1.12
- libdeflate
- numpy
- pandas
- scipy
- zstd >=1.5
- {{ pin_compatible('hdf5', min_pin='1.12') }}
- {{ pin_compatible('libdeflate', min_pin='1') }}
- {{ pin_compatible('numpy') }}
- {{ pin_compatible('pandas', min_pin='2.1') }}
- {{ pin_compatible('pyarrow', min_pin='16') }}
- {{ pin_compatible('scipy') }}
- {{ pin_compatible('zstd', min_pin='1.5') }}

about:
home: https://github.com/paulsengroup/{{ name }}
license: MIT
license_file: LICENSE
summary: Python bindings for hictk
summary: "Python bindings for hictk: read and write .cool and .hic files directly from Python"
dev_url: https://github.com/paulsengroup/{{ name }}
doc_url: https://github.com/paulsengroup/{{ name }}#readme
doc_url: https://{{ name }}.readthedocs.io/en/stable/

test:
requires:
- pytest>=6
- pytest>=8
source_files:
- test/*
imports:
Expand Down
16 changes: 8 additions & 8 deletions recipes/hictkpy/pyproject.toml.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
diff --git a/pyproject.toml b/pyproject.toml
index 1a03623..36102d0 100644
index 5ded5b9..fe8d305 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -49,7 +49,7 @@ HICTK_BUILD_EXAMPLES = "OFF"
HICTK_BUILD_BENCHMARKS = "OFF"
HICTK_BUILD_TOOLS = "OFF"
HICTK_ENABLE_GIT_VERSION_TRACKING = "OFF"
@@ -74,7 +74,7 @@ wheel.expand-macos-universal-tags = true
cmake.build-type = "Release"

[tool.scikit-build.cmake.define]
-BUILD_SHARED_LIBS = "OFF"
+BUILD_SHARED_LIBS = "ON"
CONAN_INSTALL_ARGS = "--settings=compiler.cppstd=17;--build=missing;--update;--options=*/*:shared=False"

[tool.setuptools_scm]
CMAKE_OSX_DEPLOYMENT_TARGET = "10.15"
CMAKE_PROJECT_TOP_LEVEL_INCLUDES = { env="HICTKPY_PROJECT_TOP_LEVEL_INCLUDES", default="cmake/conan_provider.cmake" }
CONAN_INSTALL_ARGS = { env="HICTKPY_CONAN_INSTALL_ARGS", default="--settings=compiler.cppstd=17;--settings=build_type=Release;--build=missing;--update;--options=*/*:shared=False" }
2 changes: 1 addition & 1 deletion recipes/hictkpy/run_test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash

"$PYTHON" -c 'import hictkpy; print(hictkpy.__version__)'
"$PYTHON" -m pytest test
"$PYTHON" -m pytest test -v

0 comments on commit 114feee

Please sign in to comment.