interpn 0.2.5__tar.gz → 0.6.0__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 (86) hide show
  1. interpn-0.6.0/.cargo/config.toml +2 -0
  2. interpn-0.2.5/.github/workflows/CI.yml → interpn-0.6.0/.github/workflows/release-python.yml +31 -7
  3. interpn-0.6.0/.github/workflows/release-rust.yml +36 -0
  4. interpn-0.6.0/.github/workflows/test-python.yml +67 -0
  5. interpn-0.6.0/.github/workflows/test-rust.yml +42 -0
  6. {interpn-0.2.5 → interpn-0.6.0}/.gitignore +7 -1
  7. {interpn-0.2.5 → interpn-0.6.0}/.readthedocs.yml +5 -1
  8. interpn-0.6.0/CHANGELOG.md +60 -0
  9. interpn-0.6.0/Cargo.lock +864 -0
  10. interpn-0.6.0/Cargo.toml +56 -0
  11. interpn-0.6.0/PKG-INFO +30 -0
  12. interpn-0.2.5/PKG-INFO → interpn-0.6.0/README.md +94 -46
  13. interpn-0.6.0/benches/bench.rs +576 -0
  14. {interpn-0.2.5/test → interpn-0.6.0/benches}/bench_cpu.py +141 -59
  15. {interpn-0.2.5/test → interpn-0.6.0/benches}/bench_mem.py +6 -6
  16. interpn-0.6.0/docs/1d_quality_of_fit_Rectilinear.svg +3807 -0
  17. interpn-0.6.0/docs/1d_quality_of_fit_Regular.svg +4851 -0
  18. interpn-0.6.0/docs/2d_quality_of_fit_Rectilinear.svg +3405 -0
  19. interpn-0.6.0/docs/2d_quality_of_fit_Regular.svg +3469 -0
  20. {interpn-0.2.5 → interpn-0.6.0}/docs/3d_throughput_vs_nobs.svg +745 -811
  21. {interpn-0.2.5 → interpn-0.6.0}/docs/3d_throughput_vs_nobs_prealloc.svg +792 -858
  22. interpn-0.2.5/docs/6d_throughput_vs_nobs.svg → interpn-0.6.0/docs/4d_throughput_vs_nobs.svg +741 -851
  23. interpn-0.2.5/docs/6d_throughput_vs_nobs_prealloc.svg → interpn-0.6.0/docs/4d_throughput_vs_nobs_prealloc.svg +787 -897
  24. {interpn-0.2.5 → interpn-0.6.0}/docs/index.md +84 -12
  25. interpn-0.6.0/docs/perf.md +71 -0
  26. {interpn-0.2.5 → interpn-0.6.0}/docs/throughput_vs_dims_1000_obs.svg +642 -629
  27. interpn-0.6.0/docs/throughput_vs_dims_1_obs.svg +2282 -0
  28. interpn-0.6.0/examples/cubic_comparison.py +223 -0
  29. interpn-0.6.0/pyproject.toml +88 -0
  30. interpn-0.6.0/scripts/pgo-profiles/interpn.profdata +0 -0
  31. interpn-0.6.0/scripts/pgo.sh +10 -0
  32. interpn-0.6.0/scripts/pgo_install.sh +4 -0
  33. interpn-0.6.0/scripts/pgo_profile.sh +13 -0
  34. interpn-0.6.0/scripts/profile_workload.py +95 -0
  35. {interpn-0.2.5 → interpn-0.6.0/src}/interpn/__init__.py +1 -0
  36. {interpn-0.2.5 → interpn-0.6.0/src}/interpn/multicubic_rectilinear.py +18 -19
  37. {interpn-0.2.5 → interpn-0.6.0/src}/interpn/multicubic_regular.py +18 -16
  38. {interpn-0.2.5 → interpn-0.6.0/src}/interpn/multilinear_rectilinear.py +15 -18
  39. {interpn-0.2.5 → interpn-0.6.0/src}/interpn/multilinear_regular.py +12 -15
  40. {interpn-0.2.5 → interpn-0.6.0/src}/interpn/raw.py +1 -1
  41. {interpn-0.2.5 → interpn-0.6.0/src}/interpn/serialization.py +4 -2
  42. interpn-0.6.0/src/lib.rs +121 -0
  43. interpn-0.6.0/src/multicubic/mod.rs +105 -0
  44. interpn-0.6.0/src/multicubic/rectilinear.rs +750 -0
  45. interpn-0.6.0/src/multicubic/rectilinear_recursive.rs +709 -0
  46. interpn-0.6.0/src/multicubic/regular.rs +776 -0
  47. interpn-0.6.0/src/multicubic/regular_recursive.rs +759 -0
  48. interpn-0.6.0/src/multilinear/mod.rs +12 -0
  49. interpn-0.6.0/src/multilinear/rectilinear.rs +484 -0
  50. interpn-0.6.0/src/multilinear/rectilinear_recursive.rs +439 -0
  51. interpn-0.6.0/src/multilinear/regular.rs +503 -0
  52. interpn-0.6.0/src/multilinear/regular_recursive.rs +457 -0
  53. interpn-0.6.0/src/one_dim/hold.rs +180 -0
  54. interpn-0.6.0/src/one_dim/linear.rs +170 -0
  55. interpn-0.6.0/src/one_dim/mod.rs +187 -0
  56. interpn-0.2.5/src/lib.rs → interpn-0.6.0/src/python.rs +65 -94
  57. interpn-0.6.0/src/testing.rs +25 -0
  58. interpn-0.6.0/src/utils.rs +25 -0
  59. {interpn-0.2.5 → interpn-0.6.0}/test/test_docs.py +2 -0
  60. interpn-0.6.0/test/test_examples.py +25 -0
  61. {interpn-0.2.5 → interpn-0.6.0}/test/test_multicubic_regular.py +2 -3
  62. interpn-0.6.0/uv.lock +2142 -0
  63. interpn-0.2.5/.cargo/config.toml +0 -3
  64. interpn-0.2.5/.github/workflows/test.yml +0 -40
  65. interpn-0.2.5/CHANGELOG.md +0 -27
  66. interpn-0.2.5/Cargo.lock +0 -267
  67. interpn-0.2.5/Cargo.toml +0 -27
  68. interpn-0.2.5/README.md +0 -111
  69. interpn-0.2.5/docs/1d_quality_of_fit_Rectilinear.svg +0 -5356
  70. interpn-0.2.5/docs/1d_quality_of_fit_Regular.svg +0 -4771
  71. interpn-0.2.5/docs/2d_quality_of_fit_Rectilinear.svg +0 -3435
  72. interpn-0.2.5/docs/2d_quality_of_fit_Regular.svg +0 -3458
  73. interpn-0.2.5/docs/perf.md +0 -61
  74. interpn-0.2.5/docs/throughput_vs_dims_1_obs.svg +0 -2185
  75. interpn-0.2.5/examples/cubic_comparison.py +0 -120
  76. interpn-0.2.5/pyproject.toml +0 -46
  77. {interpn-0.2.5 → interpn-0.6.0}/LICENSE-APACHE +0 -0
  78. {interpn-0.2.5 → interpn-0.6.0}/LICENSE-MIT +0 -0
  79. {interpn-0.2.5 → interpn-0.6.0}/docs/API_Docs.md +0 -0
  80. {interpn-0.2.5 → interpn-0.6.0}/docs/ram_vs_dims.svg +0 -0
  81. {interpn-0.2.5 → interpn-0.6.0}/docs/requirements.txt +0 -0
  82. {interpn-0.2.5 → interpn-0.6.0}/mkdocs.yml +0 -0
  83. {interpn-0.2.5 → interpn-0.6.0/src}/interpn/py.typed +0 -0
  84. {interpn-0.2.5 → interpn-0.6.0}/test/test_multicubic_rectilinear.py +0 -0
  85. {interpn-0.2.5 → interpn-0.6.0}/test/test_multilinear_rectilinear.py +0 -0
  86. {interpn-0.2.5 → interpn-0.6.0}/test/test_multilinear_regular.py +0 -0
