interpn 0.2.6__tar.gz → 0.6.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. interpn-0.6.1/.cargo/config.toml +2 -0
  2. interpn-0.2.6/.github/workflows/CI.yml → interpn-0.6.1/.github/workflows/release-python.yml +22 -11
  3. interpn-0.6.1/.github/workflows/release-rust.yml +36 -0
  4. interpn-0.6.1/.github/workflows/test-python.yml +68 -0
  5. interpn-0.6.1/.github/workflows/test-rust.yml +42 -0
  6. {interpn-0.2.6 → interpn-0.6.1}/.gitignore +8 -1
  7. {interpn-0.2.6 → interpn-0.6.1}/.readthedocs.yml +5 -1
  8. interpn-0.6.1/CHANGELOG.md +74 -0
  9. interpn-0.6.1/Cargo.lock +864 -0
  10. interpn-0.6.1/Cargo.toml +56 -0
  11. {interpn-0.2.6 → interpn-0.6.1}/PKG-INFO +5 -4
  12. {interpn-0.2.6 → interpn-0.6.1}/README.md +92 -12
  13. interpn-0.6.1/benches/bench.rs +576 -0
  14. {interpn-0.2.6/test → interpn-0.6.1/benches}/bench_cpu.py +119 -59
  15. {interpn-0.2.6/test → interpn-0.6.1/benches}/bench_mem.py +6 -6
  16. {interpn-0.2.6 → interpn-0.6.1}/docs/1d_quality_of_fit_Rectilinear.svg +148 -148
  17. {interpn-0.2.6 → interpn-0.6.1}/docs/1d_quality_of_fit_Regular.svg +145 -145
  18. {interpn-0.2.6 → interpn-0.6.1}/docs/2d_quality_of_fit_Rectilinear.svg +247 -247
  19. {interpn-0.2.6 → interpn-0.6.1}/docs/2d_quality_of_fit_Regular.svg +245 -245
  20. {interpn-0.2.6 → interpn-0.6.1}/docs/3d_throughput_vs_nobs.svg +373 -495
  21. {interpn-0.2.6 → interpn-0.6.1}/docs/3d_throughput_vs_nobs_prealloc.svg +374 -496
  22. interpn-0.2.6/docs/6d_throughput_vs_nobs.svg → interpn-0.6.1/docs/4d_throughput_vs_nobs.svg +498 -646
  23. interpn-0.2.6/docs/6d_throughput_vs_nobs_prealloc.svg → interpn-0.6.1/docs/4d_throughput_vs_nobs_prealloc.svg +511 -650
  24. {interpn-0.2.6 → interpn-0.6.1}/docs/index.md +84 -12
  25. interpn-0.6.1/docs/perf.md +71 -0
  26. {interpn-0.2.6 → interpn-0.6.1}/docs/throughput_vs_dims_1000_obs.svg +141 -141
  27. {interpn-0.2.6 → interpn-0.6.1}/docs/throughput_vs_dims_1_obs.svg +165 -151
  28. interpn-0.6.1/examples/cubic_comparison.py +223 -0
  29. interpn-0.6.1/pyproject.toml +89 -0
  30. interpn-0.6.1/scripts/distr_pgo.sh +25 -0
  31. interpn-0.6.1/scripts/distr_pgo_install.sh +11 -0
  32. interpn-0.6.1/scripts/distr_pgo_profile.sh +20 -0
  33. interpn-0.6.1/scripts/native_pgo.sh +22 -0
  34. interpn-0.6.1/scripts/native_pgo_install.sh +6 -0
  35. interpn-0.6.1/scripts/native_pgo_profile.sh +15 -0
  36. interpn-0.6.1/scripts/pgo-profiles/pgo.profdata +0 -0
  37. interpn-0.6.1/scripts/profile_workload.py +95 -0
  38. {interpn-0.2.6 → interpn-0.6.1/src}/interpn/__init__.py +1 -0
  39. {interpn-0.2.6 → interpn-0.6.1/src}/interpn/multicubic_rectilinear.py +18 -19
  40. {interpn-0.2.6 → interpn-0.6.1/src}/interpn/multicubic_regular.py +18 -16
  41. {interpn-0.2.6 → interpn-0.6.1/src}/interpn/multilinear_rectilinear.py +15 -18
  42. {interpn-0.2.6 → interpn-0.6.1/src}/interpn/multilinear_regular.py +12 -15
  43. {interpn-0.2.6 → interpn-0.6.1/src}/interpn/raw.py +1 -1
  44. {interpn-0.2.6 → interpn-0.6.1/src}/interpn/serialization.py +4 -2
  45. interpn-0.6.1/src/lib.rs +121 -0
  46. interpn-0.6.1/src/multicubic/mod.rs +105 -0
  47. interpn-0.6.1/src/multicubic/rectilinear.rs +750 -0
  48. interpn-0.6.1/src/multicubic/rectilinear_recursive.rs +709 -0
  49. interpn-0.6.1/src/multicubic/regular.rs +776 -0
  50. interpn-0.6.1/src/multicubic/regular_recursive.rs +759 -0
  51. interpn-0.6.1/src/multilinear/mod.rs +12 -0
  52. interpn-0.6.1/src/multilinear/rectilinear.rs +484 -0
  53. interpn-0.6.1/src/multilinear/rectilinear_recursive.rs +439 -0
  54. interpn-0.6.1/src/multilinear/regular.rs +503 -0
  55. interpn-0.6.1/src/multilinear/regular_recursive.rs +457 -0
  56. interpn-0.6.1/src/one_dim/hold.rs +180 -0
  57. interpn-0.6.1/src/one_dim/linear.rs +170 -0
  58. interpn-0.6.1/src/one_dim/mod.rs +187 -0
  59. interpn-0.2.6/src/lib.rs → interpn-0.6.1/src/python.rs +25 -25
  60. interpn-0.6.1/src/testing.rs +25 -0
  61. interpn-0.6.1/src/utils.rs +25 -0
  62. {interpn-0.2.6 → interpn-0.6.1}/test/test_docs.py +2 -0
  63. interpn-0.6.1/test/test_examples.py +25 -0
  64. {interpn-0.2.6 → interpn-0.6.1}/test/test_multicubic_regular.py +2 -3
  65. {interpn-0.2.6 → interpn-0.6.1}/uv.lock +46 -27
  66. interpn-0.2.6/.cargo/config.toml +0 -3
  67. interpn-0.2.6/.github/workflows/test.yml +0 -40
  68. interpn-0.2.6/CHANGELOG.md +0 -39
  69. interpn-0.2.6/Cargo.lock +0 -298
  70. interpn-0.2.6/Cargo.toml +0 -28
  71. interpn-0.2.6/docs/perf.md +0 -61
  72. interpn-0.2.6/examples/cubic_comparison.py +0 -120
  73. interpn-0.2.6/pyproject.toml +0 -46
  74. {interpn-0.2.6 → interpn-0.6.1}/LICENSE-APACHE +0 -0
  75. {interpn-0.2.6 → interpn-0.6.1}/LICENSE-MIT +0 -0
  76. {interpn-0.2.6 → interpn-0.6.1}/docs/API_Docs.md +0 -0
  77. {interpn-0.2.6 → interpn-0.6.1}/docs/ram_vs_dims.svg +0 -0
  78. {interpn-0.2.6 → interpn-0.6.1}/docs/requirements.txt +0 -0
  79. {interpn-0.2.6 → interpn-0.6.1}/mkdocs.yml +0 -0
  80. {interpn-0.2.6 → interpn-0.6.1/src}/interpn/py.typed +0 -0
  81. {interpn-0.2.6 → interpn-0.6.1}/test/test_multicubic_rectilinear.py +0 -0
  82. {interpn-0.2.6 → interpn-0.6.1}/test/test_multilinear_rectilinear.py +0 -0
  83. {interpn-0.2.6 → interpn-0.6.1}/test/test_multilinear_regular.py +0 -0
