Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
67e910d
Added linting
mattkjames7 Apr 13, 2026
3e4943e
udpate C++ submodule
mattkjames7 Apr 13, 2026
1860385
Build binary with cmake
mattkjames7 Apr 13, 2026
6e0c5b8
update flake8 exclude directory
mattkjames7 Apr 13, 2026
2de6f6c
updated workflows to produce binary builds
mattkjames7 Apr 14, 2026
44a5582
update build
mattkjames7 Apr 14, 2026
021f747
fewer test runs
mattkjames7 Apr 14, 2026
2986085
fix linux build
mattkjames7 Apr 14, 2026
b2cbb31
more build fixes
mattkjames7 Apr 14, 2026
e181410
fewer macos builds
mattkjames7 Apr 14, 2026
5f630be
update linting
mattkjames7 Apr 14, 2026
9290a3c
don't install already present tools in macos
mattkjames7 Apr 14, 2026
15d3b63
linting fixes
mattkjames7 Apr 14, 2026
8436472
refactored cpplib
mattkjames7 Apr 14, 2026
cd52365
force datetimetools rebuild on x86 macos
mattkjames7 Apr 14, 2026
bfcdf77
update build to use scikit build core
mattkjames7 Apr 14, 2026
5152b1a
fix windows build
mattkjames7 Apr 14, 2026
21f400f
fix windows build
mattkjames7 Apr 14, 2026
d636c5e
fix windows build
mattkjames7 Apr 14, 2026
2ae062b
fix windows build
mattkjames7 Apr 14, 2026
7d74d37
reenable tests
mattkjames7 Apr 14, 2026
b0c7852
remove script
mattkjames7 Apr 14, 2026
9846f0c
added a new script
mattkjames7 Apr 14, 2026
b02cb3f
bump version to 1.5.0
mattkjames7 Apr 14, 2026
276a636
update readme
mattkjames7 Apr 14, 2026
ed27438
small changes
mattkjames7 Apr 14, 2026
25c7bdd
smoke testP
mattkjames7 Apr 14, 2026
fea6538
update windows DLL handling
mattkjames7 Apr 15, 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
30 changes: 30 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[flake8]
max-line-length = 160
extend-ignore = E203, W503
exclude =
.git,
__pycache__,
.venv,
build,
dist,
JupiterMag.egg-info,
JupiterMag/__data/libjupitermag
per-file-ignores =
*/__init__.py: F401
JupiterMag/Con2020/Field.py: F401,E712
JupiterMag/Con2020/Test.py: F841
JupiterMag/Con2020/_CFunctions.py: F401
JupiterMag/Con2020/_ReadTestData.py: F401
JupiterMag/Globals.py: F401
JupiterMag/Internal/Test.py: E722,E714,E741,W605
JupiterMag/Internal/_CFunctions.py: F401
JupiterMag/Internal/_ReadTestPos.py: F401
JupiterMag/Tools/GetLegendHandLab.py: F401,E722
JupiterMag/Tools/Python.py: F401,F841
JupiterMag/Tools/TestPigtail.py: F401
JupiterMag/Tools/TestTrace.py: F401
JupiterMag/Tools/Timer.py: E741
JupiterMag/TraceField.py: F401,F841,E714,W605
JupiterMag/_CFunctions.py: F401
JupiterMag/_CppLib.py: F401
JupiterMag/__data/libjupitermag/generateheader.py: F401,E741,E101,W191
259 changes: 214 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
name: CI

on:
workflow_dispatch:
workflow_call:
pull_request:
branches: [main]
workflow_dispatch:

jobs:
test-linux:
build-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- name: Checkout repository
Expand All @@ -18,34 +23,95 @@ jobs:
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.12"
python-version: ${{ matrix.python-version }}

- name: Install system dependencies
- name: Select manylinux Python tag
run: |
sudo apt-get update
sudo apt-get install -y cmake g++ ninja-build
case "${{ matrix.python-version }}" in
"3.10") echo "MANYLINUX_PYTAG=cp310-cp310" >> "$GITHUB_ENV" ;;
"3.11") echo "MANYLINUX_PYTAG=cp311-cp311" >> "$GITHUB_ENV" ;;
"3.12") echo "MANYLINUX_PYTAG=cp312-cp312" >> "$GITHUB_ENV" ;;
"3.13") echo "MANYLINUX_PYTAG=cp313-cp313" >> "$GITHUB_ENV" ;;
"3.14") echo "MANYLINUX_PYTAG=cp314-cp314" >> "$GITHUB_ENV" ;;
*)
echo "Unsupported python-version: ${{ matrix.python-version }}"
exit 1
;;
esac

