-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild_python.sh
More file actions
executable file
·50 lines (39 loc) · 1.21 KB
/
Copy pathbuild_python.sh
File metadata and controls
executable file
·50 lines (39 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# Build and test Python bindings for Rust matrix library
set -e # Exit on any error
echo "Building Python bindings for Rust matrix library..."
echo "=================================================="
# Check if maturin is installed
if ! command -v maturin &> /dev/null; then
echo "Maturin not found. Installing..."
pip install maturin
fi
# Check if pytest is installed
if ! python -c "import pytest" &> /dev/null; then
echo "Pytest not found. Installing..."
pip install pytest
fi
# Clean previous builds
echo "Cleaning previous builds..."
cargo clean
# Build and install in development mode
echo "Building and installing Python package..."
maturin develop --release
# Run Rust tests
echo "Running Rust tests..."
cargo test
# Run Python tests
echo "Running Python tests..."
python -m pytest tests/test_python_bindings.py -v
# Run example
echo "Running Python example..."
python examples/python_example.py
echo ""
echo "Build and test completed successfully!"
echo ""
echo "You can now use the library in Python:"
echo " import matrix_lib_python as ml"
echo " matrix = ml.PyMatrix.from_list([[1.0, 2.0], [3.0, 4.0]])"
echo ""
echo "To build a distributable wheel:"
echo " maturin build --release"