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,31 @@
|
|
|
1
|
+
"""
|
|
2
|
+
pylibsparseir - Python bindings for sparse-ir-capi
|
|
3
|
+
|
|
4
|
+
This package provides Python bindings for the sparse-ir-capi Rust library,
|
|
5
|
+
enabling efficient computation of sparse intermediate representation (IR)
|
|
6
|
+
basis functions used in many-body physics calculations.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from .core import *
|
|
10
|
+
from .constants import *
|
|
11
|
+
|
|
12
|
+
# Import version from package metadata
|
|
13
|
+
try:
|
|
14
|
+
from importlib.metadata import version, PackageNotFoundError
|
|
15
|
+
__version__ = version("pylibsparseir")
|
|
16
|
+
except ImportError:
|
|
17
|
+
# Fallback for Python < 3.8
|
|
18
|
+
try:
|
|
19
|
+
import pkg_resources
|
|
20
|
+
__version__ = pkg_resources.get_distribution("pylibsparseir").version
|
|
21
|
+
except Exception:
|
|
22
|
+
__version__ = "unknown"
|
|
23
|
+
except PackageNotFoundError:
|
|
24
|
+
# Package not installed, fallback
|
|
25
|
+
__version__ = "unknown"
|
|
26
|
+
|
|
27
|
+
# Create version info tuple
|
|
28
|
+
try:
|
|
29
|
+
__version_info__ = tuple(map(int, __version__.split(".")))
|
|
30
|
+
except (ValueError, AttributeError):
|
|
31
|
+
__version_info__ = (0, 0, 0)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Clean build artifacts and files.
|
|
4
|
+
|
|
5
|
+
Note: For Rust builds, we no longer copy C++ source files.
|
|
6
|
+
The Rust library is built automatically during the CMake build process.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import os
|
|
10
|
+
import shutil
|
|
11
|
+
import glob
|
|
12
|
+
|
|
13
|
+
def clean_build_artifacts():
|
|
14
|
+
"""Remove build artifacts and copied files."""
|
|
15
|
+
current_dir = os.getcwd()
|
|
16
|
+
|
|
17
|
+
# Directories and files to remove (build artifacts only)
|
|
18
|
+
# Note: No longer removing include/src/cmake as we use Rust now
|
|
19
|
+
items_to_remove = [
|
|
20
|
+
'build',
|
|
21
|
+
'dist',
|
|
22
|
+
'*.egg-info',
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
# Files in pylibsparseir to remove
|
|
26
|
+
pylibsparseir_patterns = [
|
|
27
|
+
'pylibsparseir/*.so',
|
|
28
|
+
'pylibsparseir/*.dylib',
|
|
29
|
+
'pylibsparseir/*.dll',
|
|
30
|
+
'pylibsparseir/__pycache__'
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
print(f"Cleaning build artifacts in: {current_dir}")
|
|
34
|
+
|
|
35
|
+
# Remove main items
|
|
36
|
+
for item in items_to_remove:
|
|
37
|
+
if '*' in item:
|
|
38
|
+
# Handle glob patterns
|
|
39
|
+
for path in glob.glob(item):
|
|
40
|
+
if os.path.exists(path):
|
|
41
|
+
if os.path.isdir(path):
|
|
42
|
+
shutil.rmtree(path)
|
|
43
|
+
print(f"Removed directory: {path}")
|
|
44
|
+
else:
|
|
45
|
+
os.remove(path)
|
|
46
|
+
print(f"Removed file: {path}")
|
|
47
|
+
else:
|
|
48
|
+
# Handle direct paths
|
|
49
|
+
if os.path.exists(item):
|
|
50
|
+
if os.path.isdir(item):
|
|
51
|
+
shutil.rmtree(item)
|
|
52
|
+
print(f"Removed directory: {item}")
|
|
53
|
+
else:
|
|
54
|
+
os.remove(item)
|
|
55
|
+
print(f"Removed file: {item}")
|
|
56
|
+
|
|
57
|
+
# Remove pylibsparseir artifacts
|
|
58
|
+
for pattern in pylibsparseir_patterns:
|
|
59
|
+
for path in glob.glob(pattern):
|
|
60
|
+
if os.path.exists(path):
|
|
61
|
+
if os.path.isdir(path):
|
|
62
|
+
shutil.rmtree(path)
|
|
63
|
+
print(f"Removed directory: {path}")
|
|
64
|
+
else:
|
|
65
|
+
os.remove(path)
|
|
66
|
+
print(f"Removed file: {path}")
|
|
67
|
+
|
|
68
|
+
print("Clean completed!")
|
|
69
|
+
|
|
70
|
+
if __name__ == "__main__":
|
|
71
|
+
clean_build_artifacts()
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Constants used in the SparseIR C API.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
# Status codes
|
|
6
|
+
COMPUTATION_SUCCESS = 0
|
|
7
|
+
GET_IMPL_FAILED = -1
|
|
8
|
+
INVALID_DIMENSION = -2
|
|
9
|
+
INPUT_DIMENSION_MISMATCH = -3
|
|
10
|
+
OUTPUT_DIMENSION_MISMATCH = -4
|
|
11
|
+
NOT_SUPPORTED = -5
|
|
12
|
+
INVALID_ARGUMENT = -6
|
|
13
|
+
INTERNAL_ERROR = -7
|
|
14
|
+
|
|
15
|
+
# SPIR prefixed constants for compatibility
|
|
16
|
+
SPIR_COMPUTATION_SUCCESS = 0
|
|
17
|
+
SPIR_GET_IMPL_FAILED = -1
|
|
18
|
+
SPIR_INVALID_DIMENSION = -2
|
|
19
|
+
SPIR_INPUT_DIMENSION_MISMATCH = -3
|
|
20
|
+
SPIR_OUTPUT_DIMENSION_MISMATCH = -4
|
|
21
|
+
SPIR_NOT_SUPPORTED = -5
|
|
22
|
+
SPIR_INVALID_ARGUMENT = -6
|
|
23
|
+
SPIR_INTERNAL_ERROR = -7
|
|
24
|
+
|
|
25
|
+
# Statistics type constants
|
|
26
|
+
SPIR_STATISTICS_FERMIONIC = 1
|
|
27
|
+
SPIR_STATISTICS_BOSONIC = 0
|
|
28
|
+
|
|
29
|
+
# Order type constants
|
|
30
|
+
SPIR_ORDER_COLUMN_MAJOR = 1
|
|
31
|
+
SPIR_ORDER_ROW_MAJOR = 0
|
|
32
|
+
|
|
33
|
+
# Make sure these are available at module level
|
|
34
|
+
SPIR_ORDER_ROW_MAJOR = 0
|
|
35
|
+
SPIR_ORDER_COLUMN_MAJOR = 1
|
|
36
|
+
|
|
37
|
+
# SVE Twork constants
|
|
38
|
+
SPIR_TWORK_FLOAT64 = 0
|
|
39
|
+
SPIR_TWORK_FLOAT64X2 = 1
|