diff --git a/.github/workflows/merge.yaml b/.github/workflows/merge.yaml index b06caaf4..71e1f134 100644 --- a/.github/workflows/merge.yaml +++ b/.github/workflows/merge.yaml @@ -30,3 +30,50 @@ jobs: with: doc_target: "simde_cxx_api" secrets: inherit + + platform_matrix: + uses: NWChemEx/.github/.github/workflows/platform_matrix.yaml@master + + build_pypi_dist: + needs: [tag-commit, platform_matrix] + strategy: + fail-fast: false + matrix: + include: ${{ fromJSON(needs.platform_matrix.outputs.release_matrix) }} + runs-on: ${{ matrix.os }} + steps: + - name: Build PyPI Distribution + uses: NWChemEx/.github/.github/actions/build_pypi_dist@master + with: + cibw_build: ${{ matrix.cibw_build }} + build_sdist: ${{ matrix.os == 'ubuntu-latest' && 'true' || 'false' }} + needs_mpi: "true" + needs_boost: "true" + + - name: Upload Distribution Artifact + uses: actions/upload-artifact@v4 + with: + name: dist-${{ matrix.os }} + path: dist/ + + # A separate, ubuntu-only publish job (rather than a publish step per + # build_pypi_dist leg) because pypa/gh-action-pypi-publish only runs on + # Linux, and because PyPI trusted publishing does not support reusable + # workflows (this job must be defined directly here, not delegated). + deploy_to_pypi: + needs: build_pypi_dist + runs-on: ubuntu-latest + permissions: + id-token: write + steps: + - name: Download All Distributions + uses: actions/download-artifact@v4 + with: + pattern: dist-* + path: dist + merge-multiple: true + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: dist/ diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index 13a475e6..a751b3e8 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -14,13 +14,20 @@ # name: Nightly Workflow +# Re-runs the same build/test jobs pull_request.yaml runs, on a schedule, to +# catch breakage that originates outside the repo (upstream dependency +# releases, refreshed GitHub runner images) rather than from a code change. +# Keep the job list below in sync with pull_request.yaml. on: schedule: - cron: "0 6 * * *" # Every day at 06:00 UTC (00:00 CST) jobs: - test_library: - uses: NWChemEx/.github/.github/workflows/test_nwx_library.yaml@master + test_cmake_build: + uses: NWChemEx/.github/.github/workflows/test_nwx_cmake_build.yaml@master with: - compilers: '["gcc-14", "clang-18"]' + run_python_tests: "true" + + test_pip_build: + uses: NWChemEx/.github/.github/workflows/test_nwx_pip_build.yaml@master diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index 7a6060df..cd68ed1e 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -13,7 +13,7 @@ # limitations under the License. # -name: .github Pull Request Workflow +name: Pull Request Workflow on: pull_request: @@ -29,7 +29,10 @@ jobs: with: doc_target: "simde_cxx_api" - test_library: - uses: NWChemEx/.github/.github/workflows/test_nwx_library.yaml@master + test_cmake_build: + uses: NWChemEx/.github/.github/workflows/test_nwx_cmake_build.yaml@master with: - compilers: '["gcc-14", "clang-18"]' + run_python_tests: "true" + + test_pip_build: + uses: NWChemEx/.github/.github/workflows/test_nwx_pip_build.yaml@master diff --git a/.gitignore b/.gitignore index 09e31b5a..dc56d3f4 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,9 @@ toolchain.cmake # Commonly install to a subdirectory called install install/ + +# These are MacOS files +.DS_Store + +# Automatically installed in dev mode +.pre-commit-config.yaml diff --git a/CMakeLists.txt b/CMakeLists.txt index 6713c36d..1cb14d95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2022 NWChemEx-Project +# Copyright 2026 NWChemEx-Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,72 +14,39 @@ cmake_minimum_required(VERSION 3.14) -#Downloads common CMake modules used throughout NWChemEx +# Downloads common CMake modules used throughout NWChemEx. Included before +# project() so nwx_set_version() is available to compute the version. include(cmake/get_nwx_cmake.cmake) -#Sets the version to whatever git thinks it is -include(get_version_from_git) -get_version_from_git(simde_version "${CMAKE_CURRENT_LIST_DIR}") +# Version from scikit-build-core (wheels/sdists) or the latest git tag. +include(nwx_set_version) +nwx_set_version(simde_version "${CMAKE_CURRENT_LIST_DIR}") project(simde VERSION "${simde_version}" LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 20) -include(get_cmaize) -include(nwx_cxx_api_docs) - -### Paths ### -set(SIMDE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src") -set(SIMDE_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include") -set(SIMDE_TESTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests") -set(SIMDE_EXP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/experimental") - -nwx_cxx_api_docs("${SIMDE_SOURCE_DIR}" "${SIMDE_INCLUDE_DIR}") - -### Options ### -cmaize_option_list( - BUILD_TESTING OFF "Should we build the tests?" - BUILD_PYBIND11_PYBINDINGS ON "Build pybind11 python3 bindings?" - ENABLE_SIGMA OFF "Should we enable Sigma for uncertainty tracking?" -) +include(disable_in_source_builds) +include(set_default_nwx_options) -include(get_chemist) - -include(get_pluginplay) - -cmaize_add_library( - ${PROJECT_NAME} - SOURCE_DIR "${SIMDE_SOURCE_DIR}/${PROJECT_NAME}" - INCLUDE_DIRS "${SIMDE_INCLUDE_DIR}/${PROJECT_NAME}" - DEPENDS chemist pluginplay -) - -# N.B. this is a no-op if BUILD_PYBIND11_PYBINDINGS is not turned on -include(nwx_pybind11) -nwx_add_pybind11_module( +# Documentation target +include(nwx_cxx_api_docs) +nwx_cxx_api_docs("cxx/include" "cxx/src") + +# Dependencies: simde is header-only; its C++ deps come from chemist+pluginplay +include(get_dependencies) +get_dependencies(chemist pluginplay) + +# Build the library (header-only → nwx_library creates INTERFACE target) +include(nwx_library) +nwx_library(${PROJECT_NAME} "cxx/include" "cxx/src" + chemist pluginplay) + +# Python module +include(nwx_python_module) +nwx_python_module(${PROJECT_NAME} "cxx/src") + +# C++ tests +include(catch2_tests_from_dir) +catch2_tests_from_dir( + "unit_test_${PROJECT_NAME}" + "tests/cxx/unit_tests" ${PROJECT_NAME} - SOURCE_DIR "${SIMDE_SOURCE_DIR}/python" - DEPENDS "${PROJECT_NAME}" -) - -if("${BUILD_TESTING}") - set(CXX_TEST_DIR ${SIMDE_TESTS_DIR}/cxx) - set(PYTHON_TEST_DIR ${SIMDE_TESTS_DIR}/python) - - include(get_catch2) - - cmaize_add_tests( - test_unit_${PROJECT_NAME} - SOURCE_DIR "${CXX_TEST_DIR}/unit_tests" - INCLUDE_DIRS "${SIMDE_SOURCE_DIR}/${PROJECT_NAME}" - DEPENDS Catch2 ${PROJECT_NAME} - ) - - # N.B. these are no-ops if BUILD_PYBIND11_PYBINDINGS is not turned on - nwx_pybind11_tests( - py_simde "${PYTHON_TEST_DIR}/unit_tests/test_simde.py" - SUBMODULES pluginplay chemist tensorwrapper parallelzone - ) -endif() - -cmaize_add_package( - ${PROJECT_NAME} NAMESPACE nwx:: ) diff --git a/cmake/get_nwx_cmake.cmake b/cmake/get_nwx_cmake.cmake index c99674d9..9188ad48 100644 --- a/cmake/get_nwx_cmake.cmake +++ b/cmake/get_nwx_cmake.cmake @@ -1,4 +1,4 @@ -# Copyright 2024 NWChemEx-Project +# Copyright 2024 NWChemEx Community # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,18 +14,66 @@ include_guard() +# Puts the shared NWXCMake modules on CMAKE_MODULE_PATH. This runs *before* +# project() so factored helpers (e.g. nwx_set_version) are available to feed +# project(VERSION ...). +# +# Resolution order: +# 1. A pip-installed `nwxcmake` package (query it for its cmake/ dir). An +# editable install (`pip install -e /path/to/NWXCMake`) points at a local +# working copy, so NWXCMake edits are picked up with no git push. +# 2. Fallback: FetchContent from github.com/NWChemEx/NWXCMake. macro(get_nwx_cmake) - include(FetchContent) - FetchContent_Declare( - nwx_cmake - GIT_REPOSITORY https://github.com/NWChemEx/NWXCMake - ) - FetchContent_MakeAvailable(nwx_cmake) - set( - CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${nwx_cmake_SOURCE_DIR}/cmake" - CACHE STRING "" - FORCE - ) + if(NOT _NWX_CMAKE_MODULE_DIR) + # find_package(Python) needs no enabled language, so it is safe here, + # before project(). Request only the interpreter to avoid a dev/compiler + # probe this early. + find_package(Python QUIET COMPONENTS Interpreter) + + set(_gnc_local_dir "") + if(Python_Interpreter_FOUND) + execute_process( + COMMAND "${Python_EXECUTABLE}" -c + "import nwxcmake,sys;sys.stdout.write(nwxcmake.cmake_dir())" + OUTPUT_VARIABLE _gnc_local_dir + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE _gnc_rc + ERROR_QUIET + ) + if(NOT _gnc_rc EQUAL 0) + set(_gnc_local_dir "") + endif() + endif() + + if(_gnc_local_dir AND IS_DIRECTORY "${_gnc_local_dir}") + message(STATUS + "NWXCMake: using local pip package at ${_gnc_local_dir}" + ) + set(_gnc_resolved "${_gnc_local_dir}") + else() + message(STATUS + "NWXCMake: pip package not found; fetching from git" + ) + include(FetchContent) + FetchContent_Declare( + nwx_cmake + GIT_REPOSITORY https://github.com/NWChemEx/NWXCMake + ) + FetchContent_MakeAvailable(nwx_cmake) + set(_gnc_resolved "${nwx_cmake_SOURCE_DIR}/cmake") + endif() + + # Cache the resolved directory (not CMAKE_MODULE_PATH itself) so + # reconfigures are stable. Clear this var (or the build dir) to + # re-resolve after switching between the pip and git sources. + set(_NWX_CMAKE_MODULE_DIR "${_gnc_resolved}" + CACHE INTERNAL "Resolved NWXCMake module directory" + ) + endif() + + # Prepend so NWXCMake modules win; set in the caller's scope (macro), do not + # FORCE-cache CMAKE_MODULE_PATH (avoids accumulating stale entries). + list(PREPEND CMAKE_MODULE_PATH "${_NWX_CMAKE_MODULE_DIR}") endmacro() get_nwx_cmake() diff --git a/include/simde/basis_set/atomic_basis_set.hpp b/cxx/include/simde/basis_set/atomic_basis_set.hpp similarity index 100% rename from include/simde/basis_set/atomic_basis_set.hpp rename to cxx/include/simde/basis_set/atomic_basis_set.hpp diff --git a/include/simde/basis_set/basis_set.hpp b/cxx/include/simde/basis_set/basis_set.hpp similarity index 100% rename from include/simde/basis_set/basis_set.hpp rename to cxx/include/simde/basis_set/basis_set.hpp diff --git a/include/simde/basis_set/molecular_basis_set.hpp b/cxx/include/simde/basis_set/molecular_basis_set.hpp similarity index 100% rename from include/simde/basis_set/molecular_basis_set.hpp rename to cxx/include/simde/basis_set/molecular_basis_set.hpp diff --git a/include/simde/chemical_system/Z_from_symbol.hpp b/cxx/include/simde/chemical_system/Z_from_symbol.hpp similarity index 100% rename from include/simde/chemical_system/Z_from_symbol.hpp rename to cxx/include/simde/chemical_system/Z_from_symbol.hpp diff --git a/include/simde/chemical_system/atom.hpp b/cxx/include/simde/chemical_system/atom.hpp similarity index 100% rename from include/simde/chemical_system/atom.hpp rename to cxx/include/simde/chemical_system/atom.hpp diff --git a/include/simde/chemical_system/atomic_density_matrix.hpp b/cxx/include/simde/chemical_system/atomic_density_matrix.hpp similarity index 100% rename from include/simde/chemical_system/atomic_density_matrix.hpp rename to cxx/include/simde/chemical_system/atomic_density_matrix.hpp diff --git a/include/simde/chemical_system/chemical_system.hpp b/cxx/include/simde/chemical_system/chemical_system.hpp similarity index 100% rename from include/simde/chemical_system/chemical_system.hpp rename to cxx/include/simde/chemical_system/chemical_system.hpp diff --git a/include/simde/chemical_system/molecule_from_string.hpp b/cxx/include/simde/chemical_system/molecule_from_string.hpp similarity index 100% rename from include/simde/chemical_system/molecule_from_string.hpp rename to cxx/include/simde/chemical_system/molecule_from_string.hpp diff --git a/include/simde/chemical_system/symbol_from_Z.hpp b/cxx/include/simde/chemical_system/symbol_from_Z.hpp similarity index 100% rename from include/simde/chemical_system/symbol_from_Z.hpp rename to cxx/include/simde/chemical_system/symbol_from_Z.hpp diff --git a/include/simde/density/density.hpp b/cxx/include/simde/density/density.hpp similarity index 100% rename from include/simde/density/density.hpp rename to cxx/include/simde/density/density.hpp diff --git a/include/simde/density/initial_density.hpp b/cxx/include/simde/density/initial_density.hpp similarity index 100% rename from include/simde/density/initial_density.hpp rename to cxx/include/simde/density/initial_density.hpp diff --git a/include/simde/derivative/derivative.hpp b/cxx/include/simde/derivative/derivative.hpp similarity index 100% rename from include/simde/derivative/derivative.hpp rename to cxx/include/simde/derivative/derivative.hpp diff --git a/include/simde/derivative/derivative_pt.hpp b/cxx/include/simde/derivative/derivative_pt.hpp similarity index 100% rename from include/simde/derivative/derivative_pt.hpp rename to cxx/include/simde/derivative/derivative_pt.hpp diff --git a/include/simde/derivative/nuclear.hpp b/cxx/include/simde/derivative/nuclear.hpp similarity index 100% rename from include/simde/derivative/nuclear.hpp rename to cxx/include/simde/derivative/nuclear.hpp diff --git a/include/simde/derivative/traits.hpp b/cxx/include/simde/derivative/traits.hpp similarity index 100% rename from include/simde/derivative/traits.hpp rename to cxx/include/simde/derivative/traits.hpp diff --git a/include/simde/energy/ao_energy.hpp b/cxx/include/simde/energy/ao_energy.hpp similarity index 100% rename from include/simde/energy/ao_energy.hpp rename to cxx/include/simde/energy/ao_energy.hpp diff --git a/include/simde/energy/electrostatic_energy.hpp b/cxx/include/simde/energy/electrostatic_energy.hpp similarity index 100% rename from include/simde/energy/electrostatic_energy.hpp rename to cxx/include/simde/energy/electrostatic_energy.hpp diff --git a/include/simde/energy/energy.hpp b/cxx/include/simde/energy/energy.hpp similarity index 100% rename from include/simde/energy/energy.hpp rename to cxx/include/simde/energy/energy.hpp diff --git a/include/simde/energy/total_energy.hpp b/cxx/include/simde/energy/total_energy.hpp similarity index 100% rename from include/simde/energy/total_energy.hpp rename to cxx/include/simde/energy/total_energy.hpp diff --git a/include/simde/evaluate_braket/evaluate_braket.hpp b/cxx/include/simde/evaluate_braket/evaluate_braket.hpp similarity index 100% rename from include/simde/evaluate_braket/evaluate_braket.hpp rename to cxx/include/simde/evaluate_braket/evaluate_braket.hpp diff --git a/include/simde/integration_grids/collocation_matrix.hpp b/cxx/include/simde/integration_grids/collocation_matrix.hpp similarity index 100% rename from include/simde/integration_grids/collocation_matrix.hpp rename to cxx/include/simde/integration_grids/collocation_matrix.hpp diff --git a/include/simde/integration_grids/integration_grids.hpp b/cxx/include/simde/integration_grids/integration_grids.hpp similarity index 100% rename from include/simde/integration_grids/integration_grids.hpp rename to cxx/include/simde/integration_grids/integration_grids.hpp diff --git a/include/simde/integration_grids/molecular_grid.hpp b/cxx/include/simde/integration_grids/molecular_grid.hpp similarity index 100% rename from include/simde/integration_grids/molecular_grid.hpp rename to cxx/include/simde/integration_grids/molecular_grid.hpp diff --git a/include/simde/numerical_methods/eigen_solve.hpp b/cxx/include/simde/numerical_methods/eigen_solve.hpp similarity index 100% rename from include/simde/numerical_methods/eigen_solve.hpp rename to cxx/include/simde/numerical_methods/eigen_solve.hpp diff --git a/include/simde/numerical_methods/generalized_eigen_solve.hpp b/cxx/include/simde/numerical_methods/generalized_eigen_solve.hpp similarity index 100% rename from include/simde/numerical_methods/generalized_eigen_solve.hpp rename to cxx/include/simde/numerical_methods/generalized_eigen_solve.hpp diff --git a/include/simde/numerical_methods/numerical_methods.hpp b/cxx/include/simde/numerical_methods/numerical_methods.hpp similarity index 100% rename from include/simde/numerical_methods/numerical_methods.hpp rename to cxx/include/simde/numerical_methods/numerical_methods.hpp diff --git a/include/simde/optimize/optimize.hpp b/cxx/include/simde/optimize/optimize.hpp similarity index 100% rename from include/simde/optimize/optimize.hpp rename to cxx/include/simde/optimize/optimize.hpp diff --git a/include/simde/optimize/optimize_energy.hpp b/cxx/include/simde/optimize/optimize_energy.hpp similarity index 100% rename from include/simde/optimize/optimize_energy.hpp rename to cxx/include/simde/optimize/optimize_energy.hpp diff --git a/include/simde/optimize/optimize_pt.hpp b/cxx/include/simde/optimize/optimize_pt.hpp similarity index 100% rename from include/simde/optimize/optimize_pt.hpp rename to cxx/include/simde/optimize/optimize_pt.hpp diff --git a/include/simde/quantum_mechanics/fock_operator.hpp b/cxx/include/simde/quantum_mechanics/fock_operator.hpp similarity index 100% rename from include/simde/quantum_mechanics/fock_operator.hpp rename to cxx/include/simde/quantum_mechanics/fock_operator.hpp diff --git a/include/simde/quantum_mechanics/initial_guess.hpp b/cxx/include/simde/quantum_mechanics/initial_guess.hpp similarity index 100% rename from include/simde/quantum_mechanics/initial_guess.hpp rename to cxx/include/simde/quantum_mechanics/initial_guess.hpp diff --git a/include/simde/quantum_mechanics/quantum_mechanics.hpp b/cxx/include/simde/quantum_mechanics/quantum_mechanics.hpp similarity index 100% rename from include/simde/quantum_mechanics/quantum_mechanics.hpp rename to cxx/include/simde/quantum_mechanics/quantum_mechanics.hpp diff --git a/include/simde/quantum_mechanics/update_guess.hpp b/cxx/include/simde/quantum_mechanics/update_guess.hpp similarity index 100% rename from include/simde/quantum_mechanics/update_guess.hpp rename to cxx/include/simde/quantum_mechanics/update_guess.hpp diff --git a/include/simde/simde.hpp b/cxx/include/simde/simde.hpp similarity index 100% rename from include/simde/simde.hpp rename to cxx/include/simde/simde.hpp diff --git a/include/simde/types.hpp b/cxx/include/simde/types.hpp similarity index 100% rename from include/simde/types.hpp rename to cxx/include/simde/types.hpp diff --git a/include/simde/utils/convert.hpp b/cxx/include/simde/utils/convert.hpp similarity index 100% rename from include/simde/utils/convert.hpp rename to cxx/include/simde/utils/convert.hpp diff --git a/src/python/basis_set/export_basis_set.hpp b/cxx/src/simde/basis_set/export_basis_set.hpp similarity index 100% rename from src/python/basis_set/export_basis_set.hpp rename to cxx/src/simde/basis_set/export_basis_set.hpp diff --git a/src/python/chemical_system/export_chemical_system.hpp b/cxx/src/simde/chemical_system/export_chemical_system.hpp similarity index 100% rename from src/python/chemical_system/export_chemical_system.hpp rename to cxx/src/simde/chemical_system/export_chemical_system.hpp diff --git a/src/python/derivative/export_derivative.hpp b/cxx/src/simde/derivative/export_derivative.hpp similarity index 100% rename from src/python/derivative/export_derivative.hpp rename to cxx/src/simde/derivative/export_derivative.hpp diff --git a/src/python/energy/export_energy.hpp b/cxx/src/simde/energy/export_energy.hpp similarity index 100% rename from src/python/energy/export_energy.hpp rename to cxx/src/simde/energy/export_energy.hpp diff --git a/src/python/evaluate_braket/export_evaluate_braket.hpp b/cxx/src/simde/evaluate_braket/export_evaluate_braket.hpp similarity index 100% rename from src/python/evaluate_braket/export_evaluate_braket.hpp rename to cxx/src/simde/evaluate_braket/export_evaluate_braket.hpp diff --git a/src/python/module.cpp b/cxx/src/simde/export_simde.cpp similarity index 100% rename from src/python/module.cpp rename to cxx/src/simde/export_simde.cpp diff --git a/src/python/export_simde.hpp b/cxx/src/simde/export_simde.hpp similarity index 100% rename from src/python/export_simde.hpp rename to cxx/src/simde/export_simde.hpp diff --git a/src/python/numerical_methods/export_numerical_methods.hpp b/cxx/src/simde/numerical_methods/export_numerical_methods.hpp similarity index 100% rename from src/python/numerical_methods/export_numerical_methods.hpp rename to cxx/src/simde/numerical_methods/export_numerical_methods.hpp diff --git a/src/python/optimize/export_optimize.hpp b/cxx/src/simde/optimize/export_optimize.hpp similarity index 100% rename from src/python/optimize/export_optimize.hpp rename to cxx/src/simde/optimize/export_optimize.hpp diff --git a/src/python/quantum_mechanics/export_quantum_mechanics.hpp b/cxx/src/simde/quantum_mechanics/export_quantum_mechanics.hpp similarity index 100% rename from src/python/quantum_mechanics/export_quantum_mechanics.hpp rename to cxx/src/simde/quantum_mechanics/export_quantum_mechanics.hpp diff --git a/src/python/utils/export_utils.hpp b/cxx/src/simde/utils/export_utils.hpp similarity index 100% rename from src/python/utils/export_utils.hpp rename to cxx/src/simde/utils/export_utils.hpp diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..4557adf4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,52 @@ +# Copyright 2026 NWChemEx-Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[build-system] +requires = [ + "scikit-build-core>=0.10", + "setuptools-scm>=8", +] +build-backend = "scikit_build_core.build" + +[project] +name = "nwchemex-simde" +dynamic = ["version"] +description = "Simulation Domain Extensions for the NWChemEx ecosystem" +license = { text = "Apache-2.0" } +requires-python = ">=3.8" +dependencies = [ + "pybind11", + "nwchemex-nwxcmake>=0.1.0", + "nwchemex-pluginplay>=1.0.63", + "nwchemex-chemist>=1.3.44", +] + +[project.optional-dependencies] +dev = ["pytest", "pre-commit"] + +[tool.scikit-build] +metadata.version.provider = "scikit_build_core.metadata.setuptools_scm" +cmake.build-type = "Release" +cmake.args = ["-DBUILD_PYBIND11_BINDINGS=ON", "-DBUILD_TESTING=OFF"] +# All installed content comes from the CMake install; no pure-Python packages. +wheel.packages = [] +build-dir = "build" + +[tool.setuptools_scm] +fallback_version = "0.0.0" + +# For editable (developer) installs, also build the tests. +[[tool.scikit-build.overrides]] +if.state = "editable" +cmake.args = ["-DDEVELOPER_SETUP=ON"] diff --git a/tests/python/conftest.py b/tests/python/conftest.py new file mode 100644 index 00000000..d9c5a96e --- /dev/null +++ b/tests/python/conftest.py @@ -0,0 +1,35 @@ +# +# Copyright 2026 NWChemEx-Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import parallelzone as pz +import pytest + + +@pytest.fixture(scope="session", autouse=True) +def _session_runtime_view(): + """ + Holds a single RuntimeView for the whole pytest session. + + MPI may only be initialized/finalized once per process. The first + RuntimeView constructed owns that responsibility; individual test + modules construct their own RuntimeView per test (e.g. in setUp), + which is safe only as long as this session-scoped instance is still + alive to keep MPI initialized in between. Without this, pytest would + run each test module independently and MPI would be finalized after + the first module's tests finished, breaking every module after it. + """ + rv = pz.runtime.RuntimeView() + yield rv