Skip to content

Commit 6198a59

Browse files
committed
Merge remote-tracking branch 'app4triqs-remote/python_only' into unstable
# Conflicts: # .github/workflows/build.yml # CMakeLists.txt # Jenkinsfile # LICENSE.txt # README.md # doc/about.rst # doc/documentation.rst # doc/index.rst # packaging/CMakeLists.txt # python/app4triqs/CMakeLists.txt # python/app4triqs/__init__.py # share/cmake/CMakeLists.txt # test/python/Basic.py # test/python/CMakeLists.txt
2 parents dbb4c5c + 15092d8 commit 6198a59

33 files changed

Lines changed: 432 additions & 668 deletions

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.cxx linguist-generated
2+
*.hxx linguist-generated
3+
*.h5 linguist-generated
4+
*.dat linguist-generated

.github/workflows/build.yml

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,16 @@ jobs:
2525
strategy:
2626
fail-fast: false
2727
matrix:
28-
os: [ubuntu-24.04, macos-15]
29-
cxx: [g++, clang++]
28+
include:
29+
- { os: ubuntu-24.04, cxx: clang++-20 }
30+
- { os: ubuntu-24.04, cxx: g++-14 }
31+
- { os: macos-15, cxx: clang++ }
32+
- { os: macos-15, cxx: g++ }
3033

3134
runs-on: ${{ matrix.os }}
3235

3336
steps:
34-
- uses: actions/checkout@v4
37+
- uses: actions/checkout@v6
3538