- name: Build source distribution
- name: Build and repair wheel in manylinux container
run: |
python -m pip install --upgrade pip
python -m pip install build
python -m build --sdist
rm -rf dist wheelhouse
mkdir -p dist wheelhouse
docker run --rm \
-e PYTAG="${MANYLINUX_PYTAG}" \
-v "${{ github.workspace }}:/io" \
-w /io \
quay.io/pypa/manylinux_2_34:latest \
/bin/bash -lc '
set -euo pipefail
if ! command -v cmake >/dev/null 2>&1; then
dnf install -y cmake gcc gcc-c++ make ninja-build
fi
"/opt/python/${PYTAG}/bin/python" -m pip install --upgrade pip setuptools wheel build auditwheel
"/opt/python/${PYTAG}/bin/python" -m build --wheel -o dist
auditwheel repair dist/*.whl -w wheelhouse
'

- name: Create venv and install package
- name: Install wheel
run: |
python -m venv .venv
. .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install pytest dist/*.tar.gz
python3 -m venv env
source env/bin/activate
python -m pip install --upgrade wheelhouse/*.whl

- name: Smoke test import (non-3.14)
if: matrix.python-version != '3.14'
run: |
source env/bin/activate
python -c "import JupiterMag; print(JupiterMag.__version__)"

- name: Upload wheel artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wheels-linux-py${{ matrix.python-version }}
path: wheelhouse/*.whl

- name: Build sdist (Linux 3.14)
if: matrix.python-version == '3.14'
run: |
docker run --rm \
-e PYTAG="${MANYLINUX_PYTAG}" \
-v "${{ github.workspace }}:/io" \
-w /io \
quay.io/pypa/manylinux_2_34:latest \
/bin/bash -lc '
set -euo pipefail
"/opt/python/${PYTAG}/bin/python" -m pip install --upgrade pip setuptools wheel build
"/opt/python/${PYTAG}/bin/python" -m build --sdist -o dist
'

- name: Upload sdist artifact (Linux 3.14)
if: matrix.python-version == '3.14'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: sdist-linux-py${{ matrix.python-version }}
path: dist/*.tar.gz

- name: Run pytest from tests directory
if: matrix.python-version == '3.14'
Comment thread
mattkjames7 marked this conversation as resolved.
run: |
. .venv/bin/activate
source env/bin/activate
pip install pytest black flake8
cd tests
pytest -q

test-macos:
runs-on: macos-latest
build-macos:
runs-on: ${{ matrix.macos-version }}
strategy:
fail-fast: false
matrix:
macos-version: ["macos-15", "macos-15-intel"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- name: Checkout repository
Expand All @@ -56,34 +122,67 @@ jobs:
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.12"
python-version: ${{ matrix.python-version }}

- name: Install system dependencies
- name: Install build tools
run: |
brew update
brew install libtool
python3 -m venv env
source env/bin/activate
python -m pip install --upgrade pip setuptools wheel build

- name: Build source distribution
- name: Build wheel
run: |
python -m pip install --upgrade pip
python -m pip install build
python -m build --sdist
source env/bin/activate
export CMAKE_OSX_ARCHITECTURES="$(uname -m)"
export CMAKE_OSX_DEPLOYMENT_TARGET="11.0"
export MACOSX_DEPLOYMENT_TARGET="11.0"
rm -rf dist
mkdir -p dist
python -m build --wheel -o dist
ls -1 dist
if ls dist/*universal2*.whl >/dev/null 2>&1; then
echo "Unexpected universal2 wheel produced"
exit 1
fi

- name: Create venv and install package
- name: Install wheel
run: |
python -m venv .venv
. .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install pytest dist/*.tar.gz
source env/bin/activate
python -m pip install --upgrade dist/*.whl

- name: Run pytest from tests directory
- name: Smoke test import (non-3.14)
if: matrix.python-version != '3.14'
run: |
source env/bin/activate
python -c "import JupiterMag; print(JupiterMag.__version__)"

- name: Upload wheel artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wheels-${{ matrix.macos-version }}-py${{ matrix.python-version }}
path: dist/*.whl

- name: Run tests
if: matrix.python-version == '3.14'
run: |
. .venv/bin/activate
source env/bin/activate
if [[ "$(uname -m)" == "x86_64" ]]; then
# DateTimeTools may resolve to an arm64 wheel on Intel runners.
# Rebuild from source to guarantee a native x86_64 libdatetime.dylib.
python -m pip install --force-reinstall --no-binary DateTimeTools DateTimeTools
fi
pip install pytest black flake8
cd tests
pytest -q

test-windows:
build-windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- name: Checkout repository
Expand All @@ -94,7 +193,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.12"
python-version: ${{ matrix.python-version }}

- name: Set up MSYS2 toolchain
uses: msys2/setup-msys2@cafece8e6baf9247cf9b1bf95097b0b983cc558d # v2.31.0
Expand All @@ -104,26 +203,96 @@ jobs:
update: true
install: >-
mingw-w64-ucrt-x86_64-gcc
make
mingw-w64-ucrt-x86_64-cmake
mingw-w64-ucrt-x86_64-ninja

- name: Build source distribution
- name: Create venv
shell: pwsh
run: |
python -m pip install --upgrade pip
python -m pip install build
python -m build --sdist
python -m venv env

- name: Create venv and install package
- name: Build wheel
shell: pwsh
run: |
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install pytest (Get-ChildItem dist\*.tar.gz | Select-Object -First 1).FullName
.\env\Scripts\Activate.ps1
pip install --upgrade build wheel
$gccCandidates = @(Get-Command gcc.exe -All -ErrorAction Stop | Select-Object -ExpandProperty Source)
$gxxCandidates = @(Get-Command g++.exe -All -ErrorAction Stop | Select-Object -ExpandProperty Source)
$ninjaCandidates = @(Get-Command ninja.exe -All -ErrorAction Stop | Select-Object -ExpandProperty Source)
$cmakeCandidates = @(Get-Command cmake.exe -All -ErrorAction Stop | Select-Object -ExpandProperty Source)

- name: Run pytest from tests directory
Write-Host "gcc candidates: $($gccCandidates -join '; ')"
Write-Host "g++ candidates: $($gxxCandidates -join '; ')"
Write-Host "ninja candidates: $($ninjaCandidates -join '; ')"
Write-Host "cmake candidates: $($cmakeCandidates -join '; ')"

$gcc = $gccCandidates | Where-Object { $_ -match '[\\/](ucrt64|mingw64)[\\/]bin[\\/]' } | Select-Object -First 1
if (-not $gcc) { $gcc = $gccCandidates | Where-Object { $_ -match '(msys|mingw|ucrt)' } | Select-Object -First 1 }
if (-not $gcc) { $gcc = $gccCandidates | Select-Object -First 1 }

$gxx = $gxxCandidates | Where-Object { $_ -match '[\\/](ucrt64|mingw64)[\\/]bin[\\/]' } | Select-Object -First 1
if (-not $gxx) { $gxx = $gxxCandidates | Where-Object { $_ -match '(msys|mingw|ucrt)' } | Select-Object -First 1 }
if (-not $gxx) { $gxx = $gxxCandidates | Select-Object -First 1 }

$ninja = $ninjaCandidates | Where-Object { $_ -match '[\\/](ucrt64|mingw64)[\\/]bin[\\/]' } | Select-Object -First 1
if (-not $ninja) { $ninja = $ninjaCandidates | Where-Object { $_ -match '(msys|mingw|ucrt)' } | Select-Object -First 1 }
if (-not $ninja) { $ninja = $ninjaCandidates | Select-Object -First 1 }

$cmake = $cmakeCandidates | Where-Object { $_ -match '[\\/](ucrt64|mingw64)[\\/]bin[\\/]' } | Select-Object -First 1
if (-not $cmake) { $cmake = $cmakeCandidates | Where-Object { $_ -match '(msys|mingw|ucrt)' } | Select-Object -First 1 }
if (-not $cmake) { $cmake = $cmakeCandidates | Select-Object -First 1 }

if (-not $gcc -or -not $gxx -or -not $ninja -or -not $cmake) {
throw "Could not locate gcc/g++/ninja/cmake in PATH"
}

$toolBin = Split-Path -Parent $gcc
$env:PATH = "$toolBin;$env:PATH"

$gccForCmake = $gcc -replace '\\', '/'
$gxxForCmake = $gxx -replace '\\', '/'

$env:CMAKE_GENERATOR = "Ninja"
$env:CC = $gcc
$env:CXX = $gxx
$env:CMAKE_ARGS = "-DCMAKE_C_COMPILER:FILEPATH=$gccForCmake -DCMAKE_CXX_COMPILER:FILEPATH=$gxxForCmake"

Write-Host "Using gcc: $gcc"
Write-Host "Using g++: $gxx"
Write-Host "Using ninja: $ninja"
Write-Host "Using cmake: $cmake"
& $gcc --version
& $gxx --version
& $cmake --version
& $ninja --version
python -m build --wheel -o dist

- name: Install wheel
shell: pwsh
run: |
.\env\Scripts\Activate.ps1
$wheel = Get-ChildItem -Path dist -Filter *.whl | Select-Object -First 1
if (-not $wheel) { throw "No wheel found in dist/" }
python -m pip install --upgrade $wheel.FullName

- name: Smoke test import (non-3.14)
if: matrix.python-version != '3.14'
shell: pwsh
run: |
.\env\Scripts\Activate.ps1
python -c "import JupiterMag; print(JupiterMag.__version__)"

- name: Upload wheel artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wheels-windows-py${{ matrix.python-version }}
path: dist/*.whl

- name: Run tests
if: matrix.python-version == '3.14'
shell: pwsh
run: |
.\.venv\Scripts\Activate.ps1
.\env\Scripts\Activate.ps1
Set-Location tests
pip install pytest black flake8
pytest -q
Loading
Loading