From 8a2c03b7975127377438208cc18cfdee2a301efc Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Fri, 8 May 2026 17:59:07 +0200 Subject: [PATCH 01/36] Added readme_cpp and CMakeLists changes --- .github/workflows/readme_listings.yml | 29 +++++++++++++++++++- CMakeLists.txt | 17 ++++++++---- readme_cpp/CMakeLists.txt | 38 +++++++++++++++++++++++++++ readme_cpp/test.cpp | 7 +++++ 4 files changed, 85 insertions(+), 6 deletions(-) create mode 100644 readme_cpp/CMakeLists.txt create mode 100644 readme_cpp/test.cpp diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index d4a3d13a..5331549e 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -97,7 +97,7 @@ jobs: assert: runs-on: ubuntu-latest - needs: [julia, python, matlab, fortran] + needs: [julia, python, matlab, fortran, cpp] steps: - uses: actions/setup-python@v2 - run: pip install numpy @@ -107,6 +107,33 @@ jobs: merge-multiple: true path: readme_output - run : python -c 'import numpy as np; import os; dir="readme_output/"; data=[float(np.loadtxt(dir+file)) for file in os.listdir(dir)]; print("data:", data); similar_as_first = np.array([abs(data[0]-k)/data[0] for k in data[1:]]); print("similar_as_first", similar_as_first); assert((similar_as_first < .5).all())' + + cpp: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, ubuntu-24.04-arm, macos-15, macos-15-intel, windows-latest] + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + + - uses: actions/setup-python@v1 + with: + python-version: "3.10" + + - uses: jwlawson/actions-setup-cmake@v1.13 + with: + cmake-version: '3.26.x' + + - run: pip install . + - run: | + cd readme_cpp + mkdir build + cd build + cmake .. + make matlab: runs-on: ubuntu-22.04 diff --git a/CMakeLists.txt b/CMakeLists.txt index d6282368..b7d0f8c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -293,7 +293,7 @@ function(scoped_sundials_setup_config) file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/sundials) execute_process( - COMMAND ${PYTHON_EXECUTABLE} "-c" "import sys; print(''.join([line for line in sys.stdin if line.startswith('set(PACKAGE_VERSION_')]))" + COMMAND ${Python_EXECUTABLE} "-c" "import sys; print(''.join([line for line in sys.stdin if line.startswith('set(PACKAGE_VERSION_')]))" INPUT_FILE ${CMAKE_SOURCE_DIR}/gitmodules/sundials/CMakeLists.txt OUTPUT_FILE ${CMAKE_BINARY_DIR}/sundials/CMakeLists.txt ) @@ -339,7 +339,7 @@ target_include_directories(camplib PRIVATE ) file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/include/camp) execute_process( - COMMAND ${PYTHON_EXECUTABLE} "-c" "import sys; print(''.join([line.replace(')','').replace('set(','#define ').replace('PACKAGE_', 'CAMP_') for line in sys.stdin if line.startswith('set(PACKAGE_VERSION')]))" + COMMAND ${Python_EXECUTABLE} "-c" "import sys; print(''.join([line.replace(')','').replace('set(','#define ').replace('PACKAGE_', 'CAMP_') for line in sys.stdin if line.startswith('set(PACKAGE_VERSION')]))" INPUT_FILE ${CMAKE_SOURCE_DIR}/gitmodules/camp/CMakeLists.txt OUTPUT_FILE ${CMAKE_BINARY_DIR}/include/camp/version.h ) @@ -366,7 +366,7 @@ endif() foreach(file ${hdf5_GENERATED_HEADERS}) execute_process( - COMMAND ${PYTHON_EXECUTABLE} "-c" "import re;open(1,'wb').write(re.sub(b'\\r',b'',open(0,'rb').read()))" + COMMAND ${Python_EXECUTABLE} "-c" "import re;open(1,'wb').write(re.sub(b'\\r',b'',open(0,'rb').read()))" INPUT_FILE ${CMAKE_SOURCE_DIR}/${file} OUTPUT_FILE ${CMAKE_BINARY_DIR}/${file} ) @@ -391,7 +391,7 @@ string(CONCAT cmd ) include(CheckFunctionExists) execute_process( - COMMAND ${PYTHON_EXECUTABLE} "-c" "${cmd}" + COMMAND ${Python_EXECUTABLE} "-c" "${cmd}" INPUT_FILE ${CMAKE_SOURCE_DIR}/gitmodules/netcdf-c/CMakeLists.txt OUTPUT_FILE ${CMAKE_BINARY_DIR}/netcdf/CMakeLists.txt ) @@ -516,7 +516,7 @@ string(CONCAT include(CheckFunctionExists) foreach(file aero_data;gas_data;output) execute_process( - COMMAND ${PYTHON_EXECUTABLE} "-c" "${cmd}" + COMMAND ${Python_EXECUTABLE} "-c" "${cmd}" INPUT_FILE ${CMAKE_SOURCE_DIR}/gitmodules/partmc/src/${file}.F90 OUTPUT_FILE ${CMAKE_BINARY_DIR}/include/${file}_parameters.hpp ) @@ -627,3 +627,10 @@ foreach(file ${PyPartMC_headers}) endforeach() _install(TARGETS _PyPartMC LIBRARY DESTINATION PyPartMC) + +# for C++ users who wish to link against the PyPartMC shared library +_install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/ + DESTINATION PyPartMC/include + FILES_MATCHING PATTERN "*.hpp" +) diff --git a/readme_cpp/CMakeLists.txt b/readme_cpp/CMakeLists.txt new file mode 100644 index 00000000..4ffc5510 --- /dev/null +++ b/readme_cpp/CMakeLists.txt @@ -0,0 +1,38 @@ +cmake_minimum_required(VERSION 3.22) +project(PyPartMC_CXX LANGUAGES CXX) + +find_package(Python 3.8 REQUIRED COMPONENTS Interpreter) +message(STATUS "Python_EXECUTABLE= ${Python_EXECUTABLE}") + +execute_process( + COMMAND ${Python_EXECUTABLE} -c "from pathlib import Path; import PyPartMC; print(f'{Path(PyPartMC.__file__).parent}/include')" + OUTPUT_VARIABLE PYPARTMC_INCLUDE_DIRS + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +message(STATUS "PYPARTMC_INCLUDE_DIRS= ${PYPARTMC_INCLUDE_DIRS}") + +execute_process( + COMMAND ${Python_EXECUTABLE} -c "from PyPartMC import _PyPartMC; print(f'{_PyPartMC.__file__}')" + OUTPUT_VARIABLE PYPARTMC_LIB + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE res +) +if(res) + message(FATAL_ERROR "Command failed with exit code ${res}") +endif() + +message(STATUS "PYPARTMC_LIB= ${PYPARTMC_LIB}") + + +add_executable(my_test test.cpp) +target_include_directories(my_test PUBLIC + ${PYPARTMC_INCLUDE_DIRS} + # ${Python_INCLUDE_DIRS} + RESULT_VARIABLE res +) +if(res) + message(FATAL_ERROR "Command failed with exit code ${res}") +endif() + +target_link_libraries(my_test PRIVATE PYPARTMC_LIB) \ No newline at end of file diff --git a/readme_cpp/test.cpp b/readme_cpp/test.cpp new file mode 100644 index 00000000..49468bc7 --- /dev/null +++ b/readme_cpp/test.cpp @@ -0,0 +1,7 @@ +#include "bin_grid.hpp" +#include + +int main(){ + BinGrid a; + std::cout << "Success\n"; +} \ No newline at end of file From 51e8928c1a147ce506beb7e427b0e50bb49c0f06 Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 13 May 2026 11:51:37 +0200 Subject: [PATCH 02/36] Fortran compilator for windows/mac, turned off some .yml files --- .../workflows/{forlint.yml => forlint.yml.off} | 0 .github/workflows/{pylint.yml => pylint.yml.off} | 0 .github/workflows/readme_listings.yml | 16 +++++++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) rename .github/workflows/{forlint.yml => forlint.yml.off} (100%) rename .github/workflows/{pylint.yml => pylint.yml.off} (100%) diff --git a/.github/workflows/forlint.yml b/.github/workflows/forlint.yml.off similarity index 100% rename from .github/workflows/forlint.yml rename to .github/workflows/forlint.yml.off diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml.off similarity index 100% rename from .github/workflows/pylint.yml rename to .github/workflows/pylint.yml.off diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index 5331549e..3c05e43f 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -121,12 +121,26 @@ jobs: - uses: actions/setup-python@v1 with: - python-version: "3.10" + python-version: "3.12" - uses: jwlawson/actions-setup-cmake@v1.13 with: cmake-version: '3.26.x' + - if: matrix.os == 'windows-latest' + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: false + install: >- + mingw-w64-x86_64-gcc-fortran + mingw-w64-x86_64-ninja + m4 + + - if: startsWith(matrix.os, 'macos-') + run: | + brew reinstall gcc + - run: pip install . - run: | cd readme_cpp From 90d0eda03cf4b521432e68ef282479e2646de06f Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 13 May 2026 12:26:44 +0200 Subject: [PATCH 03/36] Added env var for fortran to readme_listings, .yml files on pull to off. --- .github/workflows/{buildwheels.yml => buildwheels.yml.off} | 0 .github/workflows/{codecov.yml => codecov.yml.off} | 0 .github/workflows/{conda.yml => conda.yml.off} | 0 .github/workflows/{pdoc.yml => pdoc.yml.off} | 0 .github/workflows/readme_listings.yml | 5 ++++- .github/workflows/{urlcheck.yml => urlcheck.yml.off} | 0 6 files changed, 4 insertions(+), 1 deletion(-) rename .github/workflows/{buildwheels.yml => buildwheels.yml.off} (100%) rename .github/workflows/{codecov.yml => codecov.yml.off} (100%) rename .github/workflows/{conda.yml => conda.yml.off} (100%) rename .github/workflows/{pdoc.yml => pdoc.yml.off} (100%) rename .github/workflows/{urlcheck.yml => urlcheck.yml.off} (100%) diff --git a/.github/workflows/buildwheels.yml b/.github/workflows/buildwheels.yml.off similarity index 100% rename from .github/workflows/buildwheels.yml rename to .github/workflows/buildwheels.yml.off diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml.off similarity index 100% rename from .github/workflows/codecov.yml rename to .github/workflows/codecov.yml.off diff --git a/.github/workflows/conda.yml b/.github/workflows/conda.yml.off similarity index 100% rename from .github/workflows/conda.yml rename to .github/workflows/conda.yml.off diff --git a/.github/workflows/pdoc.yml b/.github/workflows/pdoc.yml.off similarity index 100% rename from .github/workflows/pdoc.yml rename to .github/workflows/pdoc.yml.off diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index 3b3e700f..bdfde325 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -126,7 +126,10 @@ jobs: - uses: jwlawson/actions-setup-cmake@v1.13 with: cmake-version: '3.26.x' - + + - if: matrix.os == 'windows-latest' + run: echo "CMAKE_PROGRAM_PATH=D:/a/_temp/msys64/usr/bin" >> $GITHUB_ENV + - if: matrix.os == 'windows-latest' uses: msys2/setup-msys2@v2 with: diff --git a/.github/workflows/urlcheck.yml b/.github/workflows/urlcheck.yml.off similarity index 100% rename from .github/workflows/urlcheck.yml rename to .github/workflows/urlcheck.yml.off From 9ff610c89a079d4a51351893cc27104e234baafe Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 13 May 2026 12:30:06 +0200 Subject: [PATCH 04/36] python-setup@v1 to @v6 --- .github/workflows/readme_listings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index bdfde325..cc77ebc2 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -119,7 +119,7 @@ jobs: with: submodules: recursive - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v6 with: python-version: "3.12" From e84277623af22f92cb2b38ab1cef87ddae5e7820 Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Wed, 13 May 2026 12:41:01 +0200 Subject: [PATCH 05/36] fix CMake setup for Windows builds Updated environment variables for CMake on Windows. --- .github/workflows/readme_listings.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index cc77ebc2..3e56142e 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -128,8 +128,12 @@ jobs: cmake-version: '3.26.x' - if: matrix.os == 'windows-latest' - run: echo "CMAKE_PROGRAM_PATH=D:/a/_temp/msys64/usr/bin" >> $GITHUB_ENV - + run: | + echo CMAKE_ARGS="-DCMAKE_MAKE_PROGRAM=D:/a/_temp/msys64/mingw64/bin/ninja.exe" >> $GITHUB_ENV + echo CMAKE_PROGRAM_PATH="D:/a/_temp/msys64/usr/bin" >> $GITHUB_ENV + echo CMAKE_GENERATOR="Ninja" >> $GITHUB_ENV + echo TEMP="D:/a/_temp/" >> $GITHUB_ENV + - if: matrix.os == 'windows-latest' uses: msys2/setup-msys2@v2 with: From 91654d6b23d1d6ba01baa141392548c9c34fc4dd Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Mon, 18 May 2026 22:03:57 +0200 Subject: [PATCH 06/36] Linked nanobind to CMakeLists in readme_cpp, some test changes to CMakeLists in main directory for windows compatibility --- CMakeLists.txt | 8 ++++++++ readme_cpp/CMakeLists.txt | 41 ++++++++++++++++++++++++++++----------- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7d0f8c7..eb87d645 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -629,6 +629,14 @@ endforeach() _install(TARGETS _PyPartMC LIBRARY DESTINATION PyPartMC) # for C++ users who wish to link against the PyPartMC shared library +set_target_properties(_PyPartMC PROPERTIES CXX_VISIBILITY_PRESET default C_VISIBILITY_PRESET default) + +set_target_properties(_PyPartMC PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) + +if(WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + target_link_options(_PyPartMC PRIVATE -Wl,--export-all-symbols) +endif() + _install( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/ DESTINATION PyPartMC/include diff --git a/readme_cpp/CMakeLists.txt b/readme_cpp/CMakeLists.txt index 4ffc5510..3db16f41 100644 --- a/readme_cpp/CMakeLists.txt +++ b/readme_cpp/CMakeLists.txt @@ -1,38 +1,57 @@ cmake_minimum_required(VERSION 3.22) project(PyPartMC_CXX LANGUAGES CXX) -find_package(Python 3.8 REQUIRED COMPONENTS Interpreter) +find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development) message(STATUS "Python_EXECUTABLE= ${Python_EXECUTABLE}") execute_process( COMMAND ${Python_EXECUTABLE} -c "from pathlib import Path; import PyPartMC; print(f'{Path(PyPartMC.__file__).parent}/include')" OUTPUT_VARIABLE PYPARTMC_INCLUDE_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE res_inc ) +if(res_inc) + message(FATAL_ERROR "Failed to find PyPartMC include directory. Exit code: ${res_inc}") +endif() message(STATUS "PYPARTMC_INCLUDE_DIRS= ${PYPARTMC_INCLUDE_DIRS}") +execute_process( + COMMAND ${Python_EXECUTABLE} -c "import nanobind; print(nanobind.include_dir())" + OUTPUT_VARIABLE NANOBIND_INCLUDE_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE res_nano +) +if(res_nano) + message(FATAL_ERROR "Failed to find nanobind include directory. Exit code: ${res_nano}") +endif() +message(STATUS "NANOBIND_INCLUDE_DIR= ${NANOBIND_INCLUDE_DIR}") + +# 2. Get the Library File execute_process( COMMAND ${Python_EXECUTABLE} -c "from PyPartMC import _PyPartMC; print(f'{_PyPartMC.__file__}')" OUTPUT_VARIABLE PYPARTMC_LIB OUTPUT_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE res + RESULT_VARIABLE res_lib ) -if(res) - message(FATAL_ERROR "Command failed with exit code ${res}") +if(res_lib) + message(FATAL_ERROR "Failed to find PyPartMC library. Exit code: ${res_lib}") endif() message(STATUS "PYPARTMC_LIB= ${PYPARTMC_LIB}") - add_executable(my_test test.cpp) + target_include_directories(my_test PUBLIC ${PYPARTMC_INCLUDE_DIRS} - # ${Python_INCLUDE_DIRS} - RESULT_VARIABLE res + ${NANOBIND_INCLUDE_DIR} + ${Python_INCLUDE_DIRS} ) -if(res) - message(FATAL_ERROR "Command failed with exit code ${res}") -endif() -target_link_libraries(my_test PRIVATE PYPARTMC_LIB) \ No newline at end of file +target_link_libraries(my_test PRIVATE ${PYPARTMC_LIB}) + +add_custom_command(TARGET my_test POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${PYPARTMC_LIB} + $ +) \ No newline at end of file From 6e4c6098deb8636283d8c9f553160c9b2defb23a Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Mon, 18 May 2026 22:29:21 +0200 Subject: [PATCH 07/36] Attempted to fix cross platform linking, forced C++17 standard in readme_cpp CMakeLists, make > cmake --build . in readme_listings.yml --- .github/workflows/readme_listings.yml | 12 +++++++++++- readme_cpp/CMakeLists.txt | 13 +++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index 3e56142e..132ced35 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -127,6 +127,16 @@ jobs: with: cmake-version: '3.26.x' + - if: matrix.os != 'ubuntu-24.04-arm' + uses: jwlawson/actions-setup-cmake@v1.13 + with: + cmake-version: '3.26.x' + + - if: matrix.os == 'ubuntu-24.04-arm' + run: | + sudo apt-get update + sudo apt-get install -y cmake + - if: matrix.os == 'windows-latest' run: | echo CMAKE_ARGS="-DCMAKE_MAKE_PROGRAM=D:/a/_temp/msys64/mingw64/bin/ninja.exe" >> $GITHUB_ENV @@ -154,7 +164,7 @@ jobs: mkdir build cd build cmake .. - make + cmake --build . matlab: runs-on: ubuntu-22.04 diff --git a/readme_cpp/CMakeLists.txt b/readme_cpp/CMakeLists.txt index 3db16f41..02176ace 100644 --- a/readme_cpp/CMakeLists.txt +++ b/readme_cpp/CMakeLists.txt @@ -1,6 +1,9 @@ cmake_minimum_required(VERSION 3.22) project(PyPartMC_CXX LANGUAGES CXX) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED YES) + find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development) message(STATUS "Python_EXECUTABLE= ${Python_EXECUTABLE}") @@ -27,7 +30,6 @@ if(res_nano) endif() message(STATUS "NANOBIND_INCLUDE_DIR= ${NANOBIND_INCLUDE_DIR}") -# 2. Get the Library File execute_process( COMMAND ${Python_EXECUTABLE} -c "from PyPartMC import _PyPartMC; print(f'{_PyPartMC.__file__}')" OUTPUT_VARIABLE PYPARTMC_LIB @@ -48,7 +50,14 @@ target_include_directories(my_test PUBLIC ${Python_INCLUDE_DIRS} ) -target_link_libraries(my_test PRIVATE ${PYPARTMC_LIB}) +add_library(PyPartMC_ext SHARED IMPORTED) +set_target_properties(PyPartMC_ext PROPERTIES IMPORTED_LOCATION "${PYPARTMC_LIB}") + +# Link against the imported target, NOT the raw variable +target_link_libraries(my_test PRIVATE + PyPartMC_ext + ${Python_LIBRARIES} +) add_custom_command(TARGET my_test POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different From a8b1b936a3a79ab6f9fb33ac7160d77dae8b95e0 Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Mon, 18 May 2026 23:18:47 +0200 Subject: [PATCH 08/36] Add library shared -> unknown in readme_cpp CMakeLists, to fix compilation issue on windows --- readme_cpp/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme_cpp/CMakeLists.txt b/readme_cpp/CMakeLists.txt index 02176ace..ff3ac984 100644 --- a/readme_cpp/CMakeLists.txt +++ b/readme_cpp/CMakeLists.txt @@ -50,7 +50,7 @@ target_include_directories(my_test PUBLIC ${Python_INCLUDE_DIRS} ) -add_library(PyPartMC_ext SHARED IMPORTED) +add_library(PyPartMC_ext UNKNOWN IMPORTED) set_target_properties(PyPartMC_ext PROPERTIES IMPORTED_LOCATION "${PYPARTMC_LIB}") # Link against the imported target, NOT the raw variable From 99956a4befa2b7dfb72bd801c3b48b291ae95db6 Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 20 May 2026 11:39:25 +0200 Subject: [PATCH 09/36] update cmake version in CI/CD --- .github/workflows/readme_listings.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index 132ced35..b5619ba0 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -123,19 +123,19 @@ jobs: with: python-version: "3.12" - - uses: jwlawson/actions-setup-cmake@v1.13 + - uses: jwlawson/actions-setup-cmake@v2.20 with: cmake-version: '3.26.x' - - if: matrix.os != 'ubuntu-24.04-arm' - uses: jwlawson/actions-setup-cmake@v1.13 - with: - cmake-version: '3.26.x' - - - if: matrix.os == 'ubuntu-24.04-arm' - run: | - sudo apt-get update - sudo apt-get install -y cmake + # - if: matrix.os != 'ubuntu-24.04-arm' + # uses: jwlawson/actions-setup-cmake@v1.13 + # with: + # cmake-version: '3.26.x' + + # - if: matrix.os == 'ubuntu-24.04-arm' + # run: | + # sudo apt-get update + # sudo apt-get install -y cmake - if: matrix.os == 'windows-latest' run: | From 1fa6808f3bf4440ee8734ba06fd82ab264ac5124 Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 20 May 2026 12:00:18 +0200 Subject: [PATCH 10/36] Corrected cmake version typo, and added ctest --- .github/workflows/readme_listings.yml | 3 ++- readme_cpp/CMakeLists.txt | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index b5619ba0..ee0d82f7 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -123,7 +123,7 @@ jobs: with: python-version: "3.12" - - uses: jwlawson/actions-setup-cmake@v2.20 + - uses: jwlawson/actions-setup-cmake@v2.2.0 with: cmake-version: '3.26.x' @@ -165,6 +165,7 @@ jobs: cd build cmake .. cmake --build . + - run: ctest --output-on-failure matlab: runs-on: ubuntu-22.04 diff --git a/readme_cpp/CMakeLists.txt b/readme_cpp/CMakeLists.txt index ff3ac984..c11c7c0e 100644 --- a/readme_cpp/CMakeLists.txt +++ b/readme_cpp/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.22) project(PyPartMC_CXX LANGUAGES CXX) +enable_testing() + set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) @@ -59,8 +61,12 @@ target_link_libraries(my_test PRIVATE ${Python_LIBRARIES} ) +# Copying .pyd file add_custom_command(TARGET my_test POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${PYPARTMC_LIB} $ -) \ No newline at end of file +) + +add_test(NAME maketest + COMMAND my_test) \ No newline at end of file From 1667789eb03d304099ca81bc3e9d92916eae3622 Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 20 May 2026 12:23:19 +0200 Subject: [PATCH 11/36] Moved to correct directory before running tests --- .github/workflows/readme_listings.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index ee0d82f7..13c33a96 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -165,7 +165,10 @@ jobs: cd build cmake .. cmake --build . - - run: ctest --output-on-failure + - run: | + cd readme_cpp + cd build + ctest --output-on-failure matlab: runs-on: ubuntu-22.04 From f092840630f8169dfd32344c2260021623c92060 Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 20 May 2026 17:50:18 +0200 Subject: [PATCH 12/36] Testing if conditionally applying SHARED module type to nanobind on macos would fix compilation problems without the need to generate static libraries --- CMakeLists.txt | 13 ++++++++++++- readme_cpp/CMakeLists.txt | 17 +++++++++-------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eb87d645..50759e3c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -546,7 +546,13 @@ endif() find_package(nanobind CONFIG REQUIRED) add_subdirectory(gitmodules/nanobind) -nanobind_add_module(_PyPartMC STABLE_ABI ${PyPartMC_sources}) +if(APPLE) + set(PYPARTMC_MODULE_TYPE SHARED) +else() + set(PYPARTMC_MODULE_TYPE MODULE) +endif() + +nanobind_add_module(_PyPartMC ${PYPARTMC_MODULE_TYPE} STABLE_ABI ${PyPartMC_sources}) add_dependencies(_PyPartMC partmclib) set(PYPARTMC_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/include;" @@ -642,3 +648,8 @@ _install( DESTINATION PyPartMC/include FILES_MATCHING PATTERN "*.hpp" ) + +_install(TARGETS partmclib + ARCHIVE DESTINATION PyPartMC/lib +) + diff --git a/readme_cpp/CMakeLists.txt b/readme_cpp/CMakeLists.txt index c11c7c0e..647d7670 100644 --- a/readme_cpp/CMakeLists.txt +++ b/readme_cpp/CMakeLists.txt @@ -10,16 +10,16 @@ find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development) message(STATUS "Python_EXECUTABLE= ${Python_EXECUTABLE}") execute_process( - COMMAND ${Python_EXECUTABLE} -c "from pathlib import Path; import PyPartMC; print(f'{Path(PyPartMC.__file__).parent}/include')" - OUTPUT_VARIABLE PYPARTMC_INCLUDE_DIRS + COMMAND ${Python_EXECUTABLE} -c "from pathlib import Path; import PyPartMC; print(f'{Path(PyPartMC.__file__).parent}')" + OUTPUT_VARIABLE PYPARTMC_DIR OUTPUT_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE res_inc + RESULT_VARIABLE res ) -if(res_inc) - message(FATAL_ERROR "Failed to find PyPartMC include directory. Exit code: ${res_inc}") +if(res) + message(FATAL_ERROR "Failed to find PyPartMC directory. Exit code: ${res}") endif() -message(STATUS "PYPARTMC_INCLUDE_DIRS= ${PYPARTMC_INCLUDE_DIRS}") +message(STATUS "PYPARTMC_DIR= ${PYPARTMC_DIR}") execute_process( COMMAND ${Python_EXECUTABLE} -c "import nanobind; print(nanobind.include_dir())" @@ -47,7 +47,7 @@ message(STATUS "PYPARTMC_LIB= ${PYPARTMC_LIB}") add_executable(my_test test.cpp) target_include_directories(my_test PUBLIC - ${PYPARTMC_INCLUDE_DIRS} + ${PYPARTMC_DIR}/include ${NANOBIND_INCLUDE_DIR} ${Python_INCLUDE_DIRS} ) @@ -57,7 +57,8 @@ set_target_properties(PyPartMC_ext PROPERTIES IMPORTED_LOCATION "${PYPARTMC_LIB} # Link against the imported target, NOT the raw variable target_link_libraries(my_test PRIVATE - PyPartMC_ext + PyPartMC_ext + ${PYPARTMC_DIR}/lib/libpartmclib.a ${Python_LIBRARIES} ) From cc5b27c305150d429cf8f3c446b9c9846838f50f Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 20 May 2026 18:04:41 +0200 Subject: [PATCH 13/36] Re-enabling .yml files, adding names to run instructions in cpp tests in readme_listings --- .../{buildwheels.yml.off => buildwheels.yml} | 0 .../workflows/{codecov.yml.off => codecov.yml} | 0 .github/workflows/{conda.yml.off => conda.yml} | 0 .../workflows/{forlint.yml.off => forlint.yml} | 0 .github/workflows/{pdoc.yml.off => pdoc.yml} | 0 .github/workflows/{pylint.yml.off => pylint.yml} | 0 .github/workflows/readme_listings.yml | 16 ++++------------ 7 files changed, 4 insertions(+), 12 deletions(-) rename .github/workflows/{buildwheels.yml.off => buildwheels.yml} (100%) rename .github/workflows/{codecov.yml.off => codecov.yml} (100%) rename .github/workflows/{conda.yml.off => conda.yml} (100%) rename .github/workflows/{forlint.yml.off => forlint.yml} (100%) rename .github/workflows/{pdoc.yml.off => pdoc.yml} (100%) rename .github/workflows/{pylint.yml.off => pylint.yml} (100%) diff --git a/.github/workflows/buildwheels.yml.off b/.github/workflows/buildwheels.yml similarity index 100% rename from .github/workflows/buildwheels.yml.off rename to .github/workflows/buildwheels.yml diff --git a/.github/workflows/codecov.yml.off b/.github/workflows/codecov.yml similarity index 100% rename from .github/workflows/codecov.yml.off rename to .github/workflows/codecov.yml diff --git a/.github/workflows/conda.yml.off b/.github/workflows/conda.yml similarity index 100% rename from .github/workflows/conda.yml.off rename to .github/workflows/conda.yml diff --git a/.github/workflows/forlint.yml.off b/.github/workflows/forlint.yml similarity index 100% rename from .github/workflows/forlint.yml.off rename to .github/workflows/forlint.yml diff --git a/.github/workflows/pdoc.yml.off b/.github/workflows/pdoc.yml similarity index 100% rename from .github/workflows/pdoc.yml.off rename to .github/workflows/pdoc.yml diff --git a/.github/workflows/pylint.yml.off b/.github/workflows/pylint.yml similarity index 100% rename from .github/workflows/pylint.yml.off rename to .github/workflows/pylint.yml diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index 13c33a96..63dedfb7 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -126,16 +126,6 @@ jobs: - uses: jwlawson/actions-setup-cmake@v2.2.0 with: cmake-version: '3.26.x' - - # - if: matrix.os != 'ubuntu-24.04-arm' - # uses: jwlawson/actions-setup-cmake@v1.13 - # with: - # cmake-version: '3.26.x' - - # - if: matrix.os == 'ubuntu-24.04-arm' - # run: | - # sudo apt-get update - # sudo apt-get install -y cmake - if: matrix.os == 'windows-latest' run: | @@ -159,13 +149,15 @@ jobs: brew reinstall gcc - run: pip install . - - run: | + - name: build + run: | cd readme_cpp mkdir build cd build cmake .. cmake --build . - - run: | + - name: Execute tests + run: | cd readme_cpp cd build ctest --output-on-failure From 010416ee84f379be69a5ff1e07a690a646004a64 Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 10 Jun 2026 02:58:08 +0200 Subject: [PATCH 14/36] Added #pragma_once to input_guard.hpp, corrected si.hpp generation, implemented PyPartMC.hpp generation for all .hpp libraries, changed paths CMakeLists.txt in readme_cpp uses to pull libraries, finished test.cpp --- CMakeLists.txt | 64 ++++++++++++++++++++++++++++++++++- readme_cpp/CMakeLists.txt | 5 ++- readme_cpp/test.cpp | 55 +++++++++++++++++++++++++++--- src/PyPartMC/__generate_si.py | 36 ++++++++++++++++++++ src/input_guard.hpp | 2 ++ 5 files changed, 155 insertions(+), 7 deletions(-) create mode 100644 src/PyPartMC/__generate_si.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 50759e3c..0f16172c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -520,6 +520,11 @@ foreach(file aero_data;gas_data;output) INPUT_FILE ${CMAKE_SOURCE_DIR}/gitmodules/partmc/src/${file}.F90 OUTPUT_FILE ${CMAKE_BINARY_DIR}/include/${file}_parameters.hpp ) + + _install( + FILES ${CMAKE_BINARY_DIR}/include/${file}_parameters.hpp + DESTINATION PyPartMC/include/ + ) endforeach() target_include_directories(partmclib PRIVATE @@ -645,11 +650,68 @@ endif() _install( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/ - DESTINATION PyPartMC/include + DESTINATION PyPartMC/include/PyPartMC FILES_MATCHING PATTERN "*.hpp" ) +_install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/ + DESTINATION PyPartMC/include/PyPartMC + FILES_MATCHING PATTERN "*.hpp" +) + +_install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/gitmodules/json/include/nlohmann + DESTINATION PyPartMC/include +) + +_install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/gitmodules/span/include/tcb + DESTINATION PyPartMC/include +) + +_install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/gitmodules/string_view-standalone/include/bpstd + DESTINATION PyPartMC/include +) + +_install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/gitmodules/optional/include/tl + DESTINATION PyPartMC/include +) + +_install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/gitmodules/nanobind_json/include/nanobind_json + DESTINATION PyPartMC/include +) + _install(TARGETS partmclib ARCHIVE DESTINATION PyPartMC/lib ) + execute_process( + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/PyPartMC + COMMAND ${Python_EXECUTABLE} + "-c" + "from __generate_si import __generate_si;\nsi=__generate_si(); print('#pragma once\\nstruct si {' + '\\n'.join([f'static constexpr auto {unit}={getattr(si, unit)};' for unit in dir(si) if type(getattr(si, unit)) == float]) + '};')" + OUTPUT_FILE ${CMAKE_BINARY_DIR}/si.hpp + ) + +_install( + FILES ${CMAKE_BINARY_DIR}/si.hpp + DESTINATION PyPartMC/include/PyPartMC +) + +file(GLOB ALL_HPP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp") + +file(WRITE ${CMAKE_BINARY_DIR}/PyPartMC.hpp "#pragma once\n") + +foreach(HPP_FILE IN LISTS ALL_HPP_FILES) + get_filename_component(FILENAME ${HPP_FILE} NAME) + file(APPEND ${CMAKE_BINARY_DIR}/PyPartMC.hpp "#include \n") +endforeach() + +_install( + FILES ${CMAKE_BINARY_DIR}/PyPartMC.hpp + DESTINATION PyPartMC/include/ +) diff --git a/readme_cpp/CMakeLists.txt b/readme_cpp/CMakeLists.txt index 647d7670..3a2ac452 100644 --- a/readme_cpp/CMakeLists.txt +++ b/readme_cpp/CMakeLists.txt @@ -44,10 +44,13 @@ endif() message(STATUS "PYPARTMC_LIB= ${PYPARTMC_LIB}") +get_filename_component(VENV_PYPARTMC_DIR ${PYPARTMC_LIB} DIRECTORY) + add_executable(my_test test.cpp) target_include_directories(my_test PUBLIC ${PYPARTMC_DIR}/include + ${VENV_PYPARTMC_DIR}/include ${NANOBIND_INCLUDE_DIR} ${Python_INCLUDE_DIRS} ) @@ -58,7 +61,7 @@ set_target_properties(PyPartMC_ext PROPERTIES IMPORTED_LOCATION "${PYPARTMC_LIB} # Link against the imported target, NOT the raw variable target_link_libraries(my_test PRIVATE PyPartMC_ext - ${PYPARTMC_DIR}/lib/libpartmclib.a + ${VENV_PYPARTMC_DIR}/lib/libpartmclib.a ${Python_LIBRARIES} ) diff --git a/readme_cpp/test.cpp b/readme_cpp/test.cpp index 49468bc7..fe6129b5 100644 --- a/readme_cpp/test.cpp +++ b/readme_cpp/test.cpp @@ -1,7 +1,52 @@ -#include "bin_grid.hpp" -#include +#include "PyPartMC.hpp" +#include "PyPartMC/si.hpp" -int main(){ - BinGrid a; - std::cout << "Success\n"; +int main() { + auto aero_data = std::shared_ptr(new AeroData({ + { {"OC", {1000.0 * si::kg / (si::m * si::m * si::m), 0.0, 1e-3 * si::kg / si::mol, 0.001, 0.0, 0.0}} }, + { {"BC", {1800.0 * si::kg / (si::m * si::m * si::m), 0.0, 1e-3 * si::kg / si::mol, 0.0, 0.0, 0.0}} } + })); + + auto aero_dist = AeroDist( + aero_data, + nlohmann::ordered_json::array({ + nlohmann::ordered_json::object({ + {"cooking", { + {"mass_frac", nlohmann::ordered_json::array({ nlohmann::ordered_json::object({{"OC", {1.0}}}) }) }, + {"diam_type", "geometric"}, + {"mode_type", "log_normal"}, + {"num_conc", 3200.0 / (si::cm * si::cm * si::cm)}, + {"geom_mean_diam", 8.64 * si::nm}, + {"log10_geom_std_dev", 0.28} + }}, + {"diesel", { + {"mass_frac", nlohmann::ordered_json::array({ nlohmann::ordered_json::object({{"OC", {0.3}}}), nlohmann::ordered_json::object({{"BC", {0.7}}}) }) }, + {"diam_type", "geometric"}, + {"mode_type", "log_normal"}, + {"num_conc", 2900.0 / (si::cm * si::cm * si::cm)}, + {"geom_mean_diam", 50.0 * si::nm}, + {"log10_geom_std_dev", 0.24} + }} + }) + }) + ); + + int n_part = 100; + auto aero_state = AeroState(aero_data, n_part, "nummass_source"); + + AeroState::dist_sample(aero_state, aero_dist, 1.0, 0.0, true, true); + + auto masses = AeroState::masses(aero_state, {}, {}); + auto num_concs = AeroState::num_concs(aero_state); + + double total_mass = std::inner_product( + std::begin(num_concs), std::end(num_concs), + std::begin(masses), + 0.0 + ); + + std::cout.precision(15); + std::cout << std::scientific << total_mass << " # kg/m3\n"; + + return 0; } \ No newline at end of file diff --git a/src/PyPartMC/__generate_si.py b/src/PyPartMC/__generate_si.py new file mode 100644 index 00000000..6d917107 --- /dev/null +++ b/src/PyPartMC/__generate_si.py @@ -0,0 +1,36 @@ +from collections import namedtuple + +def __generate_si(): + prefixes = { + "T": 1e12, + "G": 1e9, + "M": 1e6, + "k": 1e3, + "h": 1e2, + "da": 1e1, + "": 1e0, + "d": 1e-1, + "c": 1e-2, + "m": 1e-3, + "u": 1e-6, + "n": 1e-9, + "p": 1e-12, + } + units = { + "m": 1e0, + "g": 1e-3, + "s": 1e0, + "K": 1e0, + "Pa": 1e0, + "mol": 1e0, + "W": 1e0, + "J": 1e0, + "N": 1e0, + } + return namedtuple("SI", [prefix + unit for prefix in prefixes for unit in units])( + **{ + prefix_k + unit_k: prefix_v * unit_v + for prefix_k, prefix_v in prefixes.items() + for unit_k, unit_v in units.items() + } + ) diff --git a/src/input_guard.hpp b/src/input_guard.hpp index 0b638bd0..090943cf 100644 --- a/src/input_guard.hpp +++ b/src/input_guard.hpp @@ -1,3 +1,5 @@ +#pragma once + #include #include #include From 82e0ab686f525651cdba679716d5ac7632a52ae8 Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 10 Jun 2026 03:05:30 +0200 Subject: [PATCH 15/36] Re-enabled urlcheck.yml --- .github/workflows/{urlcheck.yml.off => urlcheck.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{urlcheck.yml.off => urlcheck.yml} (100%) diff --git a/.github/workflows/urlcheck.yml.off b/.github/workflows/urlcheck.yml similarity index 100% rename from .github/workflows/urlcheck.yml.off rename to .github/workflows/urlcheck.yml From c4c9602485d37bbb5fc2b6e7b65f2ec971ac6253 Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 10 Jun 2026 03:17:53 +0200 Subject: [PATCH 16/36] Ran black, commiting __init__ to remove duplicates with __generate_si. --- src/PyPartMC/__init__.py | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/src/PyPartMC/__init__.py b/src/PyPartMC/__init__.py index 9c27ae04..41531411 100644 --- a/src/PyPartMC/__init__.py +++ b/src/PyPartMC/__init__.py @@ -8,7 +8,6 @@ # pylint: disable=invalid-name,wrong-import-position import os -from collections import namedtuple from contextlib import contextmanager from pathlib import Path @@ -33,43 +32,7 @@ def __build_extension_env(): for cookie in cookies: cookie.close() - -def __generate_si(): - prefixes = { - "T": 1e12, - "G": 1e9, - "M": 1e6, - "k": 1e3, - "h": 1e2, - "da": 1e1, - "": 1e0, - "d": 1e-1, - "c": 1e-2, - "m": 1e-3, - "u": 1e-6, - "n": 1e-9, - "p": 1e-12, - } - units = { - "m": 1e0, - "g": 1e-3, - "s": 1e0, - "K": 1e0, - "Pa": 1e0, - "mol": 1e0, - "W": 1e0, - "J": 1e0, - "N": 1e0, - } - return namedtuple("SI", [prefix + unit for prefix in prefixes for unit in units])( - **{ - prefix_k + unit_k: prefix_v * unit_v - for prefix_k, prefix_v in prefixes.items() - for unit_k, unit_v in units.items() - } - ) - - +from .__generate_si import __generate_si si = __generate_si() """ a utility namedtuple aimed at clrifying physics-related code by providing SI-prefix-aware unit multipliers, resulting in e.g.: `p = 1000 * si.hPa` From c737e6297554aaf9873a31dcf2b43f87f754e6fe Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 10 Jun 2026 03:24:27 +0200 Subject: [PATCH 17/36] Re-run black formatter --- src/PyPartMC/__generate_si.py | 1 + src/PyPartMC/__init__.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/PyPartMC/__generate_si.py b/src/PyPartMC/__generate_si.py index 6d917107..ecab7945 100644 --- a/src/PyPartMC/__generate_si.py +++ b/src/PyPartMC/__generate_si.py @@ -1,5 +1,6 @@ from collections import namedtuple + def __generate_si(): prefixes = { "T": 1e12, diff --git a/src/PyPartMC/__init__.py b/src/PyPartMC/__init__.py index 41531411..af14612f 100644 --- a/src/PyPartMC/__init__.py +++ b/src/PyPartMC/__init__.py @@ -32,7 +32,9 @@ def __build_extension_env(): for cookie in cookies: cookie.close() + from .__generate_si import __generate_si + si = __generate_si() """ a utility namedtuple aimed at clrifying physics-related code by providing SI-prefix-aware unit multipliers, resulting in e.g.: `p = 1000 * si.hPa` From 0dfb7ee5c25416b953270a058a79427994be6a74 Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 10 Jun 2026 12:19:00 +0200 Subject: [PATCH 18/36] Added #pragma_once to *_parameters.hpp files, removed ctest form readme_listings.yml, added gdb to it, saved output of test run to txt file. --- .github/workflows/readme_listings.yml | 18 ++++++++++++++---- CMakeLists.txt | 1 + 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index 63dedfb7..2c189f55 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -143,6 +143,7 @@ jobs: mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-ninja m4 + - if: startsWith(matrix.os, 'macos-') run: | @@ -156,11 +157,20 @@ jobs: cd build cmake .. cmake --build . - - name: Execute tests + - if: matrix.os == 'windows-latest' run: | - cd readme_cpp - cd build - ctest --output-on-failure + gdb -batch \ + -ex "run" \ + -ex "bt full" \ + -ex "quit $_exitcode" \ + --args readme_cpp/build/my_test.exe + - name: Execute tests + run: | + ./readme_cpp/build/my_test > readme_output/cpp_${{matrix.os}}.txt + - uses: actions/upload-artifact@v4 + with: + name: readme_output-cpp_${{matrix.os}} + path: readme_output matlab: runs-on: ubuntu-22.04 diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f16172c..73c6dcbd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -511,6 +511,7 @@ add_dependencies(partmclib ${SUNDIALS_items}) string(CONCAT cmd "import sys;" + "print('#pragma once');" "print(''.join([line if line.startswith('#') else f'#define {line.split()[3]} {line.split()[5]}\\n' for line in sys.stdin if 'parameter ::' in line or line.startswith('#')]))" ) include(CheckFunctionExists) From 75100d3ad6692f41c4413c9eed420079745cb0e0 Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 10 Jun 2026 12:36:27 +0200 Subject: [PATCH 19/36] added mkdir for readme_cpp outputs, testing for test.cpp segfault solutions --- .github/workflows/readme_listings.yml | 3 ++- readme_cpp/test.cpp | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index 2c189f55..7f4a9ab2 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -95,7 +95,7 @@ jobs: name: readme_output-fortran path: readme_output - assert: + st: runs-on: ubuntu-latest needs: [julia, python, matlab, fortran, cpp] steps: @@ -166,6 +166,7 @@ jobs: --args readme_cpp/build/my_test.exe - name: Execute tests run: | + mkdir readme_output ./readme_cpp/build/my_test > readme_output/cpp_${{matrix.os}}.txt - uses: actions/upload-artifact@v4 with: diff --git a/readme_cpp/test.cpp b/readme_cpp/test.cpp index fe6129b5..edbf4b4a 100644 --- a/readme_cpp/test.cpp +++ b/readme_cpp/test.cpp @@ -19,14 +19,14 @@ int main() { {"geom_mean_diam", 8.64 * si::nm}, {"log10_geom_std_dev", 0.28} }}, - {"diesel", { - {"mass_frac", nlohmann::ordered_json::array({ nlohmann::ordered_json::object({{"OC", {0.3}}}), nlohmann::ordered_json::object({{"BC", {0.7}}}) }) }, - {"diam_type", "geometric"}, - {"mode_type", "log_normal"}, - {"num_conc", 2900.0 / (si::cm * si::cm * si::cm)}, - {"geom_mean_diam", 50.0 * si::nm}, - {"log10_geom_std_dev", 0.24} - }} + // {"diesel", { + // {"mass_frac", nlohmann::ordered_json::array({ nlohmann::ordered_json::object({{"OC", {0.3}}}), nlohmann::ordered_json::object({{"BC", {0.7}}}) }) }, + // {"diam_type", "geometric"}, + // {"mode_type", "log_normal"}, + // {"num_conc", 2900.0 / (si::cm * si::cm * si::cm)}, + // {"geom_mean_diam", 50.0 * si::nm}, + // {"log10_geom_std_dev", 0.24} + // }} }) }) ); From 770e4c23d36e466baad612977ed4635c654e8e0d Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 10 Jun 2026 12:43:38 +0200 Subject: [PATCH 20/36] Attempt to add tests on platforms other then windows for diffrent languages then cpp. --- .github/workflows/readme_listings.yml | 32 ++++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index 7f4a9ab2..43f375a4 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -14,7 +14,11 @@ on: jobs: julia: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, ubuntu-24.04-arm, macos-15, macos-15-intel, windows-latest] steps: - uses: actions/checkout@v2 with: @@ -35,14 +39,18 @@ jobs: - uses: julia-actions/setup-julia@v3 - run: mkdir readme_output - - run: julia readme.jl > readme_output/julia.txt + - run: julia readme.jl > readme_output/julia_${{ matrix.os }}.txt - uses: actions/upload-artifact@v4 with: name: readme_output-julia path: readme_output python: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, ubuntu-24.04-arm, macos-15, macos-15-intel, windows-latest] steps: - uses: actions/checkout@v2 with: @@ -62,14 +70,18 @@ jobs: - run: cat -n readme.py - run: mkdir readme_output - - run: python -We readme.py > readme_output/python.txt + - run: python -We readme.py > readme_output/python_${{ matrix.os }}.txt - uses: actions/upload-artifact@v4 with: name: readme_output-python path: readme_output fortran: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, ubuntu-24.04-arm, macos-15, macos-15-intel, windows-latest] steps: - uses: actions/checkout@v2 with: @@ -88,7 +100,7 @@ jobs: - run: | mkdir readme_output cd readme_fortran - ./build/main > ../readme_output/fortran.txt + ./build/main > ../readme_output/fortran_${{matrix.os}}.txt - uses: actions/upload-artifact@v4 with: @@ -174,7 +186,11 @@ jobs: path: readme_output matlab: - runs-on: ubuntu-22.04 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, ubuntu-24.04-arm, macos-15, macos-15-intel, windows-latest] steps: - uses: actions/checkout@v2 @@ -207,7 +223,7 @@ jobs: - uses: matlab-actions/run-command@v2.4.0 with: startup-options: -nojvm - command: diary('readme_output/matlab.txt'), readme + command: diary('readme_output/matlab_${{matrix.os}}.txt'), readme - uses: actions/upload-artifact@v4 with: From 5d2a42e4e57d6f7710a43524167949b391c39ca7 Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 10 Jun 2026 14:24:50 +0200 Subject: [PATCH 21/36] Changed python versions to 3.13 in readme_listings --- .github/workflows/readme_listings.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index 43f375a4..04d18a80 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -26,7 +26,7 @@ jobs: - uses: actions/setup-python@v1 with: - python-version: "3.10" + python-version: "3.13" - uses: jwlawson/actions-setup-cmake@v2.2 with: @@ -42,7 +42,7 @@ jobs: - run: julia readme.jl > readme_output/julia_${{ matrix.os }}.txt - uses: actions/upload-artifact@v4 with: - name: readme_output-julia + name: readme_output-julia_${{matrix.os}} path: readme_output python: @@ -58,7 +58,7 @@ jobs: - uses: actions/setup-python@v1 with: - python-version: "3.10" + python-version: "3.13" - uses: jwlawson/actions-setup-cmake@v2.2 with: @@ -73,7 +73,7 @@ jobs: - run: python -We readme.py > readme_output/python_${{ matrix.os }}.txt - uses: actions/upload-artifact@v4 with: - name: readme_output-python + name: readme_output-python_${{matrix.os}} path: readme_output fortran: @@ -81,7 +81,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, ubuntu-24.04-arm, macos-15, macos-15-intel, windows-latest] + os: [ubuntu-latest, ubuntu-24.04-arm] steps: - uses: actions/checkout@v2 with: @@ -104,7 +104,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: readme_output-fortran + name: readme_output-fortran_${{matrix.os}} path: readme_output st: @@ -199,7 +199,7 @@ jobs: - uses: actions/setup-python@v1 with: - python-version: "3.10" + python-version: "3.13" - uses: RalfG/python-wheels-manylinux-build@v0.7.1-manylinux2010_x86_64 with: @@ -227,6 +227,6 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: readme_output-matlab + name: readme_output-matlab_${{matrix.os}} path: readme_output From 0f19e0bd627c5fd295e2ef09ea4826bfe8dfe0dd Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 10 Jun 2026 14:52:59 +0200 Subject: [PATCH 22/36] Returned matlab to default state, added fortran compiler installation for windows tests of Python and Julia --- .github/workflows/readme_listings.yml | 50 +++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index 04d18a80..9ba32140 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -31,7 +31,24 @@ jobs: - uses: jwlawson/actions-setup-cmake@v2.2 with: cmake-version: '3.26.x' + + - if: matrix.os == 'windows-latest' + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: false + install: >- + mingw-w64-x86_64-gcc-fortran + mingw-w64-x86_64-ninja + m4 + - if: matrix.os == 'windows-latest' + run: | + echo CMAKE_ARGS="-DCMAKE_MAKE_PROGRAM=D:/a/_temp/msys64/mingw64/bin/ninja.exe" >> $GITHUB_ENV + echo CMAKE_PROGRAM_PATH="D:/a/_temp/msys64/usr/bin" >> $GITHUB_ENV + echo CMAKE_GENERATOR="Ninja" >> $GITHUB_ENV + echo TEMP="D:/a/_temp/" >> $GITHUB_ENV + - run: pip install -e . - run: pip install pytest-codeblocks pytest - run: python -c "import pytest_codeblocks; code=pytest_codeblocks.extract_from_file('README.md'); f=open('readme.jl', 'w'); f.writelines(block.code for block in code if block.syntax=='Julia'); f.close()" @@ -63,6 +80,23 @@ jobs: - uses: jwlawson/actions-setup-cmake@v2.2 with: cmake-version: '3.26.x' + + - if: matrix.os == 'windows-latest' + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: false + install: >- + mingw-w64-x86_64-gcc-fortran + mingw-w64-x86_64-ninja + m4 + + - if: matrix.os == 'windows-latest' + run: | + echo CMAKE_ARGS="-DCMAKE_MAKE_PROGRAM=D:/a/_temp/msys64/mingw64/bin/ninja.exe" >> $GITHUB_ENV + echo CMAKE_PROGRAM_PATH="D:/a/_temp/msys64/usr/bin" >> $GITHUB_ENV + echo CMAKE_GENERATOR="Ninja" >> $GITHUB_ENV + echo TEMP="D:/a/_temp/" >> $GITHUB_ENV - run: pip install -e . - run: pip install pytest-codeblocks pytest @@ -178,8 +212,12 @@ jobs: --args readme_cpp/build/my_test.exe - name: Execute tests run: | - mkdir readme_output - ./readme_cpp/build/my_test > readme_output/cpp_${{matrix.os}}.txt + mkdir -p readme_output + if [ "$RUNNER_OS" == "Windows" ]; then + ./readme_cpp/build/my_test.exe > readme_output/cpp_${{matrix.os}}.txt + else + ./readme_cpp/build/my_test > readme_output/cpp_${{matrix.os}}.txt + fi - uses: actions/upload-artifact@v4 with: name: readme_output-cpp_${{matrix.os}} @@ -190,7 +228,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, ubuntu-24.04-arm, macos-15, macos-15-intel, windows-latest] + os: [ubuntu-latest] steps: - uses: actions/checkout@v2 @@ -199,7 +237,7 @@ jobs: - uses: actions/setup-python@v1 with: - python-version: "3.13" + python-version: "3.10" - uses: RalfG/python-wheels-manylinux-build@v0.7.1-manylinux2010_x86_64 with: @@ -223,10 +261,10 @@ jobs: - uses: matlab-actions/run-command@v2.4.0 with: startup-options: -nojvm - command: diary('readme_output/matlab_${{matrix.os}}.txt'), readme + command: diary('readme_output/matlab.txt'), readme - uses: actions/upload-artifact@v4 with: - name: readme_output-matlab_${{matrix.os}} + name: readme_output-matlab path: readme_output From 137cfe0f5dfe41c8ffbf9ff0178f5f3ca652f125 Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 10 Jun 2026 22:20:48 +0200 Subject: [PATCH 23/36] Cut mac from julia and python, and and windows from julia. Changed cpp environment to ucrt64 from mingw64 --- .github/workflows/readme_listings.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index 9ba32140..a0b1ca4a 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, ubuntu-24.04-arm, macos-15, macos-15-intel, windows-latest] + os: [ubuntu-latest, ubuntu-24.04-arm] steps: - uses: actions/checkout@v2 with: @@ -42,13 +42,6 @@ jobs: mingw-w64-x86_64-ninja m4 - - if: matrix.os == 'windows-latest' - run: | - echo CMAKE_ARGS="-DCMAKE_MAKE_PROGRAM=D:/a/_temp/msys64/mingw64/bin/ninja.exe" >> $GITHUB_ENV - echo CMAKE_PROGRAM_PATH="D:/a/_temp/msys64/usr/bin" >> $GITHUB_ENV - echo CMAKE_GENERATOR="Ninja" >> $GITHUB_ENV - echo TEMP="D:/a/_temp/" >> $GITHUB_ENV - - run: pip install -e . - run: pip install pytest-codeblocks pytest - run: python -c "import pytest_codeblocks; code=pytest_codeblocks.extract_from_file('README.md'); f=open('readme.jl', 'w'); f.writelines(block.code for block in code if block.syntax=='Julia'); f.close()" @@ -67,7 +60,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, ubuntu-24.04-arm, macos-15, macos-15-intel, windows-latest] + os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest] steps: - uses: actions/checkout@v2 with: @@ -93,11 +86,15 @@ jobs: - if: matrix.os == 'windows-latest' run: | - echo CMAKE_ARGS="-DCMAKE_MAKE_PROGRAM=D:/a/_temp/msys64/mingw64/bin/ninja.exe" >> $GITHUB_ENV + echo CMAKE_ARGS="-DCMAKE_MAKE_PROGRAM=D:/a/_temp/msys64/ucrt64/bin/ninja.exe" >> $GITHUB_ENV echo CMAKE_PROGRAM_PATH="D:/a/_temp/msys64/usr/bin" >> $GITHUB_ENV echo CMAKE_GENERATOR="Ninja" >> $GITHUB_ENV echo TEMP="D:/a/_temp/" >> $GITHUB_ENV + - if: startsWith(matrix.os, 'macos-') + run: | + brew reinstall gcc + - run: pip install -e . - run: pip install pytest-codeblocks pytest - run: python -c "import pytest_codeblocks; code=pytest_codeblocks.extract_from_file('README.md'); f=open('readme.py', 'w'); f.writelines(block.code for block in code if block.syntax=='Python'); f.close()" From 03e554aaab81605caca7c40401a46ccddcc6882e Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 10 Jun 2026 22:52:56 +0200 Subject: [PATCH 24/36] Corrected an oversight that was made when changing mingw64 to ucrt64 --- .github/workflows/readme_listings.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index a0b1ca4a..9fe19284 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -35,11 +35,11 @@ jobs: - if: matrix.os == 'windows-latest' uses: msys2/setup-msys2@v2 with: - msystem: MINGW64 + msystem: UCRT64 update: false install: >- - mingw-w64-x86_64-gcc-fortran - mingw-w64-x86_64-ninja + mingw-w64-ucrt-x86_64-gcc-fortran + mingw-w64-ucrt-x86_64-ninja m4 - run: pip install -e . @@ -77,11 +77,11 @@ jobs: - if: matrix.os == 'windows-latest' uses: msys2/setup-msys2@v2 with: - msystem: MINGW64 + msystem: UCRT64 update: false install: >- - mingw-w64-x86_64-gcc-fortran - mingw-w64-x86_64-ninja + mingw-w64-ucrt-x86_64-gcc-fortran + mingw-w64-ucrt-x86_64-ninja m4 - if: matrix.os == 'windows-latest' @@ -172,7 +172,7 @@ jobs: - if: matrix.os == 'windows-latest' run: | - echo CMAKE_ARGS="-DCMAKE_MAKE_PROGRAM=D:/a/_temp/msys64/mingw64/bin/ninja.exe" >> $GITHUB_ENV + echo CMAKE_ARGS="-DCMAKE_MAKE_PROGRAM=D:/a/_temp/msys64/ucrt64/bin/ninja.exe" >> $GITHUB_ENV echo CMAKE_PROGRAM_PATH="D:/a/_temp/msys64/usr/bin" >> $GITHUB_ENV echo CMAKE_GENERATOR="Ninja" >> $GITHUB_ENV echo TEMP="D:/a/_temp/" >> $GITHUB_ENV @@ -180,11 +180,11 @@ jobs: - if: matrix.os == 'windows-latest' uses: msys2/setup-msys2@v2 with: - msystem: MINGW64 + msystem: UCRT64 update: false install: >- - mingw-w64-x86_64-gcc-fortran - mingw-w64-x86_64-ninja + mingw-w64-ucrt-x86_64-gcc-fortran + mingw-w64-ucrt-x86_64-ninja m4 From 3ba785dc041262a24138a40dc05c07f728a4d900 Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 10 Jun 2026 23:07:22 +0200 Subject: [PATCH 25/36] Changed msys is being added to cmake env variables to it being added to PATH instead --- .github/workflows/readme_listings.yml | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index 9fe19284..9479fea8 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -80,16 +80,15 @@ jobs: msystem: UCRT64 update: false install: >- + mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-gcc-fortran mingw-w64-ucrt-x86_64-ninja m4 - if: matrix.os == 'windows-latest' run: | - echo CMAKE_ARGS="-DCMAKE_MAKE_PROGRAM=D:/a/_temp/msys64/ucrt64/bin/ninja.exe" >> $GITHUB_ENV - echo CMAKE_PROGRAM_PATH="D:/a/_temp/msys64/usr/bin" >> $GITHUB_ENV - echo CMAKE_GENERATOR="Ninja" >> $GITHUB_ENV - echo TEMP="D:/a/_temp/" >> $GITHUB_ENV + echo "C:/msys64/ucrt64/bin" >> $GITHUB_PATH + echo "C:/msys64/usr/bin" >> $GITHUB_PATH - if: startsWith(matrix.os, 'macos-') run: | @@ -169,13 +168,6 @@ jobs: - uses: jwlawson/actions-setup-cmake@v2.2.0 with: cmake-version: '3.26.x' - - - if: matrix.os == 'windows-latest' - run: | - echo CMAKE_ARGS="-DCMAKE_MAKE_PROGRAM=D:/a/_temp/msys64/ucrt64/bin/ninja.exe" >> $GITHUB_ENV - echo CMAKE_PROGRAM_PATH="D:/a/_temp/msys64/usr/bin" >> $GITHUB_ENV - echo CMAKE_GENERATOR="Ninja" >> $GITHUB_ENV - echo TEMP="D:/a/_temp/" >> $GITHUB_ENV - if: matrix.os == 'windows-latest' uses: msys2/setup-msys2@v2 @@ -183,10 +175,15 @@ jobs: msystem: UCRT64 update: false install: >- + mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-gcc-fortran mingw-w64-ucrt-x86_64-ninja m4 - + + - if: matrix.os == 'windows-latest' + run: | + echo "C:/msys64/ucrt64/bin" >> $GITHUB_PATH + echo "C:/msys64/usr/bin" >> $GITHUB_PATH - if: startsWith(matrix.os, 'macos-') run: | From 321b030df7257248f6a996e20789fabe0f7d86b7 Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 10 Jun 2026 23:29:40 +0200 Subject: [PATCH 26/36] Added fortran compiler back for cpp and python on windows --- .github/workflows/readme_listings.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index 9479fea8..3ed772a6 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -31,16 +31,6 @@ jobs: - uses: jwlawson/actions-setup-cmake@v2.2 with: cmake-version: '3.26.x' - - - if: matrix.os == 'windows-latest' - uses: msys2/setup-msys2@v2 - with: - msystem: UCRT64 - update: false - install: >- - mingw-w64-ucrt-x86_64-gcc-fortran - mingw-w64-ucrt-x86_64-ninja - m4 - run: pip install -e . - run: pip install pytest-codeblocks pytest @@ -89,6 +79,7 @@ jobs: run: | echo "C:/msys64/ucrt64/bin" >> $GITHUB_PATH echo "C:/msys64/usr/bin" >> $GITHUB_PATH + echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV - if: startsWith(matrix.os, 'macos-') run: | @@ -184,6 +175,7 @@ jobs: run: | echo "C:/msys64/ucrt64/bin" >> $GITHUB_PATH echo "C:/msys64/usr/bin" >> $GITHUB_PATH + echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV - if: startsWith(matrix.os, 'macos-') run: | From 0a9d3a075af1a75643f0733a248596268e562e55 Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 10 Jun 2026 23:51:57 +0200 Subject: [PATCH 27/36] added m4 to env for cpp and python tests on windows --- .github/workflows/readme_listings.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index 3ed772a6..63654847 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -80,6 +80,7 @@ jobs: echo "C:/msys64/ucrt64/bin" >> $GITHUB_PATH echo "C:/msys64/usr/bin" >> $GITHUB_PATH echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV + echo "CMAKE_ARGS=-DNC_M4=C:/msys64/usr/bin/m4.exe" >> $GITHUB_ENV - if: startsWith(matrix.os, 'macos-') run: | @@ -176,6 +177,7 @@ jobs: echo "C:/msys64/ucrt64/bin" >> $GITHUB_PATH echo "C:/msys64/usr/bin" >> $GITHUB_PATH echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV + echo "CMAKE_ARGS=-DNC_M4=C:/msys64/usr/bin/m4.exe" >> $GITHUB_ENV - if: startsWith(matrix.os, 'macos-') run: | From 036761cbe49a2abc3c686b7fbaae39882996507d Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Thu, 11 Jun 2026 00:08:54 +0200 Subject: [PATCH 28/36] Attempt to install m4 with Chocolatey instead --- .github/workflows/readme_listings.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index 63654847..479fc954 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -80,7 +80,8 @@ jobs: echo "C:/msys64/ucrt64/bin" >> $GITHUB_PATH echo "C:/msys64/usr/bin" >> $GITHUB_PATH echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV - echo "CMAKE_ARGS=-DNC_M4=C:/msys64/usr/bin/m4.exe" >> $GITHUB_ENV + - if: matrix.os == 'windows-latest' + run: choco install m4 - if: startsWith(matrix.os, 'macos-') run: | @@ -177,7 +178,8 @@ jobs: echo "C:/msys64/ucrt64/bin" >> $GITHUB_PATH echo "C:/msys64/usr/bin" >> $GITHUB_PATH echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV - echo "CMAKE_ARGS=-DNC_M4=C:/msys64/usr/bin/m4.exe" >> $GITHUB_ENV + - if: matrix.os == 'windows-latest' + run: choco install m4 - if: startsWith(matrix.os, 'macos-') run: | From 22d9596c771db2721b00db3d7d92272215ba1981 Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Thu, 11 Jun 2026 00:16:33 +0200 Subject: [PATCH 29/36] Tried linking m4 downloaded with msys via cygpath --- .github/workflows/readme_listings.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml index 479fc954..ab9ab8d1 100644 --- a/.github/workflows/readme_listings.yml +++ b/.github/workflows/readme_listings.yml @@ -76,12 +76,12 @@ jobs: m4 - if: matrix.os == 'windows-latest' + shell: msys2 {0} run: | - echo "C:/msys64/ucrt64/bin" >> $GITHUB_PATH - echo "C:/msys64/usr/bin" >> $GITHUB_PATH + echo "$(cygpath -m /ucrt64/bin)" >> $GITHUB_PATH + echo "$(cygpath -m /usr/bin)" >> $GITHUB_PATH echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV - - if: matrix.os == 'windows-latest' - run: choco install m4 + echo "CMAKE_ARGS=-DNC_M4=$(cygpath -m $(which m4))" >> $GITHUB_ENV - if: startsWith(matrix.os, 'macos-') run: | @@ -174,12 +174,12 @@ jobs: m4 - if: matrix.os == 'windows-latest' + shell: msys2 {0} run: | - echo "C:/msys64/ucrt64/bin" >> $GITHUB_PATH - echo "C:/msys64/usr/bin" >> $GITHUB_PATH + echo "$(cygpath -m /ucrt64/bin)" >> $GITHUB_PATH + echo "$(cygpath -m /usr/bin)" >> $GITHUB_PATH echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV - - if: matrix.os == 'windows-latest' - run: choco install m4 + echo "CMAKE_ARGS=-DNC_M4=$(cygpath -m $(which m4))" >> $GITHUB_ENV - if: startsWith(matrix.os, 'macos-') run: | From 7abd91bab236e8396355186ec0d313dc8badb2dd Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Sun, 14 Jun 2026 17:37:14 +0200 Subject: [PATCH 30/36] Attempted to move some necessary cmake setup away from the end user --- CMakeLists.txt | 5 ++ readme_cpp/CMakeLists.txt | 73 +++---------------------- readme_cpp/test.cpp | 23 ++++---- src/PyPartMC/__init__.py | 5 ++ src/PyPartMC/cmake/PyPartMCConfig.cmake | 62 +++++++++++++++++++++ 5 files changed, 94 insertions(+), 74 deletions(-) create mode 100644 src/PyPartMC/cmake/PyPartMCConfig.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 73c6dcbd..35e06605 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -716,3 +716,8 @@ _install( FILES ${CMAKE_BINARY_DIR}/PyPartMC.hpp DESTINATION PyPartMC/include/ ) + +_install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/PyPartMC/cmake + DESTINATION PyPartMC +) \ No newline at end of file diff --git a/readme_cpp/CMakeLists.txt b/readme_cpp/CMakeLists.txt index 3a2ac452..cf94d549 100644 --- a/readme_cpp/CMakeLists.txt +++ b/readme_cpp/CMakeLists.txt @@ -1,76 +1,21 @@ cmake_minimum_required(VERSION 3.22) -project(PyPartMC_CXX LANGUAGES CXX) +project(AeroSimulation LANGUAGES CXX) enable_testing() - set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED YES) - -find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development) -message(STATUS "Python_EXECUTABLE= ${Python_EXECUTABLE}") - -execute_process( - COMMAND ${Python_EXECUTABLE} -c "from pathlib import Path; import PyPartMC; print(f'{Path(PyPartMC.__file__).parent}')" - OUTPUT_VARIABLE PYPARTMC_DIR - OUTPUT_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE res -) -if(res) - message(FATAL_ERROR "Failed to find PyPartMC directory. Exit code: ${res}") -endif() - -message(STATUS "PYPARTMC_DIR= ${PYPARTMC_DIR}") +find_package(Python 3.8 REQUIRED COMPONENTS Interpreter) execute_process( - COMMAND ${Python_EXECUTABLE} -c "import nanobind; print(nanobind.include_dir())" - OUTPUT_VARIABLE NANOBIND_INCLUDE_DIR + COMMAND ${Python_EXECUTABLE} -c "import PyPartMC, pathlib; print(pathlib.Path(PyPartMC.cmake_dir()).as_posix())" + OUTPUT_VARIABLE PYPARTMC_CMAKE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE res_nano ) -if(res_nano) - message(FATAL_ERROR "Failed to find nanobind include directory. Exit code: ${res_nano}") -endif() -message(STATUS "NANOBIND_INCLUDE_DIR= ${NANOBIND_INCLUDE_DIR}") +set(PyPartMC_DIR "${PYPARTMC_CMAKE_DIR}") -execute_process( - COMMAND ${Python_EXECUTABLE} -c "from PyPartMC import _PyPartMC; print(f'{_PyPartMC.__file__}')" - OUTPUT_VARIABLE PYPARTMC_LIB - OUTPUT_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE res_lib -) -if(res_lib) - message(FATAL_ERROR "Failed to find PyPartMC library. Exit code: ${res_lib}") -endif() - -message(STATUS "PYPARTMC_LIB= ${PYPARTMC_LIB}") - -get_filename_component(VENV_PYPARTMC_DIR ${PYPARTMC_LIB} DIRECTORY) +find_package(PyPartMC REQUIRED) add_executable(my_test test.cpp) +target_link_libraries(my_test PRIVATE PyPartMC::PyPartMC) +pypartmc_setup_runtime(my_test) -target_include_directories(my_test PUBLIC - ${PYPARTMC_DIR}/include - ${VENV_PYPARTMC_DIR}/include - ${NANOBIND_INCLUDE_DIR} - ${Python_INCLUDE_DIRS} -) - -add_library(PyPartMC_ext UNKNOWN IMPORTED) -set_target_properties(PyPartMC_ext PROPERTIES IMPORTED_LOCATION "${PYPARTMC_LIB}") - -# Link against the imported target, NOT the raw variable -target_link_libraries(my_test PRIVATE - PyPartMC_ext - ${VENV_PYPARTMC_DIR}/lib/libpartmclib.a - ${Python_LIBRARIES} -) - -# Copying .pyd file -add_custom_command(TARGET my_test POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${PYPARTMC_LIB} - $ -) - -add_test(NAME maketest - COMMAND my_test) \ No newline at end of file +add_test(NAME maketest COMMAND my_test) \ No newline at end of file diff --git a/readme_cpp/test.cpp b/readme_cpp/test.cpp index edbf4b4a..b20a8656 100644 --- a/readme_cpp/test.cpp +++ b/readme_cpp/test.cpp @@ -1,8 +1,12 @@ +#include +#include +#include + #include "PyPartMC.hpp" #include "PyPartMC/si.hpp" int main() { - auto aero_data = std::shared_ptr(new AeroData({ + auto aero_data = std::make_shared(nlohmann::json({ { {"OC", {1000.0 * si::kg / (si::m * si::m * si::m), 0.0, 1e-3 * si::kg / si::mol, 0.001, 0.0, 0.0}} }, { {"BC", {1800.0 * si::kg / (si::m * si::m * si::m), 0.0, 1e-3 * si::kg / si::mol, 0.0, 0.0, 0.0}} } })); @@ -19,14 +23,14 @@ int main() { {"geom_mean_diam", 8.64 * si::nm}, {"log10_geom_std_dev", 0.28} }}, - // {"diesel", { - // {"mass_frac", nlohmann::ordered_json::array({ nlohmann::ordered_json::object({{"OC", {0.3}}}), nlohmann::ordered_json::object({{"BC", {0.7}}}) }) }, - // {"diam_type", "geometric"}, - // {"mode_type", "log_normal"}, - // {"num_conc", 2900.0 / (si::cm * si::cm * si::cm)}, - // {"geom_mean_diam", 50.0 * si::nm}, - // {"log10_geom_std_dev", 0.24} - // }} + {"diesel", { + {"mass_frac", nlohmann::ordered_json::array({ nlohmann::ordered_json::object({{"OC", {0.3}}}), nlohmann::ordered_json::object({{"BC", {0.7}}}) }) }, + {"diam_type", "geometric"}, + {"mode_type", "log_normal"}, + {"num_conc", 2900.0 / (si::cm * si::cm * si::cm)}, + {"geom_mean_diam", 50.0 * si::nm}, + {"log10_geom_std_dev", 0.24} + }} }) }) ); @@ -45,7 +49,6 @@ int main() { 0.0 ); - std::cout.precision(15); std::cout << std::scientific << total_mass << " # kg/m3\n"; return 0; diff --git a/src/PyPartMC/__init__.py b/src/PyPartMC/__init__.py index af14612f..1abb55ec 100644 --- a/src/PyPartMC/__init__.py +++ b/src/PyPartMC/__init__.py @@ -71,3 +71,8 @@ def __build_extension_env(): # workaround for MATLAB bindings # pylint: disable=undefined-variable setattr(nanobind, "nb_type_0", type(_PyPartMC.AeroData)) + + +#Function that returns cmakes config file location +def cmake_dir() -> str: + return os.path.join(os.path.dirname(__file__), "cmake") diff --git a/src/PyPartMC/cmake/PyPartMCConfig.cmake b/src/PyPartMC/cmake/PyPartMCConfig.cmake new file mode 100644 index 00000000..9209a3b1 --- /dev/null +++ b/src/PyPartMC/cmake/PyPartMCConfig.cmake @@ -0,0 +1,62 @@ +if(TARGET PyPartMC::PyPartMC) + return() +endif() + +find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development) + +set(PyPartMC_RUNTIME_LIBRARY "${PYPARTMC_LIB_FILE}") + +execute_process( + COMMAND ${Python_EXECUTABLE} -c "import nanobind, PyPartMC, os; from PyPartMC import _PyPartMC; print(f'{os.path.dirname(PyPartMC.__file__)};{nanobind.include_dir()};{_PyPartMC.__file__}')" + OUTPUT_VARIABLE PY_PATHS + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE res +) + +if(res) + message(FATAL_ERROR "filed to find PyPartMC libraries") +endif() + +list(GET PY_PATHS 0 PYPARTMC_DIR) +list(GET PY_PATHS 1 NANOBIND_INCLUDE_DIR) +list(GET PY_PATHS 2 PYPARTMC_LIB_FILE) + +get_filename_component(VENV_PYPARTMC_DIR "${PYPARTMC_LIB_FILE}" DIRECTORY) + +add_library(PyPartMC::PyPartMC INTERFACE IMPORTED) + +set(POTENTIAL_INCLUDE_DIRS + "${PYPARTMC_DIR}/include" + "${VENV_PYPARTMC_DIR}/include" + "${NANOBIND_INCLUDE_DIR}" +) + +set(ACTUAL_INCLUDE_DIRS "") +foreach(DIR IN LISTS POTENTIAL_INCLUDE_DIRS) + if(EXISTS "${DIR}") + list(APPEND ACTUAL_INCLUDE_DIRS "${DIR}") + endif() +endforeach() + +target_include_directories(PyPartMC::PyPartMC INTERFACE + ${ACTUAL_INCLUDE_DIRS} + ${Python_INCLUDE_DIRS} +) + +target_link_libraries(PyPartMC::PyPartMC INTERFACE + "${VENV_PYPARTMC_DIR}/lib/libpartmclib.a" + "${PYPARTMC_LIB_FILE}" + ${Python_LIBRARIES} +) + +function(pypartmc_setup_runtime TARGET_NAME) + if(WIN32) + add_custom_command(TARGET ${TARGET_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${PYPARTMC_LIB_FILE}" + $ + ) + endif() +endfunction() + +message(STATUS "Found PyPartMC: ${PYPARTMC_DIR}") From 0f4296b1b24275f73fe80ef9b7b80572c34a6dce Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Sun, 14 Jun 2026 17:58:00 +0200 Subject: [PATCH 31/36] made sure linux recognizes _PyPartMC file --- src/PyPartMC/cmake/PyPartMCConfig.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/PyPartMC/cmake/PyPartMCConfig.cmake b/src/PyPartMC/cmake/PyPartMCConfig.cmake index 9209a3b1..6387db46 100644 --- a/src/PyPartMC/cmake/PyPartMCConfig.cmake +++ b/src/PyPartMC/cmake/PyPartMCConfig.cmake @@ -25,6 +25,9 @@ get_filename_component(VENV_PYPARTMC_DIR "${PYPARTMC_LIB_FILE}" DIRECTORY) add_library(PyPartMC::PyPartMC INTERFACE IMPORTED) +add_library(PyPartMC::RuntimeCore UNKNOWN IMPORTED) +set_target_properties(PyPartMC::RuntimeCore PROPERTIES IMPORTED_LOCATION "${PYPARTMC_LIB_FILE}") + set(POTENTIAL_INCLUDE_DIRS "${PYPARTMC_DIR}/include" "${VENV_PYPARTMC_DIR}/include" @@ -45,7 +48,7 @@ target_include_directories(PyPartMC::PyPartMC INTERFACE target_link_libraries(PyPartMC::PyPartMC INTERFACE "${VENV_PYPARTMC_DIR}/lib/libpartmclib.a" - "${PYPARTMC_LIB_FILE}" + PyPartMC::RuntimeCore ${Python_LIBRARIES} ) From 8fe770c799eaa6c290d11dc63dc8553958f7ce64 Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 17 Jun 2026 12:13:56 +0200 Subject: [PATCH 32/36] Moved readme_listings to buildwheels --- .github/workflows/buildwheels.yml | 236 ++++++++++++++++++++++- .github/workflows/readme_listings.yml | 260 -------------------------- 2 files changed, 233 insertions(+), 263 deletions(-) delete mode 100644 .github/workflows/readme_listings.yml diff --git a/.github/workflows/buildwheels.yml b/.github/workflows/buildwheels.yml index 5e8e038a..65f63e76 100644 --- a/.github/workflows/buildwheels.yml +++ b/.github/workflows/buildwheels.yml @@ -82,7 +82,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: dist-${{matrix.os}}-${{matrix.manylinux}} + name: dist-${{matrix.os}} path: dist run_example_notebooks: @@ -106,7 +106,7 @@ jobs: - uses: actions/download-artifact@v4 with: - name: dist-${{matrix.os}}-${{matrix.manylinux}} + name: dist-${{matrix.os}} path: dist # install fortran compiler needed by dustpy @@ -155,7 +155,7 @@ jobs: - run: pip install twine auditwheel - uses: actions/download-artifact@v4 with: - name: dist-${{matrix.os}}-${{matrix.manylinux}} + name: dist-${{matrix.os}} path: dist - run: twine check --strict dist/* - run: for i in dist/*-manylinux*.whl; do auditwheel show $i; done; @@ -223,3 +223,233 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1.14 with: attestations: false + + readme_julia: + runs-on: ${{ matrix.os }} + needs: [build_wheels] + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, ubuntu-24.04-arm] + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + + - uses: actions/setup-python@v1 + with: + python-version: "3.13" + + - run: | + temp=`find dist/ -name "*cp313*.whl"` + python -m pip install $temp[examples] + - run: pip install pytest-codeblocks pytest + - run: python -c "import pytest_codeblocks; code=pytest_codeblocks.extract_from_file('README.md'); f=open('readme.jl', 'w'); f.writelines(block.code for block in code if block.syntax=='Julia'); f.close()" + - run: cat -n readme.jl + + - uses: julia-actions/setup-julia@v3 + - run: mkdir readme_output + - run: julia readme.jl > readme_output/julia_${{ matrix.os }}.txt + - uses: actions/upload-artifact@v4 + with: + name: readme_output-julia_${{matrix.os}} + path: readme_output + + readme_python: + runs-on: ${{ matrix.os }} + needs: [build_wheels] + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest] + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + + - uses: actions/setup-python@v1 + with: + python-version: "3.13" + + - run: | + temp=`find dist/ -name "*cp313*.whl"` + python -m pip install $temp[examples] + + - run: pip install pytest-codeblocks pytest + - run: python -c "import pytest_codeblocks; code=pytest_codeblocks.extract_from_file('README.md'); f=open('readme.py', 'w'); f.writelines(block.code for block in code if block.syntax=='Python'); f.close()" + - run: cat -n readme.py + + - run: mkdir readme_output + - run: python -We readme.py > readme_output/python_${{ matrix.os }}.txt + - uses: actions/upload-artifact@v4 + with: + name: readme_output-python_${{matrix.os}} + path: readme_output + + readme_fortran: + runs-on: ${{ matrix.os }} + needs: [build_wheels] + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, ubuntu-24.04-arm] + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + + - run: | + sudo apt-get update + sudo apt-get install libnetcdff-dev + - run: | + cd readme_fortran + mkdir build + cd build + PARTMC_HOME=../../gitmodules/partmc cmake .. + make + + - run: | + mkdir readme_output + cd readme_fortran + ./build/main > ../readme_output/fortran_${{matrix.os}}.txt + + - uses: actions/upload-artifact@v4 + with: + name: readme_output-fortran_${{matrix.os}} + path: readme_output + + readme_assert: + runs-on: ubuntu-latest + needs: [readme_julia, readme_python, readme_matlab, readme_fortran, readme_cpp] + steps: + - uses: actions/setup-python@v2 + - run: pip install numpy + - uses: actions/download-artifact@v4 + with: + pattern: readme_output-* + merge-multiple: true + path: readme_output + - run : python -c 'import numpy as np; import os; dir="readme_output/"; data=[float(np.loadtxt(dir+file)) for file in os.listdir(dir)]; print("data:", data); similar_as_first = np.array([abs(data[0]-k)/data[0] for k in data[1:]]); print("similar_as_first", similar_as_first); assert((similar_as_first < .5).all())' + + readme_cpp: + runs-on: ${{ matrix.os }} + needs: [build_wheels] + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, ubuntu-24.04-arm, macos-15, macos-15-intel, windows-latest] + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + + - uses: actions/setup-python@v6 + with: + python-version: "3.12" + + - uses: jwlawson/actions-setup-cmake@v2.2.0 + with: + cmake-version: '3.26.x' + + - if: matrix.os == 'windows-latest' + uses: msys2/setup-msys2@v2 + with: + msystem: UCRT64 + update: false + install: >- + mingw-w64-ucrt-x86_64-gcc + mingw-w64-ucrt-x86_64-ninja + m4 + + - if: matrix.os == 'windows-latest' + shell: msys2 {0} + run: | + echo "$(cygpath -m /ucrt64/bin)" >> $GITHUB_PATH + echo "$(cygpath -m /usr/bin)" >> $GITHUB_PATH + echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV + echo "CMAKE_ARGS=-DNC_M4=$(cygpath -m $(which m4))" >> $GITHUB_ENV + + - if: startsWith(matrix.os, 'macos-') + run: | + brew reinstall gcc + + - uses: actions/download-artifact@v4 + with: + name: dist-${{matrix.os}} + path: dist + + - run: | + temp=`find dist/ -name "*cp312*.whl"` + python -m pip install $temp[examples] + + - name: build + run: | + cd readme_cpp + mkdir build + cd build + cmake .. + cmake --build . + - if: matrix.os == 'windows-latest' + run: | + gdb -batch \ + -ex "run" \ + -ex "bt full" \ + -ex "quit $_exitcode" \ + --args readme_cpp/build/my_test.exe + - name: Execute tests + run: | + mkdir -p readme_output + if [ "$RUNNER_OS" == "Windows" ]; then + ./readme_cpp/build/my_test.exe > readme_output/cpp_${{matrix.os}}.txt + else + ./readme_cpp/build/my_test > readme_output/cpp_${{matrix.os}}.txt + fi + - uses: actions/upload-artifact@v4 + with: + name: readme_output-cpp_${{matrix.os}} + path: readme_output + + readme_matlab: + runs-on: ${{ matrix.os }} + needs: [build_wheels] + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + + - uses: actions/setup-python@v1 + with: + python-version: "3.10" + + - uses: actions/download-artifact@v4 + with: + name: dist-${{matrix.os}} + path: dist + + - run: pip install --verbose dist/*manylinux*.whl + + - run: pip install pytest-codeblocks pytest + - run: python -c "import pytest_codeblocks; code=pytest_codeblocks.extract_from_file('README.md'); f=open('readme.m', 'w'); f.writelines(block.code for block in code if block.syntax=='Matlab'); f.close()" + - run: cat -n readme.m + + - uses: matlab-actions/setup-matlab@v2.6.1 + with: + release: R2024b + cache: true + + - run: mkdir readme_output + + - uses: matlab-actions/run-command@v2.4.0 + with: + startup-options: -nojvm + command: diary('readme_output/matlab.txt'), readme + + - uses: actions/upload-artifact@v4 + with: + name: readme_output-matlab + path: readme_output diff --git a/.github/workflows/readme_listings.yml b/.github/workflows/readme_listings.yml deleted file mode 100644 index ab9ab8d1..00000000 --- a/.github/workflows/readme_listings.yml +++ /dev/null @@ -1,260 +0,0 @@ -name: readme_listings - -defaults: - run: - shell: bash - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - schedule: - - cron: '0 13 * * 4' - -jobs: - julia: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, ubuntu-24.04-arm] - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - - uses: actions/setup-python@v1 - with: - python-version: "3.13" - - - uses: jwlawson/actions-setup-cmake@v2.2 - with: - cmake-version: '3.26.x' - - - run: pip install -e . - - run: pip install pytest-codeblocks pytest - - run: python -c "import pytest_codeblocks; code=pytest_codeblocks.extract_from_file('README.md'); f=open('readme.jl', 'w'); f.writelines(block.code for block in code if block.syntax=='Julia'); f.close()" - - run: cat -n readme.jl - - - uses: julia-actions/setup-julia@v3 - - run: mkdir readme_output - - run: julia readme.jl > readme_output/julia_${{ matrix.os }}.txt - - uses: actions/upload-artifact@v4 - with: - name: readme_output-julia_${{matrix.os}} - path: readme_output - - python: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest] - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - - uses: actions/setup-python@v1 - with: - python-version: "3.13" - - - uses: jwlawson/actions-setup-cmake@v2.2 - with: - cmake-version: '3.26.x' - - - if: matrix.os == 'windows-latest' - uses: msys2/setup-msys2@v2 - with: - msystem: UCRT64 - update: false - install: >- - mingw-w64-ucrt-x86_64-gcc - mingw-w64-ucrt-x86_64-gcc-fortran - mingw-w64-ucrt-x86_64-ninja - m4 - - - if: matrix.os == 'windows-latest' - shell: msys2 {0} - run: | - echo "$(cygpath -m /ucrt64/bin)" >> $GITHUB_PATH - echo "$(cygpath -m /usr/bin)" >> $GITHUB_PATH - echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV - echo "CMAKE_ARGS=-DNC_M4=$(cygpath -m $(which m4))" >> $GITHUB_ENV - - - if: startsWith(matrix.os, 'macos-') - run: | - brew reinstall gcc - - - run: pip install -e . - - run: pip install pytest-codeblocks pytest - - run: python -c "import pytest_codeblocks; code=pytest_codeblocks.extract_from_file('README.md'); f=open('readme.py', 'w'); f.writelines(block.code for block in code if block.syntax=='Python'); f.close()" - - run: cat -n readme.py - - - run: mkdir readme_output - - run: python -We readme.py > readme_output/python_${{ matrix.os }}.txt - - uses: actions/upload-artifact@v4 - with: - name: readme_output-python_${{matrix.os}} - path: readme_output - - fortran: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, ubuntu-24.04-arm] - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - - run: | - sudo apt-get update - sudo apt-get install libnetcdff-dev - - run: | - cd readme_fortran - mkdir build - cd build - PARTMC_HOME=../../gitmodules/partmc cmake .. - make - - - run: | - mkdir readme_output - cd readme_fortran - ./build/main > ../readme_output/fortran_${{matrix.os}}.txt - - - uses: actions/upload-artifact@v4 - with: - name: readme_output-fortran_${{matrix.os}} - path: readme_output - - st: - runs-on: ubuntu-latest - needs: [julia, python, matlab, fortran, cpp] - steps: - - uses: actions/setup-python@v2 - - run: pip install numpy - - uses: actions/download-artifact@v4 - with: - pattern: readme_output-* - merge-multiple: true - path: readme_output - - run : python -c 'import numpy as np; import os; dir="readme_output/"; data=[float(np.loadtxt(dir+file)) for file in os.listdir(dir)]; print("data:", data); similar_as_first = np.array([abs(data[0]-k)/data[0] for k in data[1:]]); print("similar_as_first", similar_as_first); assert((similar_as_first < .5).all())' - - cpp: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, ubuntu-24.04-arm, macos-15, macos-15-intel, windows-latest] - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - - uses: actions/setup-python@v6 - with: - python-version: "3.12" - - - uses: jwlawson/actions-setup-cmake@v2.2.0 - with: - cmake-version: '3.26.x' - - - if: matrix.os == 'windows-latest' - uses: msys2/setup-msys2@v2 - with: - msystem: UCRT64 - update: false - install: >- - mingw-w64-ucrt-x86_64-gcc - mingw-w64-ucrt-x86_64-gcc-fortran - mingw-w64-ucrt-x86_64-ninja - m4 - - - if: matrix.os == 'windows-latest' - shell: msys2 {0} - run: | - echo "$(cygpath -m /ucrt64/bin)" >> $GITHUB_PATH - echo "$(cygpath -m /usr/bin)" >> $GITHUB_PATH - echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV - echo "CMAKE_ARGS=-DNC_M4=$(cygpath -m $(which m4))" >> $GITHUB_ENV - - - if: startsWith(matrix.os, 'macos-') - run: | - brew reinstall gcc - - - run: pip install . - - name: build - run: | - cd readme_cpp - mkdir build - cd build - cmake .. - cmake --build . - - if: matrix.os == 'windows-latest' - run: | - gdb -batch \ - -ex "run" \ - -ex "bt full" \ - -ex "quit $_exitcode" \ - --args readme_cpp/build/my_test.exe - - name: Execute tests - run: | - mkdir -p readme_output - if [ "$RUNNER_OS" == "Windows" ]; then - ./readme_cpp/build/my_test.exe > readme_output/cpp_${{matrix.os}}.txt - else - ./readme_cpp/build/my_test > readme_output/cpp_${{matrix.os}}.txt - fi - - uses: actions/upload-artifact@v4 - with: - name: readme_output-cpp_${{matrix.os}} - path: readme_output - - matlab: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - - uses: actions/setup-python@v1 - with: - python-version: "3.10" - - - uses: RalfG/python-wheels-manylinux-build@v0.7.1-manylinux2010_x86_64 - with: - python-versions: cp310-cp310 - build-requirements: 'setuptools_scm' - pre-build-command: 'git config --global --add safe.directory "*"' - - - run: pip install --verbose dist/*manylinux*.whl - - - run: pip install pytest-codeblocks pytest - - run: python -c "import pytest_codeblocks; code=pytest_codeblocks.extract_from_file('README.md'); f=open('readme.m', 'w'); f.writelines(block.code for block in code if block.syntax=='Matlab'); f.close()" - - run: cat -n readme.m - - - uses: matlab-actions/setup-matlab@v2.6.1 - with: - release: R2024b - cache: true - - - run: mkdir readme_output - - - uses: matlab-actions/run-command@v2.4.0 - with: - startup-options: -nojvm - command: diary('readme_output/matlab.txt'), readme - - - uses: actions/upload-artifact@v4 - with: - name: readme_output-matlab - path: readme_output - From 5e1b665b178a6f54cee178dff5c29517dbd5f171 Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 17 Jun 2026 12:20:42 +0200 Subject: [PATCH 33/36] removed need for prebuilt packages from fortran in buildwheels, added build catalogues to .gitignore --- .github/workflows/buildwheels.yml | 1 - .gitignore | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/buildwheels.yml b/.github/workflows/buildwheels.yml index 65f63e76..7b598eba 100644 --- a/.github/workflows/buildwheels.yml +++ b/.github/workflows/buildwheels.yml @@ -288,7 +288,6 @@ jobs: readme_fortran: runs-on: ${{ matrix.os }} - needs: [build_wheels] strategy: fail-fast: false matrix: diff --git a/.gitignore b/.gitignore index 28191207..02e7f643 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ examples/tmp*.pdf examples/tmp*.svg examples/tmp*.gif -**/__pycache__/ \ No newline at end of file +**/__pycache__/ +build/* +readme_cpp/build/* \ No newline at end of file From b1f96944929a4bc83dde780e85a127f053821e48 Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 17 Jun 2026 13:00:56 +0200 Subject: [PATCH 34/36] Moved readme_cpp to README, made sure buildwheels pulls its code from there --- .github/workflows/buildwheels.yml | 8 +++ README.md | 89 ++++++++++++++++++++++++++++++- readme_cpp/CMakeLists.txt | 21 -------- readme_cpp/test.cpp | 55 ------------------- 4 files changed, 96 insertions(+), 77 deletions(-) delete mode 100644 readme_cpp/CMakeLists.txt delete mode 100644 readme_cpp/test.cpp diff --git a/.github/workflows/buildwheels.yml b/.github/workflows/buildwheels.yml index b05d41b1..3eaba458 100644 --- a/.github/workflows/buildwheels.yml +++ b/.github/workflows/buildwheels.yml @@ -381,6 +381,14 @@ jobs: temp=`find dist/ -name "*cp312*.whl"` python -m pip install $temp[examples] + - run: pip install pytest-codeblocks pytest + - run: mkdir readme_cpp + - run: python -c "import pytest_codeblocks; code=pytest_codeblocks.extract_from_file('README.md'); f=open('readme_cpp/test.cpp', 'w'); f.writelines(block.code for block in code if block.syntax=='cpp'); f.close()" + - run: cat -n readme_cpp/test.cpp + + - run: python -c "import pytest_codeblocks; code=pytest_codeblocks.extract_from_file('README.md'); f=open('readme_cpp/CMakeLists.txt', 'w'); f.writelines(block.code for block in code if block.syntax=='cmake'); f.close()" + - run: cat -n readme_cpp/CMakeLists.txt + - name: build run: | cd readme_cpp diff --git a/README.md b/README.md index 7bccf29c..1b157a09 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Additionally, the ability to easily package examples, simple simulations, and re instructors, and students, with nominal software and hardware requirements. Documentation of PyPartMC is hosted at https://open-atmos.github.io/PyPartMC. -PyPartMC is implemented in C++ and it also constitutes a C++ API to the PartMC Fortran internals. +PyPartMC is implemented in C++ and it also constitutes a C++ API to the PartMC Fortran internals (C++ example below). The Python API can facilitate using PartMC from other environments - see, e.g., Julia and Matlab examples below. For an outline of the project, rationale, architecture, and features, refer to: [D'Aquino et al., 2024 (SoftwareX)](https://doi.org/10.1016/j.softx.2023.101613) (please cite if PyPartMC is used in your research). @@ -176,7 +176,94 @@ aero_state.dist_sample(aero_dist) print(np.dot(aero_state.masses(), aero_state.num_concs), "# kg/m3") ``` +#### C++ + +```cpp +#include +#include +#include + +#include "PyPartMC.hpp" +#include "PyPartMC/si.hpp" + +int main() { + auto aero_data = std::make_shared(nlohmann::json({ + { {"OC", {1000.0 * si::kg / (si::m * si::m * si::m), 0.0, 1e-3 * si::kg / si::mol, 0.001, 0.0, 0.0}} }, + { {"BC", {1800.0 * si::kg / (si::m * si::m * si::m), 0.0, 1e-3 * si::kg / si::mol, 0.0, 0.0, 0.0}} } + })); + + auto aero_dist = AeroDist( + aero_data, + nlohmann::ordered_json::array({ + nlohmann::ordered_json::object({ + {"cooking", { + {"mass_frac", nlohmann::ordered_json::array({ nlohmann::ordered_json::object({{"OC", {1.0}}}) }) }, + {"diam_type", "geometric"}, + {"mode_type", "log_normal"}, + {"num_conc", 3200.0 / (si::cm * si::cm * si::cm)}, + {"geom_mean_diam", 8.64 * si::nm}, + {"log10_geom_std_dev", 0.28} + }}, + {"diesel", { + {"mass_frac", nlohmann::ordered_json::array({ nlohmann::ordered_json::object({{"OC", {0.3}}}), nlohmann::ordered_json::object({{"BC", {0.7}}}) }) }, + {"diam_type", "geometric"}, + {"mode_type", "log_normal"}, + {"num_conc", 2900.0 / (si::cm * si::cm * si::cm)}, + {"geom_mean_diam", 50.0 * si::nm}, + {"log10_geom_std_dev", 0.24} + }} + }) + }) + ); + + int n_part = 100; + auto aero_state = AeroState(aero_data, n_part, "nummass_source"); + + AeroState::dist_sample(aero_state, aero_dist, 1.0, 0.0, true, true); + + auto masses = AeroState::masses(aero_state, {}, {}); + auto num_concs = AeroState::num_concs(aero_state); + + double total_mass = std::inner_product( + std::begin(num_concs), std::end(num_concs), + std::begin(masses), + 0.0 + ); + + std::cout << std::scientific << total_mass << " # kg/m3\n"; + + return 0; +} +``` + +What can be compiled using CMake with following CMakeLists.txt: + +```cmake +cmake_minimum_required(VERSION 3.22) +project(AeroSimulation LANGUAGES CXX) + +enable_testing() +set(CMAKE_CXX_STANDARD 17) + +find_package(Python 3.8 REQUIRED COMPONENTS Interpreter) +execute_process( + COMMAND ${Python_EXECUTABLE} -c "import PyPartMC, pathlib; print(pathlib.Path(PyPartMC.cmake_dir()).as_posix())" + OUTPUT_VARIABLE PYPARTMC_CMAKE_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE +) +set(PyPartMC_DIR "${PYPARTMC_CMAKE_DIR}") + +find_package(PyPartMC REQUIRED) + +add_executable(my_test test.cpp) +target_link_libraries(my_test PRIVATE PyPartMC::PyPartMC) +pypartmc_setup_runtime(my_test) + +add_test(NAME maketest COMMAND my_test) +``` + #### Julia (using [PyCall.jl](https://github.com/JuliaPy/PyCall.jl)) + ```Julia using Pkg Pkg.add("PyCall") diff --git a/readme_cpp/CMakeLists.txt b/readme_cpp/CMakeLists.txt deleted file mode 100644 index cf94d549..00000000 --- a/readme_cpp/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -cmake_minimum_required(VERSION 3.22) -project(AeroSimulation LANGUAGES CXX) - -enable_testing() -set(CMAKE_CXX_STANDARD 17) - -find_package(Python 3.8 REQUIRED COMPONENTS Interpreter) -execute_process( - COMMAND ${Python_EXECUTABLE} -c "import PyPartMC, pathlib; print(pathlib.Path(PyPartMC.cmake_dir()).as_posix())" - OUTPUT_VARIABLE PYPARTMC_CMAKE_DIR - OUTPUT_STRIP_TRAILING_WHITESPACE -) -set(PyPartMC_DIR "${PYPARTMC_CMAKE_DIR}") - -find_package(PyPartMC REQUIRED) - -add_executable(my_test test.cpp) -target_link_libraries(my_test PRIVATE PyPartMC::PyPartMC) -pypartmc_setup_runtime(my_test) - -add_test(NAME maketest COMMAND my_test) \ No newline at end of file diff --git a/readme_cpp/test.cpp b/readme_cpp/test.cpp deleted file mode 100644 index b20a8656..00000000 --- a/readme_cpp/test.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include -#include -#include - -#include "PyPartMC.hpp" -#include "PyPartMC/si.hpp" - -int main() { - auto aero_data = std::make_shared(nlohmann::json({ - { {"OC", {1000.0 * si::kg / (si::m * si::m * si::m), 0.0, 1e-3 * si::kg / si::mol, 0.001, 0.0, 0.0}} }, - { {"BC", {1800.0 * si::kg / (si::m * si::m * si::m), 0.0, 1e-3 * si::kg / si::mol, 0.0, 0.0, 0.0}} } - })); - - auto aero_dist = AeroDist( - aero_data, - nlohmann::ordered_json::array({ - nlohmann::ordered_json::object({ - {"cooking", { - {"mass_frac", nlohmann::ordered_json::array({ nlohmann::ordered_json::object({{"OC", {1.0}}}) }) }, - {"diam_type", "geometric"}, - {"mode_type", "log_normal"}, - {"num_conc", 3200.0 / (si::cm * si::cm * si::cm)}, - {"geom_mean_diam", 8.64 * si::nm}, - {"log10_geom_std_dev", 0.28} - }}, - {"diesel", { - {"mass_frac", nlohmann::ordered_json::array({ nlohmann::ordered_json::object({{"OC", {0.3}}}), nlohmann::ordered_json::object({{"BC", {0.7}}}) }) }, - {"diam_type", "geometric"}, - {"mode_type", "log_normal"}, - {"num_conc", 2900.0 / (si::cm * si::cm * si::cm)}, - {"geom_mean_diam", 50.0 * si::nm}, - {"log10_geom_std_dev", 0.24} - }} - }) - }) - ); - - int n_part = 100; - auto aero_state = AeroState(aero_data, n_part, "nummass_source"); - - AeroState::dist_sample(aero_state, aero_dist, 1.0, 0.0, true, true); - - auto masses = AeroState::masses(aero_state, {}, {}); - auto num_concs = AeroState::num_concs(aero_state); - - double total_mass = std::inner_product( - std::begin(num_concs), std::end(num_concs), - std::begin(masses), - 0.0 - ); - - std::cout << std::scientific << total_mass << " # kg/m3\n"; - - return 0; -} \ No newline at end of file From 7e5e5e2d90458d4a5b39987f64864cf01f615ecd Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 17 Jun 2026 15:01:26 +0200 Subject: [PATCH 35/36] Installed numba and llvmlite idependently for cpp on macos, unified checkout versions to v4 and setup-python to v6 --- .github/workflows/buildwheels.yml | 35 ++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/.github/workflows/buildwheels.yml b/.github/workflows/buildwheels.yml index 3eaba458..6abc5fdd 100644 --- a/.github/workflows/buildwheels.yml +++ b/.github/workflows/buildwheels.yml @@ -232,14 +232,19 @@ jobs: matrix: os: [ubuntu-latest, ubuntu-24.04-arm] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: recursive - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v6 with: python-version: "3.13" - + + - uses: actions/download-artifact@v4 + with: + name: dist-${{matrix.os}} + path: dist + - run: | temp=`find dist/ -name "*cp313*.whl"` python -m pip install $temp[examples] @@ -263,14 +268,19 @@ jobs: matrix: os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: recursive - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v6 with: python-version: "3.13" - + + - uses: actions/download-artifact@v4 + with: + name: dist-${{matrix.os}} + path: dist + - run: | temp=`find dist/ -name "*cp313*.whl"` python -m pip install $temp[examples] @@ -293,7 +303,7 @@ jobs: matrix: os: [ubuntu-latest, ubuntu-24.04-arm] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: recursive @@ -321,7 +331,7 @@ jobs: runs-on: ubuntu-latest needs: [readme_julia, readme_python, readme_matlab, readme_fortran, readme_cpp] steps: - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v6 - run: pip install numpy - uses: actions/download-artifact@v4 with: @@ -338,7 +348,7 @@ jobs: matrix: os: [ubuntu-latest, ubuntu-24.04-arm, macos-15, macos-15-intel, windows-latest] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: recursive @@ -371,6 +381,7 @@ jobs: - if: startsWith(matrix.os, 'macos-') run: | brew reinstall gcc + pip install --only-binary=llvmlite numba llvmlite!=0.46.0b1 - uses: actions/download-artifact@v4 with: @@ -425,11 +436,11 @@ jobs: os: [ubuntu-latest] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: recursive - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v6 with: python-version: "3.10" @@ -438,7 +449,7 @@ jobs: name: dist-${{matrix.os}} path: dist - - run: pip install --verbose dist/*manylinux*.whl + - run: pip install --verbose dist/*cp310*manylinux*.whl - run: pip install pytest-codeblocks pytest - run: python -c "import pytest_codeblocks; code=pytest_codeblocks.extract_from_file('README.md'); f=open('readme.m', 'w'); f.writelines(block.code for block in code if block.syntax=='Matlab'); f.close()" From 476073d07355d58aac0d4ddd2eda74f5f40aecd1 Mon Sep 17 00:00:00 2001 From: orzel320 <52106515+orzel320@users.noreply.github.com> Date: Wed, 17 Jun 2026 18:19:14 +0200 Subject: [PATCH 36/36] ran black for __init__.py --- src/PyPartMC/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PyPartMC/__init__.py b/src/PyPartMC/__init__.py index 1abb55ec..d7295e54 100644 --- a/src/PyPartMC/__init__.py +++ b/src/PyPartMC/__init__.py @@ -73,6 +73,6 @@ def __build_extension_env(): setattr(nanobind, "nb_type_0", type(_PyPartMC.AeroData)) -#Function that returns cmakes config file location +# Function that returns cmakes config file location def cmake_dir() -> str: return os.path.join(os.path.dirname(__file__), "cmake")