Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
1a6773a
build overhauled
ryanmrichard Jul 1, 2026
df26bf2
refactor CMake
ryanmrichard Jul 1, 2026
411eedb
code refactorization
ryanmrichard Jul 6, 2026
ab46103
add mac files to gitignore
ryanmrichard Jul 7, 2026
d4612cc
Retarget NWChemEx/ -> ryanmrichard/ for fork testing; adopt test_nwx_…
ryanmrichard Jul 8, 2026
e6cf406
Trigger CI (diagnostic empty commit)
ryanmrichard Jul 8, 2026
532a514
Trigger CI now that fork workflows are enabled
ryanmrichard Jul 8, 2026
623a3d0
Retarget NWXCMake FetchContent fallback to ryanmrichard/ for fork tes…
ryanmrichard Jul 8, 2026
e795616
Add trailing newline to .gitignore (pre-commit end-of-file-fixer)
ryanmrichard Jul 8, 2026
7e25f1b
Add TestPyPI publish job to merge.yaml; retarget NWXCMake build dep t…
ryanmrichard Jul 9, 2026
1709f7a
Use shared deploy_to_pypi.yaml (fixes macOS-leg publish failure)
ryanmrichard Jul 9, 2026
6e9ea08
Inline deploy_to_pypi (reusable workflows unsupported by PyPI trusted…
ryanmrichard Jul 9, 2026
6a7ef99
update pyproject.toml
ryanmrichard Aug 3, 2026
14f2576
add pre-commit to gitignore
ryanmrichard Aug 3, 2026
34371f0
update pyproject.toml
ryanmrichard Aug 3, 2026
9dba6eb
adds python build
ryanmrichard Aug 4, 2026
07286ce
move nwxcmake/pybind11 to project
ryanmrichard Aug 5, 2026
defa4ad
update nightly
ryanmrichard Aug 5, 2026
9609979
Migrate CI and dependencies from ryanmrichard to NWChemEx
ryanmrichard Aug 5, 2026
662475c
Fix CI: skip pytest in test_pip_build (no python test suite)
ryanmrichard Aug 5, 2026
61f302a
Fix CI: also skip ctest in test_pip_build (no editable-only DEVELOPER…
ryanmrichard Aug 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,48 @@ jobs:
with:
doc_target: "utilities_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' }}

- 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/
16 changes: 13 additions & 3 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,23 @@
#

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: "false"

test_pip_build:
uses: NWChemEx/.github/.github/workflows/test_nwx_pip_build.yaml@master
with:
run_python_tests: "false"
run_cmake_tests: "false"
12 changes: 9 additions & 3 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ jobs:
with:
doc_target: "utilities_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: "false"

test_pip_build:
uses: NWChemEx/.github/.github/workflows/test_nwx_pip_build.yaml@master
with:
run_python_tests: "false"
run_cmake_tests: "false"
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,9 @@ install/

# Users commonly store their specific CMake settings in a toolchain file
toolchain.cmake

# These are MacOS files
.DS_Store

# Automatically installed in dev mode
.pre-commit-config.yaml
55 changes: 20 additions & 35 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -14,46 +14,31 @@

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(utilities_version "${CMAKE_CURRENT_LIST_DIR}")
# Version from scikit-build-core (wheels/sdists) or the latest git tag.
include(nwx_set_version)
nwx_set_version(utilities_version "${CMAKE_CURRENT_LIST_DIR}")
project(utilities VERSION "${utilities_version}" LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)

include(get_cmaize)
include(nwx_cxx_api_docs)

### Paths ###
set(UTILITIES_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/include")
set(UTILITIES_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/src")
include(disable_in_source_builds)
include(set_default_nwx_options)

nwx_cxx_api_docs("${UTILITIES_SOURCE_DIR}" "${UTILITIES_INCLUDE_DIR}")
# Define the documentation target
include(nwx_cxx_api_docs)
nwx_cxx_api_docs("cxx/include" "cxx/src")

### Options ###
cmaize_option_list(
BUILD_TESTING OFF "Should we build the tests?"
)
# Build the library
include(nwx_library)
nwx_library(${PROJECT_NAME} "cxx/include" "cxx/src")

cmaize_add_library(
# Register the C++ tests
include(catch2_tests_from_dir)
catch2_tests_from_dir(
"unit_test_${PROJECT_NAME}"
"tests/cxx/unit_tests"
${PROJECT_NAME}
SOURCE_DIR "${UTILITIES_SOURCE_DIR}/${PROJECT_NAME}"
INCLUDE_DIRS "${UTILITIES_INCLUDE_DIR}/${PROJECT_NAME}"
PRIVATE_INCLUDES cxx/src
)

if("${BUILD_TESTING}")
set(UTILITIES_TEST_DIR "${CMAKE_CURRENT_LIST_DIR}/tests/unit_tests")

include(get_catch2)

cmaize_add_tests(
test_unit_${PROJECT_NAME}
SOURCE_DIR "${UTILITIES_TEST_DIR}"
INCLUDE_DIRS "${UTILITIES_SOURCE_DIR}/${PROJECT_NAME}"
DEPENDS Catch2 ${PROJECT_NAME}
)
endif()

cmaize_add_package(${PROJECT_NAME} NAMESPACE nwx::)
72 changes: 60 additions & 12 deletions cmake/get_nwx_cmake.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 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.
Expand All @@ -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()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
49 changes: 49 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# 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-utilities"
dynamic = ["version"]
description = "General-purpose C++ utilities for the NWChemEx ecosystem"
license = { text = "Apache-2.0" }
requires-python = ">=3.8"
dependencies = [
"nwchemex-nwxcmake>=0.1.0",
]

[project.optional-dependencies]
dev = ["pre-commit"]

[tool.scikit-build]
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
cmake.build-type = "Release"
cmake.args = ["-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"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading