Skip to content
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
8 changes: 2 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,15 @@ jobs:
export libcarna_version=$(conda list --json |jq -rj '[ .[] | select( .name == "libcarna" ) ][0].version')
echo "libcarna_version=$libcarna_version" >> "$GITHUB_OUTPUT"

- name: Build dist
- name: Build wheel
shell: bash
run: ./linux_build.bash

- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: dist-${{ inputs.python-version }}
path: |
dist
path: build/dist/libcarna_python-*.whl

outputs:
libcarna_version: ${{ steps.meta.outputs.libcarna_version }}
Expand Down Expand Up @@ -117,9 +116,6 @@ jobs:
run: |
eval "$(conda shell.bash hook)"
conda activate ./.env
cd test
mkdir test
mv results test/results
python -m unittest -vv
env:
LIBCARNA_PYTHON_LOGGING: true
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/dist
/LibCarna_Python.egg-info
/.libcarna-dev
/test/results/actual
.ipynb_checkpoints
*.swp
*.pyc
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ build:
jobs:
install:
- bash ./linux_build.bash
- pip install dist/libcarna_python-*.whl
- pip install build/dist/libcarna_python-*.whl
pre_build:
- pip install -r docs/requirements.txt
build:
Expand Down
31 changes: 19 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ project( LibCarna-Python )
set( PYTHON_MODULE_NAME "libcarna" )
include( FindPackageHandleStandardArgs )

set( MAJOR_VERSION 0 )
set( MINOR_VERSION 2 )
set( PATCH_VERSION 0 )

set( CMAKE_CXX_STANDARD 14 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )
set( CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE )
Expand Down Expand Up @@ -73,20 +77,31 @@ find_package( Eigen3 REQUIRED )
include_directories( ${EIGEN3_INCLUDE_DIR} )

# LibCarna
find_package( LibCarna ${REQUIRED_VERSION_LIBCARNA} REQUIRED COMPONENTS release )
find_package( LibCarna "3.4.0" REQUIRED COMPONENTS release )
include_directories( ${LibCarna_INCLUDE_DIR} )
set( LIBCARNA_VERSION ${FOUND_VERSION} )

############################################

configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/misc/__init__.py.in
${CMAKE_CURRENT_BINARY_DIR}/${PYTHON_MODULE_NAME}/__init__.py @ONLY )
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/misc/__init__.py.in
${CMAKE_CURRENT_BINARY_DIR}/${PYTHON_MODULE_NAME}/__init__.py
@ONLY
)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in
${CMAKE_CURRENT_BINARY_DIR}/setup.py
@ONLY
)

