Skip to content
Draft
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
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SCM syntax highlighting & preventing 3-way merges
pixi.lock merge=binary linguist-language=YAML linguist-generated=true -diff
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ __pycache__/
/Wrappers/Python/cil/lib/
*.vscode*
*.egg*

# Pixi environments
.pixi/*
!.pixi/config.toml
3 changes: 3 additions & 0 deletions .pixi/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Can be removed when https://github.com/TomographicImaging/CIL/issues/1870#issuecomment-3792746939 is resolved
[repodata-config."https://tomography.stfc.ac.uk/"]
disable-sharded = true
3 changes: 1 addition & 2 deletions Wrappers/Python/cil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@
#
# Authors:
# CIL Developers, listed at: https://github.com/TomographicImaging/CIL/blob/master/NOTICE.txt

from .version import version as __version__
from cil.version import version as __version__
6 changes: 3 additions & 3 deletions Wrappers/Python/test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ def initialise_tests():
has_nvidia = True
except:
if os.environ.get("TESTS_FORCE_GPU", ""):
raise ImportError
raise ImportError("nvidia-smi not found")
has_nvidia = False
system_state['has_nvidia']=has_nvidia

#astra
module_info = importlib.util.find_spec("astra")
if module_info is None:
if os.environ.get("TESTS_FORCE_GPU", ""):
raise ImportError
raise ImportError("module not found: astra")
has_astra = False
else:
has_astra = True
Expand All @@ -76,7 +76,7 @@ def initialise_tests():
module_info = importlib.util.find_spec("tigre")
if module_info is None:
if os.environ.get("TESTS_FORCE_GPU", ""):
raise ImportError
raise ImportError("module not found: tigre")
has_tigre = False
else:
has_tigre = True
Expand Down
8,234 changes: 8,234 additions & 0 deletions pixi.lock

Large diffs are not rendered by default.

204 changes: 148 additions & 56 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,50 +1,16 @@
[build-system]
requires = [
"setuptools>=64",
"setuptools_scm>=8",
"scikit-build-core>=0.10",
#"ipp-devel==2021.12.*", # PyPI conflicts with conda package
]
build-backend = "scikit_build_core.build"

[tool.scikit-build]
minimum-version = "build-system.requires"
cmake.version = ">=3.16"
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
sdist.include = ["Wrappers/Python/cil/version.py"]
sdist.exclude = ["scripts", "docs", "Wrappers/Python/data", "Wrappers/Python/test", ".*"]
[tool.scikit-build.wheel.packages]
cil = "Wrappers/Python/cil"

[tool.setuptools]
package-dir = {"" = "Wrappers/Python"}

[tool.setuptools.packages.find]
where = ["Wrappers/Python"]
include = ["cil", "cil.*"]
exclude = ["data", "test"]

[project.urls]
#homepage = "https://ccpi.ac.uk/cil"
homepage = "https://tomographicimaging.github.io/CIL"
documentation = "https://tomographicimaging.github.io/CIL/nightly"
repository = "https://github.com/TomographicImaging/CIL"
changelog = "https://github.com/TomographicImaging/CIL/blob/master/CHANGELOG.md"

[project]
name = "cil"
dynamic = ["version"]
description = "Core Imaging Library"
license = {text = "Apache-2.0"}
maintainers = [{name="CIL developers", email="[email protected]"}]
license = { text = "Apache-2.0" }
maintainers = [{ name = "CIL developers", email = "[email protected]" }]
requires-python = ">=3.10"
readme = "README.md"
keywords = ["tomography", "optimisation"]
dependencies = [
#"cil-data>=22", # missing from PyPI
"dxchange",
"h5py",
#"ipp==2021.12.*", # PyPI conflicts with conda package
"ipp==2021.12.*",
"numba",
"numpy>=1.23, <2.0.0",
"olefile>=0.46",
Expand All @@ -54,39 +20,165 @@ dependencies = [
"tqdm",
"packaging",
]

[project.urls]
#homepage = "https://ccpi.ac.uk/cil"
homepage = "https://tomographicimaging.github.io/CIL/"
documentation = "https://tomographicimaging.github.io/CIL/nightly"
repository = "https://github.com/TomographicImaging/CIL"
changelog = "https://github.com/TomographicImaging/CIL/blob/master/CHANGELOG.md"

[project.optional-dependencies]
plugins = [
"ipywidgets",
#"tomophantom==2.0.0", # [linux] # missing from PyPI
]
gpu = [
"astra-toolbox>=1.9.9.dev5,<=2.1", # [not osx]
#"tigre>=2.4,<=2.6", # missing from PyPI
]
# cuda = [
# "astra-toolbox>=1.9.9.dev5,<=2.1", # [not osx]
# #"tigre>=2.4,<=2.6", # missing from PyPI
# ]
[dependency-groups]

data = [
#"cil-data>=22", # missing from PyPI
"zenodo_get>=1.6",
]

test = [
#"ccpi-regulariser=24.0.1", # [not osx] # missing from PyPI
"cvxpy",
"matplotlib-base>=3.3",
# "matplotlib-base>=3.3",
"packaging",
"scikit-image",
"unittest-parametrize",
"wget",
"zenodo_get>=1.6",
"pytest",
]

docs = [
"jinja2",
#"pydata-sphinx-theme",
"recommonmark",
"sphinx",
"sphinx_rtd_theme",
"sphinx-autobuild",
"sphinx-click",
"sphinx-copybutton",
"sphinx-panels",
"sphinxcontrib-bibtex",
"nbsphinx",
"sphinx-gallery",
"sphinx-copybutton",
"notebook",
"jinja2",
"pydata-sphinx-theme",
"recommonmark",
"sphinx<9", # Until https://github.com/sphinx-contrib/multiversion/issues/201 is resolved
"sphinx_rtd_theme",
"sphinx-autobuild",
"sphinx-click",
"sphinx-copybutton",
"sphinx-multiversion",
"sphinx-panels",
"sphinxcontrib-bibtex",
"nbsphinx",
"sphinx-gallery",
"notebook",
"ipywidgets",
"matplotlib",
]

### PEP 517/518 build system configuration ###
[build-system]
requires = [
"setuptools>=64",
"scikit-build-core>=0.10",

"ipp-devel>=2021.10",
"ipp-static>=2021.10",
"intel-openmp",
]
build-backend = "scikit_build_core.build"

[tool.scikit-build]
minimum-version = "build-system.requires"
cmake.version = ">=3.16"
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
sdist.exclude = [
"scripts",
"docs",
"Wrappers/Python/data",
"Wrappers/Python/test",
".*",
]
[tool.scikit-build.wheel.packages]
cil = "Wrappers/Python/cil"

[tool.setuptools]
package-dir = { "" = "Wrappers/Python" }

[tool.setuptools.packages.find]
where = ["Wrappers/Python"]
include = ["cil", "cil.*"]
exclude = ["data", "test"]

### Pixi Configuration ###
[tool.pixi.workspace]
channels = ["https://tomography.stfc.ac.uk/conda", "conda-forge"]
platforms = ["linux-64", "win-64"]
preview = ["pixi-build"] # Can be removed when pixi-build is stable. Last checked 2026-01-24 in pixi 0.63.2

[tool.pixi.workspace.build-variants]
# python = ["3.11.*", "3.12.*"]

[tool.pixi.package.host-dependencies]
uv = "*"
cmake = { version = ">=3.16" }

ipp-devel = { version = ">=2021.10" }
ipp-include = { version = ">=2021.10" }

[tool.pixi.package.build]
backend = { name = "pixi-build-python", version = "*" }

[tool.pixi.package.build.config]
ignore-pypi-mapping = false # Can be removed when this is default in pixi-build-python. Last checked 2026-01-24 in pixi 0.63.2

[tool.pixi.pypi-dependencies]
cil = { path = ".", editable = true }

[tool.pixi.environments]
default = { solve-group = "default" }
gpu = { features = ["astra-gpu", "tigre"], solve-group = "cuda" }
dev = { features = ["data", "docs", "plugins", "test"], solve-group = "default" }
plugins = { features = ["plugins"], solve-group = "default" }
test = { features = ["test" ], solve-group = "default" }
test-gpu = { features = ["test", "astra-gpu", "tigre"], solve-group = "cuda" }
docs = { features = ["docs", "astra-gpu", "tigre", "plugin-tomophantom", "plugin-ccpi-regulariser"], solve-group = "cuda" }

## Features ##
# Plugins #
[tool.pixi.feature.plugin-tomophantom.dependencies]
tomophantom = { version = "==2.0.0", channel = "https://tomography.stfc.ac.uk/conda" }

[tool.pixi.feature.plugin-ccpi-regulariser.dependencies]
ccpi-regulariser = { version = "==24.0.1", channel = "https://tomography.stfc.ac.uk/conda" }

[tool.pixi.feature.docs.tasks]
docs-build = { cmd = "sphinx-build -b html docs/source docs/build", default-environment = "docs" }
docs-serve = { cmd = "sphinx-autobuild docs/source docs/build --open-browser", default-environment = "docs" }

[tool.pixi.feature.test.dependencies]
cil-data = { version = ">=22.0.0,<23", channel = "https://tomography.stfc.ac.uk/conda" }
tomophantom = { version = "==2.0.0", channel = "https://tomography.stfc.ac.uk/conda" }

# To be handled when astra-toolbox-cpu is released
# See: https://github.com/astra-toolbox/astra-toolbox/issues/327#issuecomment-3799202745
# See: https://discord.com/channels/1082332781146800168/1464650877750087732
# [tool.pixi.feature.astra-cpu.dependencies]
# astra-toolbox = { version = "==2.1", build = "py*", channel = "conda-forge" }

[tool.pixi.feature.astra-gpu.dependencies]
astra-toolbox = { version = "==2.1", build = "cuda*", channel = "conda-forge" }

[tool.pixi.feature.tigre.dependencies]
tigre = { version = "==2.6", channel = "https://tomography.stfc.ac.uk/conda" }

[tool.pixi.tasks]
test = { cmd = "python -m unittest discover -v ./Wrappers/Python/test", default-environment = "test"}
test-gpu = { cmd = "python -m unittest discover -v ./Wrappers/Python/test" , default-environment = "test-gpu", env = { TESTS_FORCE_GPU = "1" } }
jupyter = { cmd = "jupyter notebook" }

[tool.pytest.ini_options]
testpaths = ["Wrappers/Python/test"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = "-v --tb=short"
26 changes: 24 additions & 2 deletions src/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,30 @@ else()
set (OpenMP_EXE_LINKER_FLAGS ${OpenMP_C_FLAGS})
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(IPP)
# Find Python to get the prefix path for PyPI-installed packages
find_package(Python COMPONENTS Interpreter QUIET)
if(Python_FOUND)
# Get the Python prefix (where PyPI .data packages install to)
execute_process(
COMMAND "${Python_EXECUTABLE}" -c "import sys; print(sys.prefix)"
OUTPUT_VARIABLE PYTHON_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
if(PYTHON_PREFIX)
message(STATUS "Python prefix: ${PYTHON_PREFIX}")
# Add Python prefix to CMAKE_PREFIX_PATH for finding IPP from PyPI
list(APPEND CMAKE_PREFIX_PATH "${PYTHON_PREFIX}")
endif()
endif()

# Try Intel's official IPPConfig.cmake first (for PyPI ipp-devel package)
# Fall back to our custom FindIPP.cmake for conda/system installs
find_package(IPP CONFIG QUIET)
if(NOT IPP_FOUND)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(IPP)
endif()

list(APPEND cilacc_SOURCES utilities.cpp axpby.cpp FiniteDifferenceLibrary.cpp)
list(APPEND cilacc_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/include)
Expand Down
Loading