@@ -0,0 +1,2 @@
1
+ [target.'cfg(target_arch = "x86_64")']
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:
@@ -22,8 +26,9 @@ jobs:
22
26
  platform:
23
27
  - runner: ubuntu-22.04
24
28
  target: x86_64
25
- - runner: ubuntu-22.04
26
- target: x86
29
+ # Exclude 32-bit linux due to OOM issues during compilation & no demand
30
+ # - runner: ubuntu-22.04
31
+ # target: x86
27
32
  - runner: ubuntu-22.04
28
33
  target: aarch64
29
34
  - runner: ubuntu-22.04
@@ -38,11 +43,14 @@ jobs:
38
43
  - uses: actions/setup-python@v5
39
44
  - name: Build wheels
40
45
  uses: PyO3/maturin-action@v1
46
+ env:
47
+ RUSTFLAGS: "-Cprofile-use=${{github.workspace}}/scripts/pgo-profiles/interpn.profdata -Cmetadata=interpn_pgo"
41
48
  with:
42
49
  target: ${{ matrix.platform.target }}
43
- args: --release --out dist --find-interpreter
50
+ args: --release --out dist --find-interpreter -j 1
44
51
  # sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
45
52
  manylinux: auto
53
+ # rust-flags: "-Cprofile-use=${{github.workspace}}/scripts/pgo-profiles/interpn.profdata -Cmetadata=interpn_pgo"
46
54
  - name: Upload wheels
