Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update odgi to 0.9.0 #51405

Merged
merged 5 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 22 additions & 17 deletions recipes/odgi/build.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
#!/bin/bash
export LIBRARY_PATH=${PREFIX}/lib
export LD_LIBRARY_PATH=${PREFIX}/lib
export CPATH=${PREFIX}/include
export C_INCLUDE_PATH=${PREFIX}/include
export CPLUS_INCLUDE_PATH=${PREFIX}/include
export CPP_INCLUDE_PATH=${PREFIX}/include
export CXX_INCLUDE_PATH=${PREFIX}/include
#cmake -H. -Bbuild -DPYTHON_EXECUTABLE:FILEPATH=$PYTHON -DCMAKE_BUILD_TYPE=Generic -DEXTRA_FLAGS='-march=sandybridge -Ofast -Og'
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Generic -DEXTRA_FLAGS='-march=sandybridge -Ofast'
cmake --build build

mkdir -p $PREFIX/bin
mv bin/* $PREFIX/bin

export INCLUDES="-I${PREFIX}/include"
export LIBPATH="-L${PREFIX}/lib"
export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib"
export CXXFLAGS="${CXXFLAGS} -O3 -I${PREFIX}/include"

if [[ `uname` == "Darwin" ]]; then
export CONFIG_ARGS="-DCMAKE_FIND_FRAMEWORK=NEVER -DCMAKE_FIND_APPBUNDLE=NEVER"
else
export CONFIG_ARGS=""
fi

cmake -S . -B build -DCMAKE_BUILD_TYPE=Generic \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_CXX_COMPILER="${CXX}" \
-DCMAKE_CXX_FLAGS="${CXXFLAGS}" -DEXTRA_FLAGS='-march=sandybridge -Ofast' \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Reconsider the use of architecture-specific and aggressive optimization flags

The flag -march=sandybridge targets a specific CPU architecture, which might not be compatible with all users' systems. This could result in binaries that fail to run on older or different CPUs. For broader compatibility, consider using a more generic architecture flag like -march=core2 or omitting the -march flag altogether.

Additionally, the -Ofast optimization level enables aggressive optimizations that may disregard strict compliance with standards, potentially leading to unexpected behavior or instability. It might be safer to use -O2 or -O3 for optimization to balance performance and reliability.

Apply the following changes to address the concerns:

-    -DCMAKE_CXX_FLAGS="${CXXFLAGS}" -DEXTRA_FLAGS='-march=sandybridge -Ofast' \
+    -DCMAKE_CXX_FLAGS="${CXXFLAGS}" -DEXTRA_FLAGS='-O3' \
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
-DCMAKE_CXX_FLAGS="${CXXFLAGS}" -DEXTRA_FLAGS='-march=sandybridge -Ofast' \
-DCMAKE_CXX_FLAGS="${CXXFLAGS}" -DEXTRA_FLAGS='-O3' \

"${CONFIG_ARGS}"
cmake --build build --target install -j "${CPU_COUNT}" -v

PYVER=`python -c 'import sys; print(str(sys.version_info[0])+"."+str(sys.version_info[1]))'`
mkdir -p $PREFIX/lib/python$PYVER/site-packages
cp lib/*cpython* $PREFIX/lib/python$PYVER/site-packages
cp lib/* $PREFIX/lib
#set -x
#python -c "import sys; sys.path.append('./lib'); import odgi_ffi"
#python -c "import sys; sys.path.append('./lib'); import odgi"
mkdir -p "${PREFIX}/lib/python${PYVER}/site-packages"
cp -rf lib/*cpython* "${PREFIX}/lib/python${PYVER}/site-packages"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Avoid hardcoding Python implementation-specific patterns

The use of *cpython* in the copy command assumes that the Python implementation is CPython. This may not be compatible with other Python implementations like PyPy.

Consider using a more general pattern or querying Python for the correct paths. For example:

-PYVER=`python -c 'import sys; print(str(sys.version_info[0])+"."+str(sys.version_info[1]))'`
+PYTHON_SITE_PACKAGES=`python -c 'import site; print(site.getsitepackages()[0])'`

Then adjust the copy command accordingly:

-mkdir -p "${PREFIX}/lib/python${PYVER}/site-packages"
-cp -rf lib/*cpython* "${PREFIX}/lib/python${PYVER}/site-packages"
+mkdir -p "${PYTHON_SITE_PACKAGES}"
+cp -rf lib/* "${PYTHON_SITE_PACKAGES}"

This approach ensures that the modules are placed in the correct directory regardless of the Python implementation.

Committable suggestion was skipped due to low confidence.

cp -rf lib/* "${PREFIX}/lib"
Comment on lines +24 to +25
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Use standard installation methods for Python packages

Copying files directly with cp -rf to the site-packages directory can overlook important installation steps and may lead to issues with package discovery or dependencies. It's recommended to use standard Python installation mechanisms to ensure proper setup.

Consider modifying the build process to install the Python modules using a setup script or ensure that CMake handles the installation correctly. For example:

  • Modify CMakeLists.txt to include proper installation commands for Python modules.
  • Use setup.py or pyproject.toml if applicable.

31 changes: 19 additions & 12 deletions recipes/odgi/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,50 +1,57 @@
{% set name = "odgi" %}
{% set version = "0.8.6" %}
{% set version = "0.9.0" %}

package:
name: "{{ name }}"
version: "{{ version }}"

source:
url: https://github.com/pangenome/{{ name }}/releases/download/v{{ version }}/{{ name }}-v{{ version }}.tar.gz
sha256: a6db190b782608082b14b42c660389aa18010791de1e2d07e29f7f61d8787754
patches:
- patch
sha256: 73b181c371e619b5e3e5ee87649cb8de82b054e492dcd128d93cec42be062f2f

build:
skip: True # [osx or py27]
number: 2
skip: True # [osx]
number: 0
run_exports:
- {{ pin_subpackage(name, max_pin="x.x") }}

requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- llvm-openmp # [osx]
- libgomp # [linux]
- cmake
- make
host:
- llvm-openmp # [osx]
- libgomp # [linux]
- zlib
- python
- jemalloc
- python
- pybind11
run:
- llvm-openmp # [osx]
- libgomp # [linux]
- python
- jemalloc
- pybind11

test:
commands:
- odgi test

about:
home: https://github.com/pangenome/odgi
home: "https://github.com/pangenome/odgi"
license: MIT
license_family: MIT
license_file: LICENSE
summary: An optimized dynamic genome/graph implementation
summary: "An optimized dynamic genome/graph implementation."
dev_url: "https://github.com/pangenome/odgi"
doc_url: "https://github.com/pangenome/odgi/blob/v{{ version }}/README.md"

extra:
recipe-maintainers:
- AndreaGuarracino
identifiers:
- doi:10.1093/bioinformatics/btac308
- biotools:odgi
- usegalaxy-eu:odgi_viz
- usegalaxy-eu:odgi_build
12 changes: 0 additions & 12 deletions recipes/odgi/patch

This file was deleted.