Skip to content

Commit 1a8febe

Browse files
authored
Merge pull request #39 from dancergraham/copilot/revert-last-commit-skip-pytest
update dependencies
2 parents 179f746 + 87748d2 commit 1a8febe

5 files changed

Lines changed: 298 additions & 31 deletions

File tree

.github/workflows/CI.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,6 @@ jobs:
172172
strategy:
173173
matrix:
174174
platform:
175-
- runner: macos-13
176-
target: x86_64
177175
- runner: macos-14
178176
target: aarch64
179177
steps:

Cargo.lock

Lines changed: 268 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ name = "e57"
99
crate-type = ["cdylib"]
1010

1111
[dependencies]
12-
pyo3 = "0.21.2"
13-
e57 = { version = "0.11.7",features =["crc32c"]}
14-
numpy = "0.21.0"
15-
ndarray = "0.15.6"
12+
pyo3 = "0.28.3"
13+
e57 = { version = "0.11.12", features = ["crc32c"] }
14+
numpy = "0.28.0"

pyproject.toml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[build-system]
2-
requires = ["maturin>=1.0,<2.0"]
2+
requires = ["maturin>=1.13,<2.0"]
33
build-backend = "maturin"
44

55
[project]
66
name = "e57"
7+
version = "0.2.1a1"
78
dependencies = [
8-
'pytest',
9-
'numpy',
9+
'numpy>=2,<3',
1010
]
1111
description = "Read e57 files to Python. E57 is a compact, non-proprietary point cloud format that's defined by the ASTM E2807 standard. This format is widely adopted by 3D design applications."
1212
authors = [
@@ -23,6 +23,11 @@ classifiers = [
2323
"Topic :: File Formats",
2424
]
2525

26+
[project.optional-dependencies]
27+
test = [
28+
'pytest>=9,<10',
29+
]
30+
2631
[project.urls]
2732
repository = "https://github.com/dancergraham/e57-python"
2833

src/lib.rs

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ use std::fs::File;
22
use std::io::BufReader;
33

44
use ::e57::{CartesianCoordinate, E57Reader};
5-
use ndarray::Ix2;
6-
use numpy::{PyArray, PyArrayMethods};
5+
use numpy::ndarray::Array2;
6+
use numpy::{IntoPyArray, PyArray2};
77
use pyo3::prelude::*;
88

99
#[pyclass]
1010
pub struct E57 {
1111
#[pyo3(get)]
12-
pub points: Py<PyArray<f64, Ix2>>,
12+
pub points: Py<PyArray2<f64>>,
1313
#[pyo3(get)]
14-
pub color: Py<PyArray<f32, Ix2>>,
14+
pub color: Py<PyArray2<f32>>,
1515
#[pyo3(get)]
16-
pub intensity: Py<PyArray<f32, Ix2>>,
16+
pub intensity: Py<PyArray2<f32>>,
1717
}
1818

1919
/// Extracts the xml contents from an e57 file.
@@ -80,27 +80,24 @@ unsafe fn read_points(py: Python<'_>, filepath: &str) -> PyResult<E57> {
8080
let n_colors = color_vec.len() / 3;
8181
let n_intensities = intensity_vec.len();
8282
let mut e57 = E57 {
83-
points: Py::from(
84-
PyArray::from_vec_bound(py, point_vec)
85-
.reshape([nrows, 3])
86-
.unwrap(),
87-
),
88-
color: Py::from(PyArray::new_bound(py, (0, 3), false)),
89-
intensity: Py::from(PyArray::new_bound(py, (0, 1), false)),
83+
points: Array2::from_shape_vec((nrows, 3), point_vec)
84+
.unwrap()
85+
.into_pyarray(py)
86+
.unbind(),
87+
color: Array2::<f32>::zeros((0, 3)).into_pyarray(py).unbind(),
88+
intensity: Array2::<f32>::zeros((0, 1)).into_pyarray(py).unbind(),
9089
};
9190
if n_colors == n_points {
92-
e57.color = Py::from(
93-
PyArray::from_vec_bound(py, color_vec)
94-
.reshape([nrows, 3])
95-
.unwrap(),
96-
)
91+
e57.color = Array2::from_shape_vec((nrows, 3), color_vec)
92+
.unwrap()
93+
.into_pyarray(py)
94+
.unbind();
9795
}
9896
if n_intensities == n_points {
99-
e57.intensity = Py::from(
100-
PyArray::from_vec_bound(py, intensity_vec)
101-
.reshape([nrows, 1])
102-
.unwrap(),
103-
)
97+
e57.intensity = Array2::from_shape_vec((nrows, 1), intensity_vec)
98+
.unwrap()
99+
.into_pyarray(py)
100+
.unbind();
104101
}
105102
Ok(e57)
106103
}

0 commit comments

Comments
 (0)