Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 35 additions & 16 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
env:
USERNAME: GWmodel-Lab
FEED_URL: https://nuget.pkg.github.com/GWmodel-Lab/index.json
VCPKG_BINARY_SOURCES: "clear;nuget,github,readwrite"
USERNAME: ${{ github.repository_owner }}
FEED_URL: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json,readwrite"
VCPKG_USE_NUGET_CACHE: 1
permissions:
contents: read
Expand All @@ -41,7 +41,7 @@ jobs:
shell: pwsh
run: |
cd "$env:VCPKG_INSTALLATION_ROOT"
git fetch
git fetch --tags
git switch 2026.04.27 --detach

- name: Setup NuGet Credentials
Expand All @@ -50,36 +50,52 @@ jobs:
run: |
$VCPKG_EXE="$env:VCPKG_INSTALLATION_ROOT/vcpkg.exe"
$NUGET_EXE="$(.$VCPKG_EXE fetch nuget)"
.$NUGET_EXE sources remove -Name github -NonInteractive 2>$null
.$NUGET_EXE sources add -Source ${{ env.FEED_URL }} -Name github -UserName ${{ env.USERNAME }} -Password ${{ secrets.GITHUB_TOKEN }} -StorePasswordInClearText
.$NUGET_EXE setapikey ${{ secrets.GITHUB_TOKEN }} -Source "${{ env.FEED_URL }}"

- name: Install native dependencies
if: runner.os == 'Windows'
shell: pwsh
run: |
$vcpkg = "$env:VCPKG_INSTALLATION_ROOT/vcpkg.exe"
& $vcpkg install armadillo gsl openblas[threads] --triplet x64-windows

- name: Configure Vcpkg path
if: runner.os == 'Windows'
shell: pwsh
run: |
$vcpkgRoot = $env:VCPKG_INSTALLATION_ROOT -replace '\\', '/'
"VCPKG_ROOT_FWD=$vcpkgRoot" >> $env:GITHUB_ENV

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: "cp312-*"
CIBW_SKIP: "pp* *-musllinux* *-manylinux_i686* *-win32 *-macosx_x86_64"
CIBW_BEFORE_ALL_LINUX: >
apt-get update -qq &&
apt-get install -qq libarmadillo-dev libopenblas-dev libgsl-dev
if command -v apt-get >/dev/null; then
apt-get update -qq && apt-get install -qq libarmadillo-dev libopenblas-dev libgsl-dev;
elif command -v dnf >/dev/null; then
dnf install -y armadillo-devel openblas-devel gsl-devel;
elif command -v yum >/dev/null; then
yum install -y armadillo-devel openblas-devel gsl-devel;
else
echo "No supported package manager found" && exit 1;
fi
CIBW_ENVIRONMENT_LINUX: >
CMAKE_ARGS="-DWITH_TESTS=OFF"
PYGW_TEST_DATA="{project}/tests/londonhp100.csv"
CIBW_BEFORE_ALL_MACOS: brew install armadillo gsl openblas
CIBW_ENVIRONMENT_MACOS: >
CMAKE_ARGS="-DWITH_TESTS=OFF"
PYGW_TEST_DATA="{project}/tests/londonhp100.csv"
MACOSX_DEPLOYMENT_TARGET="10.14"
CIBW_BEFORE_ALL_WINDOWS: |
$vcpkg = "$env:VCPKG_INSTALLATION_ROOT/vcpkg.exe"
& $vcpkg install armadillo gsl openblas --triplet x64-windows
MACOSX_DEPLOYMENT_TARGET="15.0"
CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel
CIBW_ENVIRONMENT_WINDOWS: >
PATH="C:/vcpkg/installed/x64-windows/bin"
CMAKE_ARGS="-DWITH_TESTS=OFF -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake"
PYGW_TEST_DATA="{project}/tests/londonhp100.csv"
PATH="$VCPKG_ROOT_FWD/installed/x64-windows/bin;$PATH"
CMAKE_ARGS="-DWITH_TESTS=OFF -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT_FWD/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_PREFIX_PATH=$VCPKG_ROOT_FWD/installed/x64-windows"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >
python "${{ github.workspace }}/tools/repair_windows_wheel.py" {wheel} {dest_dir}
CIBW_TEST_COMMAND: "pytest {project}/tests -v"
CIBW_TEST_COMMAND: "pytest {project}/test -v"
CIBW_TEST_REQUIRES: pytest

- name: Upload wheels
Expand All @@ -93,6 +109,9 @@ jobs:
needs: build-wheels
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
environment:
name: pypi
url: https://pypi.org/project/pygwmodel/
permissions:
id-token: write

Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ jobs:
name: windows-latest
runs-on: windows-latest
env:
USERNAME: GWmodel-Lab
FEED_URL: https://nuget.pkg.github.com/GWmodel-Lab/index.json
VCPKG_BINARY_SOURCES: "clear;nuget,github,readwrite"
USERNAME: ${{ github.repository_owner }}
FEED_URL: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json,readwrite"
VCPKG_USE_NUGET_CACHE: 1
permissions:
contents: read
Expand All @@ -80,6 +80,7 @@ jobs:
run: |
$VCPKG_EXE="$env:VCPKG_INSTALLATION_ROOT/vcpkg.exe"
$NUGET_EXE="$(.$VCPKG_EXE fetch nuget)"
.$NUGET_EXE sources remove -Name github -NonInteractive 2>$null
.$NUGET_EXE sources add -Source ${{ env.FEED_URL }} -Name github -UserName ${{ env.USERNAME }} -Password ${{ secrets.GITHUB_TOKEN }} -StorePasswordInClearText
.$NUGET_EXE setapikey ${{ secrets.GITHUB_TOKEN }} -Source "${{ env.FEED_URL }}"

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,4 @@ cython_debug/
# Sphinx
!/doc/Makefile
_build/
.tmp*
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ endif()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development.Module)
find_package(Python 3.12 REQUIRED COMPONENTS Interpreter Development.Module Development.SABIModule)

# Detect the installed nanobind package and import it into CMake
execute_process(
Expand All @@ -49,6 +49,11 @@ if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif(MSVC)

if(WIN32)
# Prefer package config files (e.g. vcpkg-provided Armadillo config) over CMake modules.
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
endif()

add_subdirectory(libgwmodel)

add_subdirectory(src)
Expand All @@ -57,4 +62,3 @@ if(WITH_PYTESTS)
enable_testing()
add_subdirectory(test)
endif(WITH_PYTESTS)

9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ build-backend = "scikit_build_core.build"

[project]
name = "pygwmodel"
version = "0.1.0"
version = "0.0.1"
description = "A Python binding for GWmodel"
readme = "README.md"
requires-python = ">=3.12"
authors = [
{ name = "Yigong Hu", email = "yigong.hu@outlook.com" }
]
dependencies = [
"numpy",
"geopandas",
]

[project.urls]
Homepage = "https://github.com/GWmodel-Lab/pygwmodel"
Expand All @@ -28,7 +33,7 @@ wheel.py-api = "cp312"
build-verbosity = 1
build = "cp312-*"
skip = "pp* *-musllinux* *-manylinux_i686* *-win32 *-macosx_x86_64"
test-command = "pytest {project}/tests -v"
test-command = "pytest {project}/test -v"
test-requires = "pytest"

[tool.cibuildwheel.macos.environment]
Expand Down
Loading