Skip to content
Open
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
13 changes: 1 addition & 12 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,10 @@ jobs:
&& popd >/dev/null 2>&1

- name: Install Docs Dependencies
# AttributeError: 'MathBlockParser' object has no attribute 'parse_axt_heading'
# https://github.com/jupyter/nbconvert/issues/2198
# mistune = "<3.1"
run: |
source ~/conda/etc/profile.d/conda.sh \
&& conda activate docs \
&& conda install --yes \
mkdocs \
mkdocstrings \
mkdocstrings-python \
mkdocs-material \
mkdocs-material-extensions \
mkdocs-jupyter \
"mistune<3.1" \
&& pip install mkdocs-print-site-plugin \
&& ./docs/install_requirements.sh \
&& git config user.name 'github-actions[bot]' \
&& git config user.email 'github-actions[bot]@users.noreply.github.com'

Expand Down
34 changes: 26 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,30 @@ jobs:
matrix:
include:
- os: ubuntu-latest
python: "3.9"
python: "3.10"
arch: Linux-x86_64
ompdisable: 0
- os: ubuntu-latest
python: "3.11"
python: "3.12"
arch: Linux-x86_64
ompdisable: 0
- os: ubuntu-latest
python: "3.13"
python: "3.14"
arch: Linux-x86_64
ompdisable: 0
- os: macos-latest
- os: macos-15-intel
python: "3.10"
arch: MacOSX-x86_64
ompdisable: 1
- os: macos-latest
- os: macos-15-intel
python: "3.13"
arch: MacOSX-x86_64
ompdisable: 1
- os: macos-latest
- os: macos-15
python: "3.10"
arch: MacOSX-arm64
ompdisable: 1
- os: macos-latest
- os: macos-15
python: "3.13"
arch: MacOSX-arm64
ompdisable: 1
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
&& conda create --yes -n test python==${{ matrix.python }} \
&& conda activate test \
&& conda install --yes --file packaging/conda_build_requirements.txt
if test ${{ matrix.python }} = "3.9"; then conda install libxcrypt; fi
if test ${{ matrix.python }} = "3.10"; then conda install libxcrypt; fi

- name: Install
run: |
Expand Down Expand Up @@ -123,3 +123,21 @@ jobs:
&& pushd test >/dev/null 2>&1 \
&& mpirun -np 2 python -m mpi4py -c 'import flacarray.tests; flacarray.tests.run()' \
&& popd >/dev/null 2>&1

- name: External C Link Tests (Dynamic)
run: |
source ~/conda/etc/profile.d/conda.sh \
&& conda activate test \
&& export OMP_NUM_THREADS=2 \
&& cmake -S packaging/test_c_link -B build_c_link \
&& cmake --build build_c_link \
&& ctest --test-dir build_c_link

- name: External C Link Tests (Static)
run: |
source ~/conda/etc/profile.d/conda.sh \
&& conda activate test \
&& export OMP_NUM_THREADS=2 \
&& cmake -S packaging/test_c_link -B build_c_link_static \
&& cmake --build build_c_link_static \
&& ctest --test-dir build_c_link_static
40 changes: 21 additions & 19 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ jobs:
matrix:
include:
# Linux 64 bit manylinux
- os: ubuntu-latest
arch: x86_64
python: 39
builder: manylinux
- os: ubuntu-latest
arch: x86_64
python: 310
Expand All @@ -41,48 +37,54 @@ jobs:
arch: x86_64
python: 313
builder: manylinux
- os: ubuntu-latest
arch: x86_64
python: 314
builder: manylinux

# MacOS x86_64. The macos-13 runner is the last
# Intel-based runner version. At some point we'll
# need to switch to macos-latest and test cross compiling.
- os: macos-13
# MacOS x86_64.
- os: macos-15-intel
arch: x86_64
python: 310
builder: macosx
- os: macos-13
- os: macos-15-intel
arch: x86_64
python: 311
builder: macosx
- os: macos-13
- os: macos-15-intel
arch: x86_64
python: 312
builder: macosx
- os: macos-13
- os: macos-15-intel
arch: x86_64
python: 313
builder: macosx

# MacOS arm64
- os: macos-latest
- os: macos-15
arch: arm64
python: 310
builder: macosx
- os: macos-latest
- os: macos-15
arch: arm64
python: 311
builder: macosx
- os: macos-latest
- os: macos-15
arch: arm64
python: 312
builder: macosx
- os: macos-latest
- os: macos-15
arch: arm64
python: 313
builder: macosx
- os: macos-15
arch: arm64
python: 314
builder: macosx
env:
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.builder }}_${{ matrix.arch }}
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.builder }}2014
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.builder }}2014
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.builder }}_2_28
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.builder }}_2_28
CIBW_BUILD_VERBOSITY: 3
CIBW_ENVIRONMENT_LINUX: >
CC=gcc
Expand All @@ -100,11 +102,11 @@ jobs:
- uses: actions/setup-python@v6
name: Install Python
with:
python-version: '3.11'
python-version: '3.13'

- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel==2.22.0
python -m pip install cibuildwheel==3.3.1

- name: Build wheel
run: |
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Generated files
src/flacarray/_version.py
src/flacarray/libflacarray/version.c

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
73 changes: 73 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
cmake_minimum_required(VERSION 3.21)