@@ -0,0 +1,2 @@
1
+ [target.'cfg(any(target_arch = "x86_64", target_arch = "x64"))']
2
+ rustflags = ["-C", "target-feature=+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+cmpxchg16b,+avx,+avx2,+fma,+bmi1,+bmi2,+lzcnt,+pclmulqdq,+movbe"]
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # maturin generate-ci github
5
5
  #
6
- name: CI
6
+ name: release-python
7
7
 
8
8
  on:
9
9
  push:
@@ -15,6 +15,10 @@ permissions:
15
15
  contents: read
16
16
 
17
17
  jobs:
18
+ release_rust:
19
+ uses: ./.github/workflows/release-rust.yml
20
+ secrets: inherit
21
+
18
22
  linux:
19
23
  runs-on: ${{ matrix.platform.runner }}
20
24
  strategy:
@@ -33,7 +37,7 @@ jobs:
33
37
  target: s390x
34
38
  - runner: ubuntu-22.04
35
39
  target: ppc64le
36
- python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
40
+ python-version: ["3.13"] # Using stable abi3-py39
37
41
  steps:
38
42
  - uses: actions/checkout@v4
39
43
  - uses: actions/setup-python@v5
@@ -41,7 +45,7 @@ jobs:
41
45
  uses: PyO3/maturin-action@v1
