Skip to content

Commit bdb7a00

Browse files
authored
refactor(py, imports): create preludes (#14)
* testing new pyo3 feat with a DAT * refactor(py, imports): create preludes * remove test dat
1 parent 7553635 commit bdb7a00

File tree

15 files changed

+64
-16
lines changed

15 files changed

+64
-16
lines changed

Cargo.lock

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

plugins/chop/python/src/lib.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#![feature(min_specialization)]
22

3-
use pyo3::impl_::pyclass::{PyClassImpl, PyMethods};
4-
use pyo3::prelude::PyAnyMethods;
5-
use pyo3::{pyclass, pymethods, Bound, PyAny, PyResult, Python};
6-
use std::pin::Pin;
7-
use td_rs_chop::cxx::AsPlugin;
8-
use td_rs_chop::*;
3+
use td_rs_chop::prelude::*;
94
use td_rs_derive::*;
105
use td_rs_derive_py::PyOp;
116

plugins/sop/generator-sop/src/shapes.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,18 @@ pub const THE_CUBE_TEXTURE: [TexCoord; THE_CUBE_NUM_PTS] = [
8686
// front
8787
TexCoord::new(2.0 / 3.0, 0.0, 0.0),
8888
TexCoord::new(2.0 / 3.0, 0.5, 0.0),
89-
TexCoord::new(3.0 / 3.0, 0.0, 0.0),
90-
TexCoord::new(3.0 / 3.0, 0.5, 0.0),
89+
TexCoord::new(1.0, 0.0, 0.0),
90+
TexCoord::new(1.0, 0.5, 0.0),
9191
// back
9292
TexCoord::new(0.0 / 3.0, 0.5, 0.0),
9393
TexCoord::new(0.0 / 3.0, 0.0, 0.0),
9494
TexCoord::new(1.0 / 3.0, 0.5, 0.0),
9595
TexCoord::new(1.0 / 3.0, 0.0, 0.0),
9696
// top
9797
TexCoord::new(2.0 / 3.0, 1.0, 0.0),
98-
TexCoord::new(3.0 / 3.0, 1.0, 0.0),
98+
TexCoord::new(1.0, 1.0, 0.0),
9999
TexCoord::new(2.0 / 3.0, 0.5, 0.0),
100-
TexCoord::new(3.0 / 3.0, 0.5, 0.0),
100+
TexCoord::new(1.0, 0.5, 0.0),
101101
// bottom
102102
TexCoord::new(1.0 / 3.0, 0.5, 0.0),
103103
TexCoord::new(2.0 / 3.0, 0.5, 0.0),

td-rs-chop/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ cxx = "1.0.78"
1313
td-rs-base = { path = "../td-rs-base" }
1414
tracing-base = { package = "tracing", version = "0.1", optional = true }
1515
tracing-subscriber = { version = "0.2", optional = true }
16+
pyo3 = { git = "https://github.com/tychedelia/pyo3", branch = "td-rs", features = ["abi3-py311"], optional = true }
1617

1718
[build-dependencies]
1819
td-rs-autocxx-build = { path = "../td-rs-autocxx-build" }
@@ -21,6 +22,6 @@ miette = { version="5", features = [ "fancy" ] }
2122

2223
[features]
2324
default = []
24-
python = ["td-rs-base/python"]
25+
python = ["td-rs-base/python", "dep:pyo3"]
2526
tracing = ["td-rs-base/tracing", "tracing-base", "tracing-subscriber"]
2627
tokio = ["td-rs-base/tokio"]

td-rs-chop/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ pub use td_rs_base::chop::*;
88
pub use td_rs_base::*;
99

1010
pub mod cxx;
11+
pub mod prelude;
1112

1213
#[derive(Debug, Default)]
1314
pub struct ChopOutputInfo {

td-rs-chop/src/prelude.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
pub use crate::cxx::AsPlugin;
2+
pub use crate::*;
3+
4+
#[cfg(feature = "python")]
5+
pub use pyo3::impl_::pyclass::{PyClassImpl, PyMethods};
6+
#[cfg(feature = "python")]
7+
pub use pyo3::prelude::*;
8+
#[cfg(feature = "python")]
9+
pub use std::pin::Pin;

td-rs-dat/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ ref-cast = "1.0"
1515
sparsevec = "0.2.0"
1616
tracing-base = { package = "tracing", version = "0.1", optional = true }
1717
tracing-subscriber = { version = "0.2", optional = true }
18+
pyo3 = { git = "https://github.com/tychedelia/pyo3", branch = "td-rs", features = ["abi3-py311"], optional = true }
1819

1920
[build-dependencies]
2021
td-rs-autocxx-build = { path = "../td-rs-autocxx-build" }
@@ -23,6 +24,6 @@ miette = { version="5", features = [ "fancy" ] }
2324

2425
[features]
2526
default = []
26-
python = ["td-rs-base/python"]
27+
python = ["td-rs-base/python", "dep:pyo3"]
2728
tracing = ["td-rs-base/tracing", "tracing-base", "tracing-subscriber"]
2829
tokio = ["td-rs-base/tokio"]

td-rs-dat/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub use td_rs_base::param::OperatorParams;
77
pub use td_rs_base::*;
88

99
pub mod cxx;
10+
pub mod prelude;
1011

1112
#[derive(Debug, Default)]
1213
pub struct DatGeneralInfo {

td-rs-dat/src/prelude.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
pub use crate::cxx::AsPlugin;
2+
pub use crate::*;
3+
4+
#[cfg(feature = "python")]
5+
pub use pyo3::impl_::pyclass::{PyClassImpl, PyMethods};
6+
#[cfg(feature = "python")]
7+
pub use pyo3::prelude::*;
8+
#[cfg(feature = "python")]
9+
pub use std::pin::Pin;

td-rs-sop/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ td-rs-base = { path = "../td-rs-base" }
1414
ref-cast = "1.0"
1515
tracing-base = { package = "tracing", version = "0.1", optional = true }
1616
tracing-subscriber = { version = "0.2", optional = true }
17+
pyo3 = { git = "https://github.com/tychedelia/pyo3", branch = "td-rs", features = ["abi3-py311"], optional = true }
1718

1819
[build-dependencies]
1920
td-rs-autocxx-build = { path = "../td-rs-autocxx-build" }
@@ -22,6 +23,6 @@ miette = { version="5", features = [ "fancy" ] }
2223

2324
[features]
2425
default = []
25-
python = ["td-rs-base/python"]
26+
python = ["td-rs-base/python", "dep:pyo3"]
2627
tracing = ["td-rs-base/tracing", "tracing-base", "tracing-subscriber"]
2728
tokio = ["td-rs-base/tokio"]

0 commit comments

Comments
 (0)