Skip to content

Commit 2b65c69

Browse files
committed
fix: Update version to 0.2.7 in Cargo.toml, Cargo.lock, and pyproject.toml; add test script for Pyroid functionality
1 parent 9d6776b commit 2b65c69

5 files changed

Lines changed: 76 additions & 3 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ target
44
*.pyo
55
*.pyd
66
.venv
7+
.local

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pyroid"
3-
version = "0.2.6"
3+
version = "0.2.7"
44
edition = "2021"
55
authors = ["Andrew O", "Pyroid Team"]
66
description = "High-performance Rust functions for Python"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "maturin"
44

55
[project]
66
name = "pyroid"
7-
version = "0.2.6"
7+
version = "0.2.7"
88
description = "High-performance Rust functions for Python with a simplified architecture"
99
authors = [
1010
{name = "Pyroid Team", email = "support@ataiva.com"}

test_pyroid.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Test script for Pyroid
4+
"""
5+
6+
import sys
7+
import os
8+
9+
# Add the project directory to the Python path
10+
sys.path.insert(0, os.path.abspath('.'))
11+
12+
try:
13+
import pyroid
14+
print(f"Successfully imported pyroid version {pyroid.__version__}")
15+
except ImportError as e:
16+
print(f"Failed to import pyroid: {e}")
17+
sys.exit(1)
18+
19+
# Test vector operations
20+
try:
21+
v1 = pyroid.math.Vector([1, 2, 3])
22+
v2 = pyroid.math.Vector([4, 5, 6])
23+
v3 = v1 + v2
24+
print(f"Vector sum: {v3}")
25+
print(f"Dot product: {v1.dot(v2)}")
26+
except Exception as e:
27+
print(f"Vector operations error: {e}")
28+
29+
# Test matrix operations
30+
try:
31+
m1 = pyroid.math.Matrix([[1, 2], [3, 4]])
32+
m2 = pyroid.math.Matrix([[5, 6], [7, 8]])
33+
m3 = m1 * m2
34+
print(f"Matrix product: {m3}")
35+
except Exception as e:
36+
print(f"Matrix operations error: {e}")
37+
38+
# Test statistical functions
39+
try:
40+
numbers = [1, 2, 3, 4, 5]
41+
mean = pyroid.math.stats.mean(numbers)
42+
median = pyroid.math.stats.median(numbers)
43+
std_dev = pyroid.math.stats.calc_std(numbers)
44+
print(f"Mean: {mean}, Median: {median}, StdDev: {std_dev}")
45+
except Exception as e:
46+
print(f"Statistical functions error: {e}")
47+
48+
# Test image operations
49+
try:
50+
img = pyroid.image.basic.create_image(100, 100, 3)
51+
for x in range(50):
52+
for y in range(50):
53+
img.set_pixel(x, y, [255, 0, 0]) # Red square
54+
grayscale_img = img.to_grayscale()
55+
print(f"Created image: {img.width}x{img.height} with {img.channels} channels")
56+
print(f"Grayscale image: {grayscale_img.width}x{grayscale_img.height} with {grayscale_img.channels} channels")
57+
except Exception as e:
58+
print(f"Image operations error: {e}")
59+
60+
# Test ML operations
61+
try:
62+
data = [
63+
[1.0, 2.0], [1.5, 1.8], [5.0, 8.0],
64+
[8.0, 8.0], [1.0, 0.6], [9.0, 11.0]
65+
]
66+
result = pyroid.ml.basic.kmeans(data, k=2)
67+
print(f"K-means centroids: {result['centroids']}")
68+
print(f"K-means clusters: {result['clusters']}")
69+
except Exception as e:
70+
print(f"ML operations error: {e}")
71+
72+
print("All tests completed.")

0 commit comments

Comments
 (0)