47
55
  uses: actions/upload-artifact@v4
48
56
  with:
@@ -68,11 +76,14 @@ jobs:
68
76
  - uses: actions/setup-python@v5
69
77
  - name: Build wheels
70
78
  uses: PyO3/maturin-action@v1
79
+ env:
80
+ RUSTFLAGS: "-Cprofile-use=${{github.workspace}}/scripts/pgo-profiles/interpn.profdata -Cmetadata=interpn_pgo"
71
81
  with:
72
82
  target: ${{ matrix.platform.target }}
73
83
  args: --release --out dist --find-interpreter
74
84
  # sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
75
85
  manylinux: musllinux_1_2
86
+ # rust-flags: "-Cprofile-use=${{github.workspace}}/scripts/pgo-profiles/interpn.profdata -Cmetadata=interpn_pgo"
76
87
  - name: Upload wheels
77
88
  uses: actions/upload-artifact@v4
78
89
  with:
@@ -91,15 +102,25 @@ jobs:
91
102
  python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
92
103
  steps:
93
104
  - uses: actions/checkout@v4
105
+
106
+ # Install Rust and Python separate from maturin and uv actions
107
+ # to try to avoid ending up with one or the other end up with
108
+ # the 32-bit version
109
+ - name: Install Rust toolchain
110
+ uses: dtolnay/rust-toolchain@stable
94
111
  - uses: actions/setup-python@v5
95
112
  with:
96
113
  architecture: ${{ matrix.platform.target }}
114
+ python-version: ${{ matrix.python-version }}
97
115
  - name: Build wheels
98
116
  uses: PyO3/maturin-action@v1
117
+ env:
118
+ RUSTFLAGS: "-Cprofile-use=${{github.workspace}}/scripts/pgo-profiles/interpn.profdata -Cmetadata=interpn_pgo"
99
119
  with:
100
120
  target: ${{ matrix.platform.target }}
101
- args: --release --out dist --find-interpreter
121
+ args: --release --out dist
102
122
  # sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
123
+ # rust-flags: "-Cprofile-use=${{github.workspace}}/scripts/pgo-profiles/interpn.profdata -Cmetadata=interpn_pgo"
103
124
  - name: Upload wheels
104
125
  uses: actions/upload-artifact@v4
105
126
  with:
@@ -121,10 +142,13 @@ jobs:
121
142
  - uses: actions/setup-python@v5
122
143
  - name: Build wheels
123
144
  uses: PyO3/maturin-action@v1
145
+ env:
146
+ RUSTFLAGS: "-Cprofile-use=${{github.workspace}}/scripts/pgo-profiles/interpn.profdata -Cmetadata=interpn_pgo"
124
147
  with:
125
148
  target: ${{ matrix.platform.target }}
126
149
  args: --release --out dist --find-interpreter
127
150
  # sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