file( GLOB PYTHON_AUX_FILES "${CMAKE_CURRENT_SOURCE_DIR}/misc/libcarna/*.py" )
file( COPY ${PYTHON_AUX_FILES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/${PYTHON_MODULE_NAME}" )

file( GLOB LICENSES "${LibCarna_LICENSE_DIR}/LICENSE*" )
file( COPY ${LICENSES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/licenses/" )
file( COPY ${LICENSES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" )
file( COPY ${CMAKE_CURRENT_SOURCE_DIR}/README.md DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" )
file( COPY ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" )

############################################
# Project
Expand Down Expand Up @@ -165,11 +180,3 @@ install( FILES
${CMAKE_CURRENT_BINARY_DIR}/${PYTHON_MODULE_NAME}/__init__.py
DESTINATION ${INSTALL_LIBRARY_DIR}
)

############################################
# Process unit tests
############################################

if( BUILD_TEST )
add_subdirectory( test )
endif()
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2025 Leonid Kostrykin
Copyright (c) 2021-2025 Leonid Kostrykin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 2 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ dependencies:
- cmake
- eigen >=3.0.5
- libxcrypt # requied for Python 3.10
- pyyaml
- setuptools
- python-build
- pip

# ---------------------------------------------------------------------------
# Runtime dependencies (general)
Expand Down
51 changes: 33 additions & 18 deletions linux_build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,51 @@ set -ex

# Create or update conda environment
export ROOT="$PWD"/$(dirname "$0")
if [ ! -d "$ROOT/.env" ]; then
conda env create -f "$ROOT/environment.yml" --prefix "$ROOT/.env"
if [ ! -d "$ROOT"/.env ]; then
conda env create -f "$ROOT"/environment.yml --prefix "$ROOT"/.env
else
conda env update -f "$ROOT/environment.yml" --prefix "$ROOT/.env" --prune
conda env update -f "$ROOT"/environment.yml --prefix "$ROOT"/.env --prune
fi

# Activate conda environment
eval "$(conda shell.bash hook)"
conda activate "$ROOT/.env"
conda activate "$ROOT"/.env

# Setup and check dependencies
export PYBIND11_PREFIX="$CONDA_PREFIX/share/cmake/pybind11"
export CMAKE_MODULE_PATH="$CONDA_PREFIX/share/cmake/Modules"
# Create build directory
mkdir -p "$ROOT"/build

# Default to not building the test suite
if [ -z "$LIBCARNA_PYTHON_BUILD_TEST" ]; then
export LIBCARNA_PYTHON_BUILD_TEST="OFF"
else
pip install -r test/requirements.txt
# Build native extension
cd "$ROOT"/build
cmake -DCMAKE_BUILD_TYPE=Release \
-DPYTHON_EXECUTABLE="$(which python)" \
-Dpybind11_DIR="$CONDA_PREFIX/share/cmake/pybind11" \
-DCMAKE_MODULE_PATH="$CONDA_PREFIX/share/cmake/Modules" \
"$ROOT"
if [ -z "$LIBCARNA_SKIP_NATIVE" ]; then
make VERBOSE=1
fi

# Build wheel and test
cd "$ROOT"
python setup.py bdist_wheel
# Build wheel
python -m build --no-isolation

# Install wheel
rm -rf venv
python -m venv venv --system-site-package
source venv/bin/activate
pip install --no-deps dist/*.whl

# Optionally, run the test suite
if [ -v LIBCARNA_PYTHON_BUILD_TEST ]; then
cd "$ROOT"
pip install -r test/requirements.txt
python -m unittest
fi

# Optionally, build the documentation
if [ -v LIBCARNA_PYTHON_BUILD_DOCS ]; then
cd "$ROOT"
pip install -r docs/requirements.txt
export LIBCARNA_PYTHON_PATH="$ROOT/build/make_release"
rm -rf $ROOT/docs/build
rm -rf docs/build
sphinx-build -M html docs docs/build
cp $ROOT/docs/build/html/examples/*.ipynb $ROOT/examples/
cp docs/build/html/examples/*.ipynb examples/
fi
2 changes: 1 addition & 1 deletion misc/__init__.py.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = '@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@'
version = '@FULL_VERSION@'
libcarna_version = '@LIBCARNA_VERSION@'


Expand Down
124 changes: 0 additions & 124 deletions setup.py

This file was deleted.

55 changes: 55 additions & 0 deletions setup.py.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
from setuptools import setup


if __name__ == '__main__':
with open('README.md', encoding='utf-8') as io:
long_description = io.read()

setup(
name = 'LibCarna-Python',
version = '@FULL_VERSION@',
description = 'General-purpose real-time 3D visualization',
long_description = long_description,
long_description_content_type = 'text/markdown',
author = 'Leonid Kostrykin',
author_email = 'leonid.kostrykin@bioquant.uni-heidelberg.de',
url = 'https://github.com/kostrykin/LibCarna-Python',
include_package_data = True,
license = 'MIT',
license_files = [
'LICENSE',
'LICENSE-Carna',
'LICENSE-LibCarna',
'LICENSE-Eigen',
'LICENSE-GLEW',
],
package_dir = {
'libcarna': 'libcarna',
},
packages = ['libcarna'],
package_data = {
'libcarna': ['*.so'],
},
classifiers = [
'Development Status :: 4 - Beta',
'Environment :: GPU',
'Operating System :: POSIX :: Linux',
'Programming Language :: C++',
'Programming Language :: Python',
'Topic :: Education',
'Topic :: Multimedia :: Graphics :: 3D Rendering',
'Topic :: Scientific/Engineering :: Visualization',
],
install_requires = [
'numpy',
'numpngw >=0.1.4, <0.2',
'scikit-video >=1.1.11, <1.2',
'scipy',
'scikit-image',
'tifffile',
'pooch',
'matplotlib',
'typing_extensions', # required for Python 3.10
],
)

Loading
Loading