42
46
  with:
43
47
  target: ${{ matrix.platform.target }}
44
- args: --release --out dist --find-interpreter -j 1
48
+ args: --release --out dist --find-interpreter --verbose -- "-Cprofile-use=${{github.workspace}}/scripts/pgo-profiles/pgo.profdata"
45
49
  # sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
46
50
  manylinux: auto
47
51
  - name: Upload wheels
@@ -63,7 +67,7 @@ jobs:
63
67
  target: aarch64
64
68
  - runner: ubuntu-22.04
65
69
  target: armv7
66
- python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
70
+ python-version: ["3.13"] # Using stable abi3-py39
67
71
  steps:
68
72
  - uses: actions/checkout@v4
69
73
  - uses: actions/setup-python@v5
@@ -71,7 +75,8 @@ jobs:
71
75
  uses: PyO3/maturin-action@v1
72
76
  with:
73
77
  target: ${{ matrix.platform.target }}
74
- args: --release --out dist --find-interpreter
78
+ # PGO profile specified in maturin args because passing rustflags wipes out x86_64 instruction sets
79
+ args: --release --out dist --find-interpreter --verbose -- "-Cprofile-use=${{github.workspace}}/scripts/pgo-profiles/pgo.profdata"
75
80
  # sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
76
81
  manylinux: musllinux_1_2
77
82
  - name: Upload wheels
@@ -89,9 +94,15 @@ jobs:
89
94
  target: x64
90
95
  - runner: windows-latest
91
96
  target: x86
92
- python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
97
+ python-version: ["3.13"] # Using stable abi3-py39
93
98
  steps:
94
99
  - uses: actions/checkout@v4
100
+
101
+ # Install Rust and Python separate from maturin and uv actions
102
+ # to try to avoid ending up with one or the other end up with
103
+ # the 32-bit version
104
+ - name: Install Rust toolchain
105
+ uses: dtolnay/rust-toolchain@stable
95
106
  - uses: actions/setup-python@v5
96
107
  with:
97
108
  architecture: ${{ matrix.platform.target }}
@@ -100,7 +111,7 @@ jobs:
100
111
  uses: PyO3/maturin-action@v1
101
112
  with:
102
113
  target: ${{ matrix.platform.target }}
103
- args: --release --out dist
114
+ args: --release --out dist --verbose -- "-Cprofile-use=${{github.workspace}}/scripts/pgo-profiles/pgo.profdata"
104
115
  # sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
105
116
  - name: Upload wheels
106
117
  uses: actions/upload-artifact@v4
@@ -117,7 +128,7 @@ jobs:
117
128
  target: x86_64
118
129
  - runner: macos-14
119
130
  target: aarch64
120
- python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
131
+ python-version: ["3.13"] # Using stable abi3-py39
121
132
  steps:
122
133
  - uses: actions/checkout@v4
123
134
  - uses: actions/setup-python@v5
@@ -125,7 +136,7 @@ jobs:
125
136
  uses: PyO3/maturin-action@v1
126
137
  with:
127
138
  target: ${{ matrix.platform.target }}
128
- args: --release --out dist --find-interpreter
139
+ args: --release --out dist --find-interpreter --verbose -- "-Cprofile-use=${{github.workspace}}/scripts/pgo-profiles/pgo.profdata"
129
140
  # sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
130
141
  - name: Upload wheels
131
142
  uses: actions/upload-artifact@v4
@@ -152,7 +163,7 @@ jobs:
152
163
  name: Release
153
164
  runs-on: ubuntu-latest
154
165
  # if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
155
- needs: [linux, musllinux, windows, macos, sdist]
166
+ needs: [release_rust, linux, musllinux, windows, macos, sdist]
156
167
  permissions:
157
168
  # Use to sign the release artifacts
158
169
  id-token: write
@@ -167,7 +178,7 @@ jobs:
167
178
  with:
168
179
  subject-path: 'wheels-*/*'
169
180
  - name: Publish to PyPI
170
- # if: ${{ startsWith(github.ref, 'refs/tags/') }}
181
+ if: github.ref == 'refs/heads/main'
171
182
  uses: PyO3/maturin-action@v1
172
183
  env:
173
184
  MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,36 @@
1
+ name: release-rust
2
+
3
+ permissions:
4
+ contents: read
5
+
6
+ on:
7
+ workflow_call:
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+
12
+ test_rust:
13
+ uses: ./.github/workflows/test-rust.yml
14
+
15
+ test_python:
16
+ # Don't release a rust crate version that breaks the python bindings
17
+ uses: ./.github/workflows/test-python.yml
18
+
19
+ release-rust:
20
+ name: Release Rust
21
+ runs-on: ubuntu-latest
22
+ needs: [test_rust, test_python]
23
+ steps:
24
+ - name: Checkout repository
25
+ uses: actions/checkout@v4
26
+ with:
27
+ fetch-depth: 0
28
+
29
+ - name: Install Rust toolchain
30
+ uses: dtolnay/rust-toolchain@stable
31
+
32
+ - name: Publish
33
+ if: github.ref == 'refs/heads/main'
34
+ env:
35
+ CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
36
+ run: cargo publish
@@ -0,0 +1,68 @@
1
+ name: test-python
2
+ on:
3
+ pull_request:
4
+ branches: [ "*" ]
5
+ workflow_call:
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ test_python:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ target: [x86_64]
14
+ python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
15
+ steps:
16
+ - uses: actions/checkout@v3
17
+ - name: Install uv
18
+ uses: astral-sh/setup-uv@v5
19
+ with:
20
+ python-version: ${{ matrix.python-version }}
21
+
22
+ - name: Install
23
+ run: |
24
+ uv venv
25
+ uv pip install -e .[test,bench]
26
+
27
+ - name: Format
28
+ run: uv run ruff check; uv run ruff format --check
29
+
30
+ - name: Static typing
31
+ run: uv run pyright ./src
32
+
33
+ - name: Test (without PGO)
34
+ run: |
35
+ uv run pytest .
36
+
37
+ test_pgo:
38
+ runs-on: ${{ matrix.platform.runner }}
39
+ strategy:
40
+ matrix:
41
+ platform:
42
+ - runner: windows-latest
43
+ - runner: ubuntu-latest
44
+ - runner: ubuntu-24.04-arm # aarch64
45
+ - runner: macos-13 # x86_64
46
+ - runner: macos-14 # aarch64
47
+ python-version: ["3.9"]
48
+ steps:
49
+ - uses: actions/checkout@v3
50
+ - name: Install uv
51
+ uses: astral-sh/setup-uv@v5
52
+ with:
53
+ python-version: ${{ matrix.python-version }}
54
+
55
+ - name: Install
56
+ run: |
57
+ uv venv
58
+ uv pip install .[test,bench]
59
+ rustup component add llvm-tools-preview
60
+
61
+ - name: Profile-Guided Optimization (PGO)
62
+ shell: bash
63
+ run: |
64
+ sh ./scripts/distr_pgo_install.sh
65
+
66
+ - name: Test (with PGO)
67
+ run: |
68
+ uv run --no-sync pytest .
@@ -0,0 +1,42 @@
1
+ name: test-rust
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [ "*" ]
6
+ workflow_call:
7
+ workflow_dispatch:
8
+
9
+ env:
10
+ CARGO_TERM_COLOR: always
11
+
12
+ jobs:
13
+ test_rust:
14
+
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - uses: actions/checkout@v3
19
+
20
+ - name: Install Rust toolchain
21
+ uses: dtolnay/rust-toolchain@stable
22
+
23
+ - name: Format
24
+ run: cargo fmt --check
25
+
26
+ - name: Lint
27
+ run: cargo clippy
28
+
29
+ - name: Check semver
30
+ uses: obi1kenobi/cargo-semver-checks-action@v2
31
+
32
+ - name: Run tests
33
+ run: cargo test
34
+
35
+ - name: Test no-std
36
+ run: |
37
+ rustup target add thumbv7em-none-eabihf
38
+ cargo build --target thumbv7em-none-eabihf --no-default-features
39
+
40
+ - name: Publish dry-run
41
+ if: github.ref != 'refs/heads/main'
42
+ run: cargo publish --dry-run
@@ -72,4 +72,11 @@ docs/_build/
72
72
  .python-version