151
+ # rust-flags: "-Cprofile-use=${{github.workspace}}/scripts/pgo-profiles/interpn.profdata -Cmetadata=interpn_pgo"
128
152
  - name: Upload wheels
129
153
  uses: actions/upload-artifact@v4
130
154
  with:
@@ -150,7 +174,7 @@ jobs:
150
174
  name: Release
151
175
  runs-on: ubuntu-latest
152
176
  # if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
153
- needs: [linux, musllinux, windows, macos, sdist]
177
+ needs: [release_rust, linux, musllinux, windows, macos, sdist]
154
178
  permissions:
155
179
  # Use to sign the release artifacts
156
180
  id-token: write
@@ -165,7 +189,7 @@ jobs:
165
189
  with:
166
190
  subject-path: 'wheels-*/*'
167
191
  - name: Publish to PyPI
168
- # if: ${{ startsWith(github.ref, 'refs/tags/') }}
192
+ if: github.ref == 'refs/heads/main'
169
193
  uses: PyO3/maturin-action@v1
170
194
  env:
171
195
  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,67 @@
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
+ rustup component add llvm-tools-preview
59
+
60
+ - name: Profile-Guided Optimization (PGO)
61
+ shell: bash
62
+ run: |
63
+ sh ./scripts/pgo_install.sh
64
+
65
+ - name: Test (with PGO)
66
+ run: |
67
+ 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,10 @@ docs/_build/
72
72
  .python-version
73
73
 
74
74
  # Extra
75
- *.svg
75
+ *.svg
76
+
77
+ # Unmerged PGO profiles
78
+ *.profraw
79
+
80
+ # cargo-semver-checks
81
+ 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,60 @@
1
+ # Changelog
2
+
3
+ ## 0.6.0 2025-10-05
4
+
5
+ Combine python bindings project into rust crate to streamline development process.
6
+ Implement PGO (profile-guided optimization) for python releases, giving a 1.2-2x speedup for
7
+ dimensions 1-4 at the expense of a ~2x slowdown for higher dimensions.
8
+
9
+ ### Changed
10
+
11
+ * Python
12
+ * Port python project from `interpnpy` repo
13
+ * Implement PGO with hand-tuned profile workload
14
+ * !Set `linearize_extrapolation=True` as default for cubic interpolators
15
+ * Use pytest-cov for coverage testing
16
+ * Update test deps & add linter/formatter configuration
17
+ * Add uv lock and uv cache configuration
18
+ * Use uv for actions
19
+ * Add more vector instruction sets for x86_64 targets reflecting a ~2015-era CPU
20
+ * Rust
21
+ * Eliminate some length check error handling that is no longer necessary for const-generic flattened methods
22
+ * Add PyO3 bindings from python project as `python.rs` module behind `python` feature gate
23
+
24
+ ## 0.2.6 2025-09-27
25
+
26
+ 2-5x speedup and fully-analyzable call stack (no recursion) for lower dimensions
27
+ (1D-6D linear, 1D-4D cubic). Recursive methods still available for higher dimensions.
28
+
29
+ ### Changed
30
+
31
+ * Update rust deps
32
+ * Reduce boilerplate in bindings
33
+ * Update perf plots
34
+ * Use abi3-py39 for extension module build
35
+
36
+ ## 0.2.5 2025-03-14
37
+
38
+ ### Changed
39
+
40
+ * Update interpn rust dep
41
+ * ~2-6x speedup for lower-dimensional inputs
42
+ * Update bindings for latest pyo3 and numpy rust deps
43
+ * Add .cargo/config.toml with configuration to enable vector instruction sets for x86 targets
44
+ * ~10-30% speedup for regular grid methods on x86 machines (compounded with earlier 2-6x speedup)
45
+ * Regenerate CI configuration
46
+ * Support python 3.13
47
+
48
+ ## 0.2.3 2024-08-20
49
+
50
+ ### Changed
51
+
52
+ * Update interpn rust dep to 0.4.3 to capture upgraded linear methods
53
+
54
+ ## 0.2.2 2024-07-08
55
+
56
+ ### Changed
57
+
58
+ * Update python deps incl. numpy >2
59
+ * Update rust deps
60
+ * Support python 3.12