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
94 changes: 70 additions & 24 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,74 @@
name: Check 🐍 pkg PROPOSAL.

on: [push]
on:
push:
branches:
- main
tags:
- "**"
pull_request:

env:
CMAKE_TOOLCHAIN_FILE: build/conan_toolchain.cmake

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os : "ubuntu-latest"
- os : "macos-latest"
steps:
- uses: actions/checkout@v4
- name: Cache conan
id: cache-conan
uses: actions/cache@v4
with:
path: ~/.conan
key: ${{ runner.os }}-cache-conan-${{ matrix.compiler }}-${{ hashFiles('conanfile.py') }}-key
- name: Install conan
run: python3 -m pip install --break-system-packages conan
- name: Install Python 🐍 distributions 📦
run: python3 -m pip install --break-system-packages .
- name: Install pytest
run: python3 -m pip install --break-system-packages pytest
- name: run pytest
run: python3 -m pytest tests/python -v
build:
runs-on: ${{ matrix.os }}

defaults:
run:
# We need login shells (-l) for micromamba to work.
shell: bash -leo pipefail {0}

strategy:
matrix:
include:
- os: "ubuntu-latest"
install: pip
- os: "ubuntu-latest"
install: conda
- os: "macos-latest"
install: pip
- os: "macos-latest"
install: conda

steps:
- uses: actions/checkout@v6

- uses: actions/setup-python@v6
if: matrix.install == 'pip'
with:
python-version: "3.12"

- name: mamba setup
if: matrix.install == 'conda'
uses: mamba-org/setup-micromamba@v3
with:
init-shell: bash
environment-name: ci
create-args: >-
python=3.12
pip
pytest
cache-downloads: true

- name: Cache conan
id: cache-conan
uses: actions/cache@v5
with:
path: ~/.conan
key: ${{ runner.os }}-cache-conan-${{ matrix.compiler }}-${{ hashFiles('conanfile.py') }}-key

- name: Install conan
run: |
python -m pip install conan
conan profile detect

- name: Install C++ dependencies using conan
run: conan install . -o with_python=True -o with_testing=False --build=missing

- name: Install Python 🐍 distributions 📦
run: python -m pip install -v ".[tests]"

- name: run pytest
run: python -m pytest tests/python -v
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.9)
cmake_minimum_required(VERSION 3.17...3.31)

set(PROPOSAL_VERSION_MAJOR 7)
set(PROPOSAL_VERSION_MINOR 6)
Expand Down
39 changes: 33 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,35 @@
[build-system]
requires = [
"setuptools>=45",
"wheel",
"cmake>=3.16",
"conan>=2.0.0",
requires = ["scikit-build-core[pyproject]", "pybind11", "setuptools_scm[toml]"]
build-backend = "scikit_build_core.build"

[project]
name = "proposal"
version = "7.6.3"
description = "Python bindings for PROPOSAL"
readme = "README.md"
requires-python = ">= 3.9"
license = {text = "BSD-3-Clause"}
maintainers = [
{name = "Jean-Marco Alamedine", email = "jean-marco.alameddine@tu-dortmund.de"},
]

[project.urls]
repository = "https://github.com/tudo-astroparticlephysics/PROPOSAL"


[project.optional-dependencies]
tests = [
"pytest",
]

all = ["proposal[tests]"]


[tool.scikit-build]
sdist.cmake = true
build.targets = ["pyPROPOSAL"]
cmake.args = [
"-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON",
"-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON",
"-DBUILD_PYTHON=ON",
]
build-backend = "setuptools.build_meta"
24 changes: 0 additions & 24 deletions setup.cfg

This file was deleted.

130 changes: 0 additions & 130 deletions setup.py

This file was deleted.

7 changes: 7 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
include(GNUInstallDirs)

if(SKBUILD)
message(STATUS "SKBUILD")
set(CMAKE_INSTALL_LIBDIR ".")
set(CMAKE_INSTALL_INCLUDEDIR "proposal/include")
endif()
add_subdirectory(PROPOSAL)

if(BUILD_PYTHON)
Expand Down
7 changes: 4 additions & 3 deletions src/PROPOSAL/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include(GNUInstallDirs)

add_library(PROPOSAL)
add_library(PROPOSAL::PROPOSAL ALIAS PROPOSAL)

Expand Down Expand Up @@ -60,4 +58,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/PROPOSALConfig.cmake
)

file(GLOB CMAKE_FILES "${CMAKE_BINARY_DIR}/*.cmake")
install(FILES ${CMAKE_FILES} DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/PROPOSAL)
message(STATUS "CMAKE_FILES=${CMAKE_FILES}")
if(${CMAKE_FILES})
install(FILES ${CMAKE_FILES} DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/PROPOSAL)
endif()
7 changes: 3 additions & 4 deletions src/pyPROPOSAL/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
cmake_minimum_required(VERSION 3.9)
cmake_minimum_required(VERSION 3.17...3.31)

project(pyPROPOSAL LANGUAGES CXX)

find_package(Python COMPONENTS Interpreter Development REQUIRED)
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
find_package(pybind11 REQUIRED)


file(GLOB_RECURSE PYTHON_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cxx)
pybind11_add_module(pyPROPOSAL SHARED
${PYTHON_SRC_FILES})
pybind11_add_module(pyPROPOSAL MODULE ${PYTHON_SRC_FILES})

set_target_properties(pyPROPOSAL PROPERTIES
OUTPUT_NAME proposal)
Expand Down
Loading