interpn 0.2.6__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 (79) hide show
  1. interpn-0.6.0/.cargo/config.toml +2 -0
  2. interpn-0.2.6/.github/workflows/CI.yml → interpn-0.6.0/.github/workflows/release-python.yml +25 -3
  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.6 → interpn-0.6.0}/.gitignore +7 -1
  7. {interpn-0.2.6 → interpn-0.6.0}/.readthedocs.yml +5 -1
  8. {interpn-0.2.6 → interpn-0.6.0}/CHANGELOG.md +21 -0
  9. interpn-0.6.0/Cargo.lock +864 -0
  10. interpn-0.6.0/Cargo.toml +56 -0
  11. {interpn-0.2.6 → interpn-0.6.0}/PKG-INFO +5 -4
  12. {interpn-0.2.6 → interpn-0.6.0}/README.md +92 -12
  13. interpn-0.6.0/benches/bench.rs +576 -0
  14. {interpn-0.2.6/test → interpn-0.6.0/benches}/bench_cpu.py +119 -59
  15. {interpn-0.2.6/test → interpn-0.6.0/benches}/bench_mem.py +6 -6
  16. {interpn-0.2.6 → interpn-0.6.0}/docs/1d_quality_of_fit_Rectilinear.svg +147 -147
  17. {interpn-0.2.6 → interpn-0.6.0}/docs/1d_quality_of_fit_Regular.svg +2497 -2397
  18. {interpn-0.2.6 → interpn-0.6.0}/docs/2d_quality_of_fit_Rectilinear.svg +246 -246
  19. {interpn-0.2.6 → interpn-0.6.0}/docs/2d_quality_of_fit_Regular.svg +1678 -1632
  20. {interpn-0.2.6 → interpn-0.6.0}/docs/3d_throughput_vs_nobs.svg +376 -484
  21. {interpn-0.2.6 → interpn-0.6.0}/docs/3d_throughput_vs_nobs_prealloc.svg +377 -485
  22. interpn-0.2.6/docs/6d_throughput_vs_nobs.svg → interpn-0.6.0/docs/4d_throughput_vs_nobs.svg +508 -640
  23. interpn-0.2.6/docs/6d_throughput_vs_nobs_prealloc.svg → interpn-0.6.0/docs/4d_throughput_vs_nobs_prealloc.svg +510 -649
  24. {interpn-0.2.6 → interpn-0.6.0}/docs/index.md +84 -12
  25. interpn-0.6.0/docs/perf.md +71 -0
  26. {interpn-0.2.6 → interpn-0.6.0}/docs/throughput_vs_dims_1000_obs.svg +140 -140
  27. {interpn-0.2.6 → interpn-0.6.0}/docs/throughput_vs_dims_1_obs.svg +164 -150
  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.6 → interpn-0.6.0/src}/interpn/__init__.py +1 -0
  36. {interpn-0.2.6 → interpn-0.6.0/src}/interpn/multicubic_rectilinear.py +18 -19
  37. {interpn-0.2.6 → interpn-0.6.0/src}/interpn/multicubic_regular.py +18 -16
  38. {interpn-0.2.6 → interpn-0.6.0/src}/interpn/multilinear_rectilinear.py +15 -18
  39. {interpn-0.2.6 → interpn-0.6.0/src}/interpn/multilinear_regular.py +12 -15
  40. {interpn-0.2.6 → interpn-0.6.0/src}/interpn/raw.py +1 -1
  41. {interpn-0.2.6 → 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.6/src/lib.rs → interpn-0.6.0/src/python.rs +25 -25
  57. interpn-0.6.0/src/testing.rs +25 -0
  58. interpn-0.6.0/src/utils.rs +25 -0
  59. {interpn-0.2.6 → 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.6 → interpn-0.6.0}/test/test_multicubic_regular.py +2 -3
  62. {interpn-0.2.6 → interpn-0.6.0}/uv.lock +46 -27
  63. interpn-0.2.6/.cargo/config.toml +0 -3
  64. interpn-0.2.6/.github/workflows/test.yml +0 -40
  65. interpn-0.2.6/Cargo.lock +0 -298
  66. interpn-0.2.6/Cargo.toml +0 -28
  67. interpn-0.2.6/docs/perf.md +0 -61
  68. interpn-0.2.6/examples/cubic_comparison.py +0 -120
  69. interpn-0.2.6/pyproject.toml +0 -46
  70. {interpn-0.2.6 → interpn-0.6.0}/LICENSE-APACHE +0 -0
  71. {interpn-0.2.6 → interpn-0.6.0}/LICENSE-MIT +0 -0
  72. {interpn-0.2.6 → interpn-0.6.0}/docs/API_Docs.md +0 -0
  73. {interpn-0.2.6 → interpn-0.6.0}/docs/ram_vs_dims.svg +0 -0
  74. {interpn-0.2.6 → interpn-0.6.0}/docs/requirements.txt +0 -0
  75. {interpn-0.2.6 → interpn-0.6.0}/mkdocs.yml +0 -0
  76. {interpn-0.2.6 → interpn-0.6.0/src}/interpn/py.typed +0 -0
  77. {interpn-0.2.6 → interpn-0.6.0}/test/test_multicubic_rectilinear.py +0 -0
  78. {interpn-0.2.6 → interpn-0.6.0}/test/test_multilinear_rectilinear.py +0 -0
  79. {interpn-0.2.6 → 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:
@@ -39,11 +43,14 @@ jobs:
39
43
  - uses: actions/setup-python@v5
40
44
  - name: Build wheels
41
45
  uses: PyO3/maturin-action@v1
46
+ env:
47
+ RUSTFLAGS: "-Cprofile-use=${{github.workspace}}/scripts/pgo-profiles/interpn.profdata -Cmetadata=interpn_pgo"
42
48
  with:
43
49
  target: ${{ matrix.platform.target }}
44
50
  args: --release --out dist --find-interpreter -j 1
45
51
  # sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
46
52
  manylinux: auto
53
+ # rust-flags: "-Cprofile-use=${{github.workspace}}/scripts/pgo-profiles/interpn.profdata -Cmetadata=interpn_pgo"
47
54
  - name: Upload wheels
48
55
  uses: actions/upload-artifact@v4
49
56
  with:
@@ -69,11 +76,14 @@ jobs:
69
76
  - uses: actions/setup-python@v5
70
77
  - name: Build wheels
71
78
  uses: PyO3/maturin-action@v1
79
+ env:
80
+ RUSTFLAGS: "-Cprofile-use=${{github.workspace}}/scripts/pgo-profiles/interpn.profdata -Cmetadata=interpn_pgo"
72
81
  with:
73
82
  target: ${{ matrix.platform.target }}
74
83
  args: --release --out dist --find-interpreter
75
84
  # sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
76
85
  manylinux: musllinux_1_2
86
+ # rust-flags: "-Cprofile-use=${{github.workspace}}/scripts/pgo-profiles/interpn.profdata -Cmetadata=interpn_pgo"
77
87
  - name: Upload wheels
78
88
  uses: actions/upload-artifact@v4
79
89
  with:
@@ -92,16 +102,25 @@ jobs:
92
102
  python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
93
103
  steps:
94
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
95
111
  - uses: actions/setup-python@v5
96
112
  with:
97
113
  architecture: ${{ matrix.platform.target }}
98
114
  python-version: ${{ matrix.python-version }}
99
115
  - name: Build wheels
100
116
  uses: PyO3/maturin-action@v1
117
+ env:
118
+ RUSTFLAGS: "-Cprofile-use=${{github.workspace}}/scripts/pgo-profiles/interpn.profdata -Cmetadata=interpn_pgo"
101
119
  with:
102
120
  target: ${{ matrix.platform.target }}
103
121
  args: --release --out dist
104
122
  # sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
123
+ # rust-flags: "-Cprofile-use=${{github.workspace}}/scripts/pgo-profiles/interpn.profdata -Cmetadata=interpn_pgo"
105
124
  - name: Upload wheels
106
125
  uses: actions/upload-artifact@v4
107
126
  with:
@@ -123,10 +142,13 @@ jobs:
123
142
  - uses: actions/setup-python@v5
124
143
  - name: Build wheels
125
144
  uses: PyO3/maturin-action@v1
145
+ env:
146
+ RUSTFLAGS: "-Cprofile-use=${{github.workspace}}/scripts/pgo-profiles/interpn.profdata -Cmetadata=interpn_pgo"
126
147
  with:
127
148
  target: ${{ matrix.platform.target }}
128
149
  args: --release --out dist --find-interpreter
129
150
  # sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
151
+ # rust-flags: "-Cprofile-use=${{github.workspace}}/scripts/pgo-profiles/interpn.profdata -Cmetadata=interpn_pgo"
130
152
  - name: Upload wheels
131
153
  uses: actions/upload-artifact@v4
132
154
  with:
@@ -152,7 +174,7 @@ jobs:
152
174
  name: Release
153
175
  runs-on: ubuntu-latest
154
176
  # if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
155
- needs: [linux, musllinux, windows, macos, sdist]
177
+ needs: [release_rust, linux, musllinux, windows, macos, sdist]
156
178
  permissions:
157
179
  # Use to sign the release artifacts
158
180
  id-token: write
@@ -167,7 +189,7 @@ jobs:
167
189
  with:
168
190
  subject-path: 'wheels-*/*'
169
191
  - name: Publish to PyPI
170
- # if: ${{ startsWith(github.ref, 'refs/tags/') }}
192
+ if: github.ref == 'refs/heads/main'
171
193
  uses: PyO3/maturin-action@v1
172
194
  env:
173
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
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
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
+
3
24
  ## 0.2.6 2025-09-27
4
25
 
5
26
  2-5x speedup and fully-analyzable call stack (no recursion) for lower dimensions