pylibsparseir 0.7.4__cp312-cp312-macosx_15_0_arm64.whl
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.
- pylibsparseir/__init__.py +31 -0
- pylibsparseir/clean_build_artifacts.py +71 -0
- pylibsparseir/constants.py +39 -0
- pylibsparseir/core.py +641 -0
- pylibsparseir/ctypes_autogen.py +117 -0
- pylibsparseir/ctypes_wrapper.py +44 -0
- pylibsparseir/libsparse_ir_capi.dylib +0 -0
- pylibsparseir/sparseir.h +1874 -0
- pylibsparseir-0.7.4.dist-info/METADATA +209 -0
- pylibsparseir-0.7.4.dist-info/RECORD +12 -0
- pylibsparseir-0.7.4.dist-info/WHEEL +6 -0
- pylibsparseir-0.7.4.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pylibsparseir
|
|
3
|
+
Version: 0.7.4
|
|
4
|
+
Summary: Python bindings for the sparse-ir-capi library
|
|
5
|
+
Project-URL: Homepage, https://github.com/SpM-lab/sparse-ir-rs
|
|
6
|
+
Project-URL: Documentation, https://github.com/SpM-lab/sparse-ir-rs
|
|
7
|
+
Project-URL: Repository, https://github.com/SpM-lab/sparse-ir-rs
|
|
8
|
+
Project-URL: Issues, https://github.com/SpM-lab/sparse-ir-rs/issues
|
|
9
|
+
Maintainer: SpM-lab
|
|
10
|
+
License: MIT License
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2024 SpM-lab
|
|
13
|
+
|
|
14
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
16
|
+
in the Software without restriction, including without limitation the rights
|
|
17
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
19
|
+
furnished to do so, subject to the following conditions:
|
|
20
|
+
|
|
21
|
+
The above copyright notice and this permission notice shall be included in all
|
|
22
|
+
copies or substantial portions of the Software.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
+
SOFTWARE.
|
|
31
|
+
License-File: LICENSE
|
|
32
|
+
Classifier: Development Status :: 4 - Beta
|
|
33
|
+
Classifier: Intended Audience :: Developers
|
|
34
|
+
Classifier: Intended Audience :: Science/Research
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Operating System :: OS Independent
|
|
37
|
+
Classifier: Programming Language :: Python :: 3
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
41
|
+
Classifier: Programming Language :: Rust
|
|
42
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
43
|
+
Requires-Python: >=3.10
|
|
44
|
+
Requires-Dist: numpy>=1.26.4
|
|
45
|
+
Requires-Dist: scipy
|
|
46
|
+
Description-Content-Type: text/markdown
|
|
47
|
+
|
|
48
|
+
# Python bindings for sparse-ir-capi
|
|
49
|
+
|
|
50
|
+
This is a low-level binding for the [sparse-ir-capi](https://github.com/SpM-lab/sparse-ir-rs) Rust library.
|
|
51
|
+
|
|
52
|
+
## Requirements
|
|
53
|
+
|
|
54
|
+
- Python >= 3.10
|
|
55
|
+
- Rust toolchain (for building the Rust library)
|
|
56
|
+
- numpy >= 1.26.4
|
|
57
|
+
- scipy
|
|
58
|
+
|
|
59
|
+
### BLAS Support
|
|
60
|
+
|
|
61
|
+
This package automatically uses SciPy's BLAS backend for optimal performance. No additional BLAS installation is required - SciPy will provide the necessary BLAS functionality.
|
|
62
|
+
|
|
63
|
+
## Build
|
|
64
|
+
|
|
65
|
+
### Install Dependencies and Build
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Build the package (Rust library will be built automatically)
|
|
69
|
+
cd python
|
|
70
|
+
uv build
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
This will:
|
|
74
|
+
- Automatically build the Rust sparse-ir-capi library using Cargo (via CMake)
|
|
75
|
+
- Copy the built library and header files to the Python package
|
|
76
|
+
- Create both source distribution (sdist) and wheel packages
|
|
77
|
+
|
|
78
|
+
### Development Build
|
|
79
|
+
|
|
80
|
+
For development:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Install in development mode (will auto-prepare if needed)
|
|
84
|
+
uv sync
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Note for CI/CD**: The Rust library is built automatically during the Python package build. No separate build step is needed:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# In CI/CD scripts
|
|
91
|
+
cd python
|
|
92
|
+
uv build
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
See `.github-workflows-example.yml` for a complete GitHub Actions example.
|
|
96
|
+
|
|
97
|
+
### BLAS Configuration
|
|
98
|
+
|
|
99
|
+
The package automatically uses SciPy's BLAS backend, which provides optimized BLAS operations without requiring separate BLAS installation. The build system is configured to use SciPy's BLAS functions directly.
|
|
100
|
+
|
|
101
|
+
### Clean Build Artifacts
|
|
102
|
+
|
|
103
|
+
To remove build artifacts and files copied from the parent directory:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
uv run clean
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
This will remove:
|
|
110
|
+
- Build directories: `build/`, `dist/`, `*.egg-info`
|
|
111
|
+
- Compiled libraries: `pylibsparseir/*.so`, `pylibsparseir/*.dylib`, `pylibsparseir/*.dll`
|
|
112
|
+
- Cache directories: `pylibsparseir/__pycache__`
|
|
113
|
+
|
|
114
|
+
### Build Process Overview
|
|
115
|
+
|
|
116
|
+
The build process works as follows:
|
|
117
|
+
|
|
118
|
+
1. **CMake Configuration**: scikit-build-core invokes CMake, which:
|
|
119
|
+
- Finds the Cargo executable
|
|
120
|
+
- Sets up build targets for the Rust library
|
|
121
|
+
|
|
122
|
+
2. **Rust Library Build**: CMake calls Cargo to build `sparse-ir-capi`:
|
|
123
|
+
- Compiles the Rust library to a shared library (`.so`, `.dylib`, or `.dll`)
|
|
124
|
+
- Generates C header file (`sparseir.h`) using cbindgen (via build.rs)
|
|
125
|
+
- Copies the library and header to the `pylibsparseir` directory
|
|
126
|
+
|
|
127
|
+
3. **Python Package Building**: `uv build` or `uv sync`:
|
|
128
|
+
- Packages everything into distributable wheels and source distributions
|
|
129
|
+
|
|
130
|
+
4. **Installation**: The built package includes the compiled shared library and Python bindings
|
|
131
|
+
|
|
132
|
+
### Conda Build
|
|
133
|
+
|
|
134
|
+
This package can also be built and distributed via conda-forge. The conda recipe is located in `conda-recipe/` and supports multiple platforms and Python versions.
|
|
135
|
+
|
|
136
|
+
**Building conda packages locally:**
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Install conda-build
|
|
140
|
+
conda install conda-build
|
|
141
|
+
|
|
142
|
+
# Build the conda package
|
|
143
|
+
cd python
|
|
144
|
+
conda build conda-recipe
|
|
145
|
+
|
|
146
|
+
# Build for specific platforms
|
|
147
|
+
conda build conda-recipe --platform linux-64
|
|
148
|
+
conda build conda-recipe --platform osx-64
|
|
149
|
+
conda build conda-recipe --platform osx-arm64
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Supported platforms:**
|
|
153
|
+
- Linux x86_64
|
|
154
|
+
- macOS Intel (x86_64)
|
|
155
|
+
- macOS Apple Silicon (ARM64)
|
|
156
|
+
|
|
157
|
+
**Supported Python versions:**
|
|
158
|
+
- Python 3.11, 3.12, 3.13
|
|
159
|
+
|
|
160
|
+
**Supported NumPy versions:**
|
|
161
|
+
- NumPy 2.1, 2.2, 2.3
|
|
162
|
+
|
|
163
|
+
The conda build automatically:
|
|
164
|
+
- Uses SciPy's BLAS backend for optimal performance
|
|
165
|
+
- Cleans up old shared libraries before building
|
|
166
|
+
- Builds platform-specific packages with proper dependencies
|
|
167
|
+
|
|
168
|
+
## Performance Notes
|
|
169
|
+
|
|
170
|
+
### BLAS Support
|
|
171
|
+
|
|
172
|
+
This package automatically uses SciPy's optimized BLAS backend for improved linear algebra performance:
|
|
173
|
+
|
|
174
|
+
- **Automatic BLAS**: Uses SciPy's BLAS functions for optimal performance
|
|
175
|
+
- **No additional setup**: SciPy provides all necessary BLAS functionality
|
|
176
|
+
|
|
177
|
+
The build system automatically configures BLAS support through SciPy. You can verify BLAS support by checking the build output for messages like:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
export SPARSEIR_DEBUG=1
|
|
181
|
+
python -c "import pylibsparseir"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
This will show:
|
|
185
|
+
```
|
|
186
|
+
BLAS support enabled
|
|
187
|
+
Registered SciPy BLAS dgemm @ 0x...
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Troubleshooting
|
|
191
|
+
|
|
192
|
+
**Build fails with missing Cargo:**
|
|
193
|
+
```bash
|
|
194
|
+
# Make sure Rust toolchain is installed
|
|
195
|
+
# Install from https://rustup.rs/
|
|
196
|
+
# Then retry:
|
|
197
|
+
cd python
|
|
198
|
+
uv build
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Clean rebuild:**
|
|
202
|
+
```bash
|
|
203
|
+
# Remove all build artifacts
|
|
204
|
+
uv run clean
|
|
205
|
+
cd ../sparse-ir-capi
|
|
206
|
+
cargo clean
|
|
207
|
+
cd ../python
|
|
208
|
+
uv build
|
|
209
|
+
```
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
pylibsparseir-0.7.4.dist-info/RECORD,,
|
|
2
|
+
pylibsparseir-0.7.4.dist-info/WHEEL,sha256=9gv_WQapzfiGQ7jdrimtrtzMoA7ItUiOdFq9sXat7ns,133
|
|
3
|
+
pylibsparseir-0.7.4.dist-info/METADATA,sha256=AX0j_-CYwDflnrjHMTzSkgeS_rDlpurVL6MAzZFO3ws,6603
|
|
4
|
+
pylibsparseir-0.7.4.dist-info/licenses/LICENSE,sha256=f7O_CoSPJW9fmszTOBcCtKDB2QMfPsrYyL41nyE3I-o,1064
|
|
5
|
+
pylibsparseir/ctypes_wrapper.py,sha256=jVkusNcseLDXiiceddQEJ8Apmsm7vyUgPcCxEEvwmZY,901
|
|
6
|
+
pylibsparseir/sparseir.h,sha256=0QhEQD3D1S9vR-kTrhJnbx4_DHHakdDXC8gR7v7b9DY,68995
|
|
7
|
+
pylibsparseir/clean_build_artifacts.py,sha256=--opVAb2lHh6PIXgdPhw77-LFDdKR_fAQPEsf-Qemjc,2112
|
|
8
|
+
pylibsparseir/constants.py,sha256=Ek3JnmgiDWy3LB8f_9QA7Gh0ReaEC-W2MlCBJG3cBYg,864
|
|
9
|
+
pylibsparseir/ctypes_autogen.py,sha256=SAJEbsjUZcpxdyUIb0u1FC1sGVIzJzSOZsPMjpNM28I,11747
|
|
10
|
+
pylibsparseir/__init__.py,sha256=tJrHAYi_Zb9HCcvwsbrUsWIETdDrlh44o42kpmNpsCM,948
|
|
11
|
+
pylibsparseir/core.py,sha256=kdwWc3DXJutJhQmpp7k4-R09zsjPKSQzzv4_ZPpNPy0,24385
|
|
12
|
+
pylibsparseir/libsparse_ir_capi.dylib,sha256=GzwcR2Kruls4xYw4jsDtW7ciwSsn0ZyS16TE4Lk7iG8,2556848
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 SpM-lab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|