Skip to content

Commit 5f7477a

Browse files
authored
Devel-C (#63)
Expand and harden C and Fortran binding support - add target-probed direct-C wrapping for scalars, pointers, arrays, strings, hidden outputs, status projection, collision forwarding, and exact ABI types - broaden Fortran support for character data, abstract hierarchies, generic constructors, ownership, and dependency-ordered compilation - complete semantic policy before planning and make generated cleanup safe across coercion, native-status, and result-conversion failures - add maintained libm, TA-Lib, BSPLINE, BLAS, LAPACK, FFTPACK, and MINPACK validation with portable compiler and platform coverage - reorganize tests around feature and pipeline ownership and strengthen end-to-end contract, build, and memory-safety evidence - rewrite the documentation around current workflows, support boundaries, architecture, and real-library examples while removing obsolete material - Remove old documentation and add c-support
1 parent 5c0d3ca commit 5f7477a

3,087 files changed

Lines changed: 35996 additions & 22979 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.githooks/pre-push‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ DOCUMENTATION_SMOKE_TESTS = (
1212
"tests/docs/test_user_content.py",
1313
)
1414
WRAPPER_SMOKE_TEST = (
15-
"tests/fortran/building_shared_library/end_to_end/test_source_build_modes.py::"
15+
"tests/fortran/infrastructure/building/end_to_end/test_source_build_modes.py::"
1616
"test_fortran_wrapper_default_module_name_does_not_collide_with_root_function"
1717
)
1818
REQUIRED_TESTS = ("tests/tools", "tests/workflows")

‎.github/pull_request_template.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
-
33

44
## Test plan
5-
- [ ] `PYTHONPATH=. pytest -q`
5+
- Focused commands run:
6+
- <!-- Add each command that you ran. -->
7+
- Skipped or CI-only coverage, including any real-library lanes:
8+
- <!-- Name skipped coverage and why it was not run locally. -->
69

710
## Merge checklist
811
- [ ] All required checks are **green**.

‎.github/workflows/merge-validation.yml‎

Lines changed: 12 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -439,113 +439,21 @@ jobs:
439439
python tools/print_pytest_failures.py "$report"
440440
done
441441
442-
native-libraries:
443-
name: BLAS + LAPACK + FFTPACK + MINPACK · Ubuntu 24.04 · Python 3.12
442+
real-libraries-portability:
443+
name: Real Libraries Portability
444444
needs: [unit-tests, unit-tests-macos]
445445
if: >-
446446
${{ !contains(github.event.pull_request.labels.*.name, 'ignore-real-library-wrappers') }}
447-
runs-on: ubuntu-24.04
448-
timeout-minutes: 120
449-
permissions:
450-
contents: read
451-
steps:
452-
- name: Checkout repository
453-
uses: actions/checkout@v4
454-
with:
455-
fetch-depth: 2
456-
- name: Set up Python
457-
uses: actions/setup-python@v5
458-
with:
459-
python-version: "3.12"
460-
- name: Install test dependencies
461-
run: |
462-
python -m pip install --upgrade pip
463-
python -m pip install -e ".[qa]"
464-
python -m pip install \
465-
"numpy==2.5.1" \
466-
"meson==1.11.2" \
467-
"ninja==1.13.0" \
468-
"scipy==1.18.0"
469-
- name: Install pinned GFortran and LAPACK link dependencies
470-
shell: bash
471-
run: |
472-
packages=(libblas-dev liblapack-dev)
473-
if ! command -v "$PRIK_GFORTRAN_BINARY" >/dev/null 2>&1; then
474-
packages+=("$PRIK_GFORTRAN_PACKAGE")
475-
fi
476-
sudo apt-get update
477-
sudo apt-get install --yes "${packages[@]}"
478-
compiler_dir="$RUNNER_TEMP/prik-gfortran"
479-
mkdir -p "$compiler_dir"
480-
ln -sf "$(command -v "$PRIK_GFORTRAN_BINARY")" "$compiler_dir/gfortran"
481-
echo "$compiler_dir" >> "$GITHUB_PATH"
482-
"$compiler_dir/gfortran" --version
483-
- name: Restore compiled native library cache
484-
uses: actions/cache@v4
485-
with:
486-
path: ${{ runner.temp }}/prik-real-library-native
487-
key: real-libraries-${{ runner.os }}-gfortran13-${{ hashFiles('examples/blas/native/**', 'examples/lapack/native/**') }}
488-
- name: Run BLAS example and CI full-surface audit
489-
env:
490-
PYTHONPATH: .
491-
HYPOTHESIS_PROFILE: ci
492-
PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR: ${{ runner.temp }}/prik-real-library-native
493-
run: |
494-
source examples/blas/build_all.sh
495-
python -m pytest -q examples/blas/tests examples/blas/ci/full_surface.py
496-
- name: Report reviewed LAPACK inventory
497-
env:
498-
PYTHONPATH: .
499-
run: |
500-
python - <<'PY'
501-
from examples.lapack.routine_inventory import (
502-
EXPECTED_LAPACK_PROCEDURES,
503-
EXPECTED_LAPACK_SOURCE_FILES,
504-
F2PY_SCALAR_WRITEBACK_ROUTINES,
505-
ROUTINE_GROUPS,
506-
ROUTINES,
507-
SCIPY_VERSION,
508-
)
509-
510-
print(f"SciPy version: {SCIPY_VERSION}")
511-
print(f"LAPACK implementation sources: {EXPECTED_LAPACK_SOURCE_FILES}")
512-
print(f"Expected PRIK procedures: {EXPECTED_LAPACK_PROCEDURES}")
513-
print(f"Selected float64 correctness routines: {len(ROUTINES)}")
514-
print(f"f2py scalar writebacks: {len(F2PY_SCALAR_WRITEBACK_ROUTINES)}")
515-
for family, routines in ROUTINE_GROUPS.items():
516-
print(f" {family}: {len(routines)}")
517-
PY
518-
- name: Run LAPACK example and CI full-surface audit
519-
env:
520-
PYTHONPATH: .
521-
HYPOTHESIS_PROFILE: ci
522-
PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR: ${{ runner.temp }}/prik-real-library-native
523-
run: |
524-
source examples/lapack/build_all.sh
525-
python -m pytest -q examples/lapack/tests examples/lapack/ci/full_surface.py
526-
- name: Run FFTPACK 31-procedure full-surface audit
527-
env:
528-
PYTHONPATH: .
529-
HYPOTHESIS_PROFILE: ci
530-
run: |
531-
source examples/fftpack/build_all.sh
532-
python -m pytest -q examples/fftpack/tests
533-
- name: Run MINPACK 22-procedure and parameter-array full-surface audit
534-
env:
535-
PYTHONPATH: .
536-
HYPOTHESIS_PROFILE: ci
537-
run: |
538-
source examples/minpack/build_all.sh
539-
python -m pytest -q examples/minpack/tests
447+
uses: ./.github/workflows/real-libraries-portability.yml
540448

541449
documentation-benchmark:
542450
name: Documentation performance benchmark · Ubuntu 24.04 ARM64 · Python 3.12
543-
needs: native-libraries
451+
needs: real-libraries-portability
544452
if: >-
545453
${{
546454
always() &&
547-
(needs.native-libraries.result == 'success' ||
548-
(needs.native-libraries.result == 'skipped' &&
455+
(needs.real-libraries-portability.result == 'success' ||
456+
(needs.real-libraries-portability.result == 'skipped' &&
549457
contains(github.event.pull_request.labels.*.name, 'ignore-real-library-wrappers')))
550458
}}
551459
runs-on: ubuntu-24.04-arm
@@ -687,7 +595,7 @@ jobs:
687595
- compiler-smoke-macos
688596
- unit-tests
689597
- unit-tests-macos
690-
- native-libraries
598+
- real-libraries-portability
691599
- documentation-benchmark
692600
- documentation-build
693601
runs-on: ubuntu-24.04
@@ -698,10 +606,10 @@ jobs:
698606
COMPILER_SMOKE_MACOS_RESULT: ${{ needs.compiler-smoke-macos.result }}
699607
UNIT_TESTS_RESULT: ${{ needs.unit-tests.result }}
700608
UNIT_TESTS_MACOS_RESULT: ${{ needs.unit-tests-macos.result }}
701-
NATIVE_LIBRARIES_RESULT: ${{ needs.native-libraries.result }}
609+
REAL_LIBRARIES_PORTABILITY_RESULT: ${{ needs.real-libraries-portability.result }}
702610
DOCUMENTATION_BENCHMARK_RESULT: ${{ needs.documentation-benchmark.result }}
703611
DOCUMENTATION_BUILD_RESULT: ${{ needs.documentation-build.result }}
704-
IGNORE_NATIVE_LIBRARIES: ${{ contains(github.event.pull_request.labels.*.name, 'ignore-real-library-wrappers') }}
612+
IGNORE_REAL_LIBRARIES_PORTABILITY: ${{ contains(github.event.pull_request.labels.*.name, 'ignore-real-library-wrappers') }}
705613
steps:
706614
- name: Require every staged validation result
707615
shell: bash
@@ -713,15 +621,15 @@ jobs:
713621
"compiler-smoke-macos=$COMPILER_SMOKE_MACOS_RESULT" \
714622
"unit-tests=$UNIT_TESTS_RESULT" \
715623
"unit-tests-macos=$UNIT_TESTS_MACOS_RESULT" \
716-
"native-libraries=$NATIVE_LIBRARIES_RESULT" \
624+
"real-libraries-portability=$REAL_LIBRARIES_PORTABILITY_RESULT" \
717625
"documentation-benchmark=$DOCUMENTATION_BENCHMARK_RESULT" \
718626
"documentation-build=$DOCUMENTATION_BUILD_RESULT"
719627
do
720628
stage=${staged_result%%=*}
721629
result=${staged_result#*=}
722-
if [[ "$stage" == "native-libraries" && \
630+
if [[ "$stage" == "real-libraries-portability" && \
723631
"$result" == "skipped" && \
724-
"$IGNORE_NATIVE_LIBRARIES" == "true" ]]; then
632+
"$IGNORE_REAL_LIBRARIES_PORTABILITY" == "true" ]]; then
725633
continue
726634
fi
727635
if [[ "$result" != "success" ]]; then
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
name: Real Libraries Portability
2+
3+
on:
4+
workflow_call:
5+
push:
6+
branches:
7+
- main
8+
- release/*
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
14+
concurrency:
15+
group: real-libraries-portability-${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
examples:
20+
name: Real Libraries Portability · ${{ matrix.target }} · Python 3.12
21+
runs-on: ${{ matrix.runner }}
22+
timeout-minutes: 120
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
include:
27+
- target: Linux x86-64
28+
cache_key: linux-x86-64
29+
runner: ubuntu-24.04
30+
fortran_compiler: gfortran-13
31+
fortran_c_compiler: gcc-13
32+
primary_c_compiler: gcc-13
33+
secondary_c_compiler: clang-18
34+
- target: Linux ARM64
35+
cache_key: linux-arm64
36+
runner: ubuntu-24.04-arm
37+
fortran_compiler: gfortran-13
38+
fortran_c_compiler: gcc-13
39+
primary_c_compiler: gcc-13
40+
secondary_c_compiler: clang-18
41+
- target: macOS Intel
42+
cache_key: macos-intel
43+
runner: macos-15-intel
44+
fortran_compiler: gfortran-13
45+
fortran_c_compiler: gcc-13
46+
primary_c_compiler: clang
47+
secondary_c_compiler: gcc-13
48+
- target: macOS ARM64
49+
cache_key: macos-arm64
50+
runner: macos-15
51+
fortran_compiler: gfortran-13
52+
fortran_c_compiler: gcc-13
53+
primary_c_compiler: clang
54+
secondary_c_compiler: gcc-13
55+
env:
56+
PRIK_REAL_LIBRARY_NATIVE_JOBS: "8"
57+
PYTHONPATH: .
58+
HYPOTHESIS_PROFILE: ci
59+
steps:
60+
- name: Checkout repository
61+
uses: actions/checkout@v4
62+
with:
63+
fetch-depth: 2
64+
- name: Set up Python 3.12
65+
uses: actions/setup-python@v5
66+
with:
67+
python-version: "3.12"
68+
- name: Install Ubuntu native dependencies
69+
if: runner.os == 'Linux'
70+
run: |
71+
sudo apt-get update
72+
sudo apt-get install --yes gfortran-13 libblas-dev liblapack-dev
73+
- name: Ensure macOS GNU compilers are available
74+
if: runner.os == 'macOS'
75+
run: |
76+
if ! command -v "${{ matrix.fortran_compiler }}" >/dev/null 2>&1 || \
77+
! command -v "${{ matrix.fortran_c_compiler }}" >/dev/null 2>&1; then
78+
brew install gcc@13
79+
fi
80+
- name: Configure GNU Fortran and C
81+
shell: bash
82+
run: |
83+
compiler_dir="$RUNNER_TEMP/prik-example-compilers"
84+
mkdir -p "$compiler_dir"
85+
ln -sf "$(command -v "${{ matrix.fortran_compiler }}")" "$compiler_dir/gfortran"
86+
ln -sf "$(command -v "${{ matrix.fortran_c_compiler }}")" "$compiler_dir/gcc"
87+
echo "$compiler_dir" >> "$GITHUB_PATH"
88+
echo "PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR=$RUNNER_TEMP/prik-example-native" >> "$GITHUB_ENV"
89+
echo "PRIK_TALIB_CACHE_DIR=$RUNNER_TEMP/prik-ta-lib-native" >> "$GITHUB_ENV"
90+
- name: Install example dependencies
91+
run: |
92+
python -m pip install --upgrade pip
93+
python -m pip install -e ".[qa]" \
94+
"numpy==2.5.1" \
95+
"meson==1.11.2" \
96+
"ninja==1.13.0" \
97+
"scipy==1.18.0"
98+
- name: Restore compiled BLAS and LAPACK cache
99+
uses: actions/cache@v4
100+
with:
101+
path: ${{ runner.temp }}/prik-example-native
102+
key: real-libraries-portability-${{ matrix.cache_key }}-gfortran13-${{ hashFiles('examples/native_library.py', 'examples/fortran/blas/native/**', 'examples/fortran/lapack/native/**', 'examples/fortran/lapack/support/**', 'examples/fortran/lapack/xblas_sources.txt') }}
103+
- name: Restore pinned TA-Lib cache
104+
uses: actions/cache@v4
105+
with:
106+
path: ${{ runner.temp }}/prik-ta-lib-native
107+
key: real-libraries-portability-${{ matrix.cache_key }}-ta-lib-v0.7.1-${{ hashFiles('examples/c/ta_lib/native_build.py') }}
108+
- name: Show target and compilers
109+
run: |
110+
uname -a
111+
python --version
112+
gfortran --version
113+
gcc --version
114+
"${{ matrix.primary_c_compiler }}" --version
115+
"${{ matrix.secondary_c_compiler }}" --version
116+
- name: Run libm with ${{ matrix.primary_c_compiler }}
117+
env:
118+
PRIK_LIBM_CC: ${{ matrix.primary_c_compiler }}
119+
run: |
120+
source examples/c/libm/build_all.sh
121+
python -m pytest -q examples/c/libm/tests
122+
- name: Run libm with ${{ matrix.secondary_c_compiler }}
123+
env:
124+
PRIK_LIBM_CC: ${{ matrix.secondary_c_compiler }}
125+
run: |
126+
source examples/c/libm/build_all.sh
127+
python -m pytest -q examples/c/libm/tests
128+
- name: Run TA-Lib with ${{ matrix.primary_c_compiler }}
129+
env:
130+
PRIK_TALIB_CC: ${{ matrix.primary_c_compiler }}
131+
run: |
132+
source examples/c/ta_lib/build_all.sh
133+
python -m pytest -q examples/c/ta_lib/tests
134+
- name: Run BLAS example
135+
run: |
136+
source examples/fortran/blas/build_all.sh
137+
python -m pytest -q examples/fortran/blas/tests
138+
if [[ "${{ matrix.target }}" == "Linux x86-64" ]]; then
139+
python -m pytest -q examples/fortran/blas/ci/full_surface.py
140+
fi
141+
- name: Run LAPACK example
142+
run: |
143+
source examples/fortran/lapack/build_all.sh
144+
python -m pytest -q examples/fortran/lapack/tests
145+
if [[ "${{ matrix.target }}" == "Linux x86-64" ]]; then
146+
python -m pytest -q examples/fortran/lapack/ci/full_surface.py
147+
fi
148+
- name: Run FFTPACK example
149+
run: |
150+
source examples/fortran/fftpack/build_all.sh
151+
python -m pytest -q examples/fortran/fftpack/tests
152+
- name: Run MINPACK example
153+
run: |
154+
source examples/fortran/minpack/build_all.sh
155+
python -m pytest -q examples/fortran/minpack/tests
156+
- name: Run BSPLINE-FORTRAN example
157+
run: |
158+
source examples/fortran/bspline/build_all.sh
159+
python -m pytest -q examples/fortran/bspline/tests

0 commit comments

Comments
 (0)