73
73
 
74
74
  # Extra
75
- *.svg
75
+ *.svg
76
+
77
+ # Unmerged PGO profiles
78
+ *.profraw
79
+ *native.profdata
80
+
81
+ # cargo-semver-checks
82
+ semver-checks/
@@ -9,7 +9,11 @@ build:
9
9
  os: ubuntu-22.04
10
10
  tools:
11
11
  python: "3.11"
12
- rust: "1.70"
12
+ # rust: "1.90"
13
+ jobs:
14
+ pre_build:
15
+ # Rust 1.90 required but not available yet
16
+ - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain 1.90.0
13
17
 
14
18
  mkdocs:
15
19
  configuration: mkdocs.yml
@@ -0,0 +1,74 @@
1
+ # Changelog
2
+
3
+ ## 0.6.1 2025-10-10
4
+
5
+ ### Changed
6
+
7
+ * Python
8
+ * Pass PGO profile-use argument for rustc via maturin args instead of RUSTFLAGS to avoid overriding flags set in .cargo/config.toml
9
+ * Split PGO scripts into native and distribution variants
10
+ * Distribution variant tests the exact build configuration used for distribution
11
+ * Native variant builds with target-cpu=native to enable all available instruction sets
12
+ * Update baked PGO profile based on distribution build
13
+ * Only run pypi distribution for single python version, because ABI3 build is portable to later python versions
14
+ * Rust
15
+ * Add x64 to platforms where extra instruction sets are enabled in .cargo/config.toml to capture windows 64-bit x86
16
+
17
+ ## 0.6.0 2025-10-05
18
+
19
+ Combine python bindings project into rust crate to streamline development process.
20
+ Implement PGO (profile-guided optimization) for python releases, giving a 1.2-2x speedup for
21
+ dimensions 1-4 at the expense of a ~2x slowdown for higher dimensions.
22
+
23
+ ### Changed
24
+
25
+ * Python
26
+ * Port python project from `interpnpy` repo
27
+ * Implement PGO with hand-tuned profile workload
28
+ * !Set `linearize_extrapolation=True` as default for cubic interpolators
29
+ * Use pytest-cov for coverage testing
30
+ * Update test deps & add linter/formatter configuration
31
+ * Add uv lock and uv cache configuration
32
+ * Use uv for actions
33
+ * Add more vector instruction sets for x86_64 targets reflecting a ~2015-era CPU
34
+ * Rust
35
+ * Eliminate some length check error handling that is no longer necessary for const-generic flattened methods
36
+ * Add PyO3 bindings from python project as `python.rs` module behind `python` feature gate
37
+
38
+ ## 0.2.6 2025-09-27
39
+
40
+ 2-5x speedup and fully-analyzable call stack (no recursion) for lower dimensions
41
+ (1D-6D linear, 1D-4D cubic). Recursive methods still available for higher dimensions.
42
+
43
+ ### Changed
44
+
45
+ * Update rust deps
46
+ * Reduce boilerplate in bindings
47
+ * Update perf plots
48
+ * Use abi3-py39 for extension module build
49
+
50
+ ## 0.2.5 2025-03-14
51
+
52
+ ### Changed
53
+
54
+ * Update interpn rust dep
55
+ * ~2-6x speedup for lower-dimensional inputs
56
+ * Update bindings for latest pyo3 and numpy rust deps
57
+ * Add .cargo/config.toml with configuration to enable vector instruction sets for x86 targets
58
+ * ~10-30% speedup for regular grid methods on x86 machines (compounded with earlier 2-6x speedup)
59
+ * Regenerate CI configuration
60
+ * Support python 3.13
61
+
62
+ ## 0.2.3 2024-08-20
63
+
64
+ ### Changed
65
+
66
+ * Update interpn rust dep to 0.4.3 to capture upgraded linear methods
67
+
68
+ ## 0.2.2 2024-07-08
69
+
70
+ ### Changed
71
+
72
+ * Update python deps incl. numpy >2
73
+ * Update rust deps
74
+ * Support python 3.12