# Warn if the user invokes CMake directly
if (NOT SKBUILD)
message(WARNING "\
This CMake file is meant to be executed using 'scikit-build-core'.
Running it directly will almost certainly not produce the desired
result. If you are a user trying to install this package, use the
command below, which will install all necessary build dependencies,
compile the package in an isolated environment, and then install it.

$ pip install .

")
endif()

message(STATUS "CMAKE_BUILD_TYPE set to '${CMAKE_BUILD_TYPE}'")

# Auxiliary files
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

# Define the project with name and version from pyproject.toml
project(${SKBUILD_PROJECT_NAME} LANGUAGES C VERSION ${SKBUILD_PROJECT_VERSION})

# We are building libraries that will eventually be linked into shared
# modules. All code should be built with PIC.
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Use modern C
set(CMAKE_C_STANDARD 11)

# For installing the stand-alone library and header
include(GNUInstallDirs)

# OpenMP
if(NOT DISABLE_OPENMP)
find_package(OpenMP)
endif()

find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
include(UseCython)

execute_process(
COMMAND "${Python_EXECUTABLE}" -c "import numpy; print(numpy.get_include(), end='')"
OUTPUT_VARIABLE NUMPY_INCLUDE_DIR
)

find_package(FLAC REQUIRED)

if(DEFINED FLAC_VERSION)
if(FLAC_VERSION STREQUAL "")
message(STATUS "Cannot determine FLAC version- assuming it is >= 1.4.0")
else()
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\..*" "\\1"
FLAC_MAJ_VERSION "${FLAC_VERSION}")
string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\..*" "\\1"
FLAC_MIN_VERSION "${FLAC_VERSION}")
if(FLAC_MAJ_VERSION GREATER 1)
# Future proofing
message(STATUS "Found FLAC version ${FLAC_VERSION}")
else()
if(FLAC_MIN_VERSION GREATER_EQUAL 4)
message(STATUS "Found FLAC version ${FLAC_VERSION}")
else()
message(FATAL_ERROR "FLAC version ${FLAC_VERSION} is not >= 1.4.0")
endif()
endif()
endif()
else()
message(STATUS "Cannot determine FLAC version- assuming it is >= 1.4.0")
endif()

add_subdirectory(src)
9 changes: 0 additions & 9 deletions MANIFEST.in

This file was deleted.

89 changes: 89 additions & 0 deletions cmake/FindFLAC.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Copied without modification from libsndfile
# (https://github.com/libsndfile/libsndfile)
#
# (C) Erik de Castro Lopo <erikd@mega-nerd.com>
#
# Released under LGPL v2.1
# https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
#
#
# - Find FLAC
# Find the native FLAC includes and libraries
#
# FLAC_USE_STATIC_LIBS: Search for static libraries.
#
# FLAC_INCLUDE_DIRS - where to find FLAC headers.
# FLAC_LIBRARIES - List of libraries when using libFLAC.
# FLAC_FOUND - True if libFLAC found.
# FLAC_DEFINITIONS - FLAC compile definitons

# Check whether to search static or dynamic libs
set(CMAKE_FIND_LIBRARY_SUFFIXES_SAV ${CMAKE_FIND_LIBRARY_SUFFIXES})

if(${FLAC_USE_STATIC_LIBS})
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
else()
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAV})
endif()

if (FLAC_INCLUDE_DIR)
# Already in cache, be silent
set (FLAC_FIND_QUIETLY TRUE)
endif ()

find_package (Ogg QUIET)

find_package (PkgConfig QUIET)
pkg_check_modules(PC_FLAC QUIET flac)

set(FLAC_VERSION ${PC_FLAC_VERSION})

find_path (FLAC_INCLUDE_DIR FLAC/stream_decoder.h
HINTS
${PC_FLAC_INCLUDEDIR}
${PC_FLAC_INCLUDE_DIRS}
${FLAC_ROOT}
)

# MSVC built libraries can name them *_static, which is good as it
# distinguishes import libraries from static libraries with the same extension.
find_library (FLAC_LIBRARY
NAMES
FLAC
libFLAC
libFLAC_dynamic
libFLAC_static
HINTS
${PC_FLAC_LIBDIR}
${PC_FLAC_LIBRARY_DIRS}
${FLAC_ROOT}
)

# Handle the QUIETLY and REQUIRED arguments and set FLAC_FOUND to TRUE if
# all listed variables are TRUE.
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (FLAC
REQUIRED_VARS
FLAC_LIBRARY
FLAC_INCLUDE_DIR
VERSION_VAR
FLAC_VERSION
)

if (FLAC_FOUND)
set (FLAC_INCLUDE_DIRS ${FLAC_INCLUDE_DIR})
set (FLAC_LIBRARIES ${FLAC_LIBRARY} ${OGG_LIBRARIES})
if (NOT TARGET FLAC::FLAC)
add_library(FLAC::FLAC UNKNOWN IMPORTED)
set_target_properties(FLAC::FLAC PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${FLAC_INCLUDE_DIR}"
IMPORTED_LOCATION "${FLAC_LIBRARY}"
INTERFACE_LINK_LIBRARIES Ogg::ogg
)
endif ()
endif ()

mark_as_advanced(FLAC_INCLUDE_DIR FLAC_LIBRARY)

# Restore library search suffix
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAV})
Loading