3639
- uses: actions/cache/restore@v4
3740
with:
@@ -40,15 +43,7 @@ jobs:
4043
restore-keys: |
4144
ccache-${{ matrix.os }}-${{ matrix.cxx }}-
4245
43-
- name: Set cxx variables
44-
run: |
45-
if [[ ${{ matrix.os }} == 'macos-15' && ${{ matrix.cxx }} == 'g++' ]]; then
46-
echo "CXX=g++-15" >> $GITHUB_ENV
47-
else
48-
echo "CXX=${{ matrix.cxx }}" >> $GITHUB_ENV
49-
fi
50-
51-
- name: Install ubuntu dependencies
46+
- name: Set up Linux environment
5247
if: ${{ contains(matrix.os, 'ubuntu') }}
5348
run: >
5449
sudo apt-get update &&
@@ -57,16 +52,15 @@ jobs:
5752
ccache
5853
cmake
5954
ninja-build
60-
clang
61-
clang-tools
55+
clang-20
56+
clang-tools-20
6257
g++
6358
gfortran
6459
hdf5-tools
6560
libboost-dev
66-
libclang-dev
67-
libc++-dev
68-
libc++abi-dev
69-
libomp-dev
61+
libomp-20-dev
62+
libc++-20-dev
63+
libc++abi-20-dev
7064
libfftw3-dev
7165
libgfortran5
7266
libgmp-dev
@@ -77,48 +71,58 @@ jobs:
7771
openmpi-bin
7872
openmpi-common
7973
openmpi-doc
80-
python3-clang
8174
python3-dev
8275
python3-mako
8376
python3-matplotlib
8477
python3-mpi4py
8578
python3-numpy
8679
python3-pip
8780
python3-scipy
88-
python3-ipython
81+
python3-ipython &&
82+
echo "CXX=${{ matrix.cxx }}" >> $GITHUB_ENV
8983
90-
- name: Set up virtualenv
84+
- name: Set up Python venv
9185
run: |
92-
mkdir -p $HOME/.venv
86+
# --system-site-packages exposes apt- (Linux) / brew- (macOS) installed mpi4py/numpy/scipy
9387
python3 -m venv --system-site-packages $HOME/.venv/my_python
94-
source $HOME/.venv/my_python/bin/activate
95-
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
96-
echo "PATH=$PATH" >> $GITHUB_ENV
88+
echo "VIRTUAL_ENV=$HOME/.venv/my_python" >> $GITHUB_ENV
89+
echo "$HOME/.venv/my_python/bin" >> $GITHUB_PATH
9790
98-
- name: Install homebrew dependencies
91+
- name: Set up macOS environment
9992
if: ${{ contains(matrix.os, 'macos') }}
10093
run: |
10194
brew update
102-
brew install ccache gcc llvm boost fftw hdf5 open-mpi openblas gsl
95+
brew install ccache gcc llvm libomp boost fftw hdf5 open-mpi openblas gsl
96+
# Set CXX from the matrix; for gcc, resolve unversioned 'g++' to whatever g++-NN Homebrew installed
97+
CXX=${{ matrix.cxx }}
98+
if [[ $CXX == g++ ]]; then
99+
CXX=$(basename "$(ls $(brew --prefix)/bin/g++-* | sort -V | tail -1)")
100+
fi
101+
echo "CXX=$CXX" >> $GITHUB_ENV
103102
pip install mako numpy scipy mpi4py
104103
pip install -r requirements.txt
105104
echo "PATH=$(brew --prefix llvm)/bin:$(brew --prefix gcc)/bin:$PATH" >> $GITHUB_ENV
106105
echo "PYTHONPATH=$(brew --prefix llvm)/lib/python3.13/site-packages" >> $GITHUB_ENV
107106
echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV
108-
echo "LDFLAGS=-L$(brew --prefix llvm)/lib/c++ -L/opt/homebrew/opt/llvm/lib/unwind -lunwind" >> $GITHUB_ENV
107+
echo "CPPFLAGS=-I$(brew --prefix libomp)/include $CPPFLAGS" >> $GITHUB_ENV
108+
echo "LDFLAGS=-L$(brew --prefix libomp)/lib -L$(brew --prefix llvm)/lib/c++ -L/opt/homebrew/opt/llvm/lib/unwind -lunwind" >> $GITHUB_ENV
109109
echo "LAPACK_ROOT=$(brew --prefix openblas)" >> $GITHUB_ENV
110110
111111
- name: Add clang CXXFLAGS
112-
if: ${{ matrix.cxx == 'clang++' }}
112+
if: ${{ contains(matrix.cxx, 'clang') }}
113113
run: |
114114
echo "CXXFLAGS=-stdlib=libc++" >> $GITHUB_ENV
115115
116116
- name: Build & Install TRIQS
117117
env:
118118
TRIQS_BRANCH: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }}
119119
run: |
120+
git ls-remote --exit-code --heads https://github.com/TRIQS/triqs "$TRIQS_BRANCH" > /dev/null 2>&1 || TRIQS_BRANCH=unstable
120121
git clone https://github.com/TRIQS/triqs --branch "$TRIQS_BRANCH"
121-
cmake -S triqs -B triqs/build -G Ninja -DBuild_Tests=OFF -DCMAKE_INSTALL_PREFIX=$HOME/install
122+
cmake -S triqs -B triqs/build -G Ninja \
123+
-DPython_EXECUTABLE=$VIRTUAL_ENV/bin/python \
124+
-DBuild_Tests=OFF \
125+
-DCMAKE_INSTALL_PREFIX=$HOME/install
122126
cmake --build triqs/build --target install --verbose
123127
124128
- name: Build omegamaxent_interface
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- '[0-9]+.[0-9]+.[0-9]+'
7+
- '[0-9]+.[0-9]+.[0-9]+rc[0-9]+'
8+
9+
jobs:
10+
build:
11+
name: Build distribution 📦
12+
runs-on: ubuntu-latest
13+
container: # we have to provide a working triqs installation to make the cmake step work
14+
image: flatironinstitute/triqs:${{github.ref_name}}
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: "3.x"
22+
- name: Install pypa/build
23+
run: >-
24+
python3 -m
25+
pip install
26+
build toml
27+
--user
28+
- name: prepare python distribution
29+
run: |
30+
mkdir build && cd build
31+
cmake ../
32+
cp packaging/pypi/* ../
33+
mv python/omegamaxent_interface/version.py ../python/omegamaxent_interface/version.py
34+
rm ../python/omegamaxent_interface/version.py.in
35+
- name: Build a binary wheel and a source tarball
36+
run: python3 -m build
37+
- name: Store the distribution packages
38+
uses: actions/upload-artifact@v3
39+
with:
40+
name: python-package-distributions
41+
path: dist/
42+
43+
publish-to-pypi:
44+
name: Publish PyPI 🐍
45+
needs:
46+
- build
47+
runs-on: ubuntu-latest
48+
environment:
49+
name: pypi
50+
url: https://pypi.org/p/omegamaxent_interface
51+
permissions:
52+
id-token: write # IMPORTANT: mandatory for trusted publishing
53+
54+
steps:
55+
- name: Download all the dists
56+
uses: actions/download-artifact@v3
57+
with:
58+
name: python-package-distributions
59+
path: dist/
60+
- name: Publish distribution 📦 to PyPI
61+
uses: pypa/gh-action-pypi-publish@release/v1
62+
with:
63+
skip-existing: true # skip if version name package already exists on pypi
64+

CMakeLists.txt

Lines changed: 15 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#
2121
# ##############################################################################
2222

23-
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
23+
cmake_minimum_required(VERSION 3.22 FATAL_ERROR)
2424
cmake_policy(VERSION ${CMAKE_VERSION})
2525

2626
# ############
@@ -29,7 +29,7 @@ project(omegamaxent_interface VERSION 4.0.0 LANGUAGES CXX)
2929
get_directory_property(IS_SUBPROJECT PARENT_DIRECTORY)
3030

3131
# ############
32-
# Load TRIQS and CPP2PY
32+
# Load TRIQS
3333
find_package(TRIQS 4.0 REQUIRED)
3434

3535
# Get the git hash & print status
@@ -69,7 +69,7 @@ endif()
6969

7070
# Python Support
7171
if(NOT TRIQS_WITH_PYTHON_SUPPORT)
72-
message(FATAL_ERROR "TRIQS was installed without Python support. Cannot build the Python Interface. Disable the build with -DPythonSupport=OFF")
72+
message(FATAL_ERROR "TRIQS was installed without Python support. TRIQS Python support is required.")
7373
endif()
7474

7575
# Documentation
@@ -79,46 +79,19 @@ option(Build_Documentation "Build documentation" OFF)
7979
option(Build_Tests "Build tests" ON)
8080
if(Build_Tests)
8181
enable_testing()
82+
# When built as a dependency of a project configured with the LLVM sanitizers
83+
# (-DASAN/-DUBSAN), our Python tests load that project's instrumented TRIQS
84+
# libraries and need the sanitizer runtime preloaded. Locate it here so that
85+
# SANITIZER_RT_PRELOAD is populated before the test commands are registered.
86+
# No-op in a standalone build, where ASAN/UBSAN are unset.
87+
if(ASAN)
88+
find_package(sanitizer REQUIRED COMPONENTS asan)
89+
endif()
90+
if(UBSAN)
91+
find_package(sanitizer REQUIRED COMPONENTS ubsan)
92+
endif()
8293
endif()
8394

84-
# ############
85-
# Global Compilation Settings
86-
87-
# Build static libraries by default
88-
option(BUILD_SHARED_LIBS "Enable compilation of shared libraries" OFF)
89-
90-
# Export the list of compile-commands into compile_commands.json
91-
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
92-
93-
# Disable compiler extensions
94-
set(CMAKE_CXX_EXTENSIONS OFF)
95-
96-
# Provide additional debugging information for Debug builds
97-
add_compile_options($<$<CONFIG:Debug>:-ggdb3>)
98-
99-
# Create an Interface target for compiler warnings
100-
add_library(${PROJECT_NAME}_warnings INTERFACE)
101-
target_compile_options(${PROJECT_NAME}_warnings
102-
INTERFACE
103-
-Wall
104-
-Wextra
105-
-Wfloat-conversion
106-
-Wpedantic
107-
-Wno-sign-compare
108-
$<$<CXX_COMPILER_ID:GNU>:-Wno-comma-subscript>
109-
$<$<CXX_COMPILER_ID:GNU>:-Wno-psabi> # Disable notes about ABI changes
110-
$<$<CXX_COMPILER_ID:GNU>:-Wshadow=local>
111-
$<$<CXX_COMPILER_ID:GNU>:-Wno-attributes>
112-
$<$<CXX_COMPILER_ID:GNU>:-Wno-deprecated-declarations>
113-
$<$<CXX_COMPILER_ID:AppleClang,Clang,IntelLLVM>:-Wno-deprecated-comma-subscript>
114-
$<$<CXX_COMPILER_ID:AppleClang,Clang,IntelLLVM>:-Wno-unknown-warning-option>
115-
$<$<CXX_COMPILER_ID:AppleClang,Clang,IntelLLVM>:-Wshadow>
116-
$<$<CXX_COMPILER_ID:AppleClang,Clang,IntelLLVM>:-Wno-gcc-compat>
117-
$<$<CXX_COMPILER_ID:AppleClang,Clang,IntelLLVM>:-Wno-c++20-extensions>
118-
$<$<CXX_COMPILER_ID:AppleClang,Clang,IntelLLVM>:-Wno-c++20-compat>
119-
$<$<CXX_COMPILER_ID:IntelLLVM>:-Wno-tautological-constant-compare>
120-
)
121-
12295
# Provide GNU Installation directories
12396
include(GNUInstallDirs)
12497

@@ -153,7 +126,7 @@ endif()
153126
# Additional configuration files
154127
add_subdirectory(share)
155128

156-
# add packaging for automatic Versioning
129+
# add packaging for automatic versioning
157130
add_subdirectory(packaging)
158131

159132
# #############

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ ARG APPNAME=omegamaxent_interface
55
RUN apt-get install -y libgsl-dev || yum install -y gsl-devel
66

77
COPY --chown=build . $SRC/$APPNAME
8-
WORKDIR $BUILD/$APPNAME
9-
RUN chown build .
10-
USER build
8+
RUN mkdir $BUILD/$APPNAME && chown build $BUILD/$APPNAME
9+
1110
ARG BUILD_ID
1211
ARG CMAKE_ARGS
12+
USER build
13+
WORKDIR $BUILD/$APPNAME
1314
RUN cmake $SRC/$APPNAME -DTRIQS_ROOT=${INSTALL} $CMAKE_ARGS && make -j4 || make -j1 VERBOSE=1
1415
USER root
1516
RUN make install

Jenkinsfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ def dockerName = projectName.toLowerCase();
44
/* which platform to build documentation on */
55
def documentationPlatform = "ubuntu-clang"
66
/* depend on triqs upstream branch/project */
7-
def triqsBranch = env.CHANGE_TARGET ?: env.BRANCH_NAME
7+
def triqsBranch = "unstable"
88
def triqsProject = '/TRIQS/triqs/' + triqsBranch.replaceAll('/', '%2F')
99
/* whether to keep and publish the results */
1010
def keepInstall = !env.BRANCH_NAME.startsWith("PR-")
@@ -41,9 +41,9 @@ for (int i = 0; i < dockerPlatforms.size(); i++) {
4141
/* build and tag */
4242
def args = ''
4343
if (platform == documentationPlatform)
44-
args = '-DBuild_Documentation=1'
44+
args += ' -DBuild_Documentation=ON'
4545
else if (platform == "sanitize")
46-
args = '-DASAN=ON -DUBSAN=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo'
46+
args += ' -DASAN=ON -DUBSAN=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo'
4747
def img = docker.build("flatironjenkins/${dockerName}:${env.BRANCH_NAME}-${env.STAGE_NAME}", "--build-arg APPNAME=${projectName} --build-arg BUILD_ID=${env.BUILD_TAG} --build-arg CMAKE_ARGS='${args}' .")
4848
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
4949
img.inside("--shm-size=4gb") {

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
omegamaxent_interface - An example application using triqs and cpp2py
1+
omegamaxent_interface - An example application using triqs
22

33
Copyright (C) 2017-2018, N. Wentzell, O. Parcollet
44
Copyright (C) 2018-2019, The Simons Foundation

deps/CMakeLists.txt

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,3 @@ else()
4646
message(WARNING "For builds with llvm sanitizers (ASAN/UBSAN) it is recommended to use -DBuild_Deps=Always to avoid false positives.")
4747
endif()
4848
endif()
49-
50-
# -- Cpp2Py --
51-
if(PythonSupport OR (NOT IS_SUBPROJECT AND Build_Documentation))
52-
external_dependency(Cpp2Py
53-
GIT_REPO https://github.com/TRIQS/cpp2py
54-
VERSION 3.3
55-
GIT_TAG main
56-
BUILD_ALWAYS
57-
EXCLUDE_FROM_ALL
58-
)
59-
endif()
60-
61-
# -- GTest --
62-
external_dependency(GTest
63-
GIT_REPO https://github.com/google/googletest
64-
GIT_TAG main
65-
BUILD_ALWAYS
66-
EXCLUDE_FROM_ALL
67-
)

doc/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# Fail early if a doc dependency is missing (import names, not distribution names)
2+
find_package(Python COMPONENTS Interpreter REQUIRED)
3+
4+
foreach(_module numpydoc nbsphinx myst_parser linkify_it sphinx_rtd_theme matplotlib)
5+
execute_process(
6+
COMMAND ${Python_EXECUTABLE} -c "import ${_module}"
7+
RESULT_VARIABLE _rc OUTPUT_QUIET ERROR_QUIET)
8+
if(_rc)
9+
message(FATAL_ERROR "Building the documentation requires the python module '${_module}' (see requirements.txt).")
10+
endif()
11+
endforeach()
12+
113
# Generate the sphinx config file
214
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/conf.py @ONLY)
315

doc/ChangeLog.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
(changelog)=
2-
31
# Changelog
42

53
## Version 3.3.0

0 commit comments

Comments
 (0)