Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
codekansas committed Oct 28, 2024
1 parent 424a3b9 commit 5201a26
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
6 changes: 0 additions & 6 deletions kscaleos/bindings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ crate-type = ["cdylib", "rlib"]

pyo3 = { version = ">= 0.21.0", features = ["extension-module"] }
pyo3-stub-gen = ">= 0.6.0"
tokio = { version = "1.28.0", features = ["full"] }
async-trait = "0.1.68"
futures = "0.3"
log = "0.4"
env_logger = "0.11.5"
serialport = "4.5.1"

# Other packages in the workspace.
kscaleos = { path = "../rust" }
Expand Down
7 changes: 7 additions & 0 deletions kscaleos/bindings/bindings.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file is automatically generated by pyo3_stub_gen
# ruff: noqa: E501, F401


def hello_world() -> None:
...

10 changes: 10 additions & 0 deletions kscaleos/bindings/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[build-system]
requires = ["maturin>=1.1,<2.0"]
build-backend = "maturin"

[project]
name = "bindings"
requires-python = ">=3.9"

[project.optional-dependencies]
test = ["pytest", "pyright", "ruff"]
2 changes: 0 additions & 2 deletions kscaleos/bindings/src/bin/stub_gen.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use pyo3_stub_gen::Result;

fn main() -> Result<()> {
println!("Generating stub info...");
let stub = bindings::stub_info()?;
println!("Generating stubs...");
stub.generate()?;
Ok(())
}
4 changes: 3 additions & 1 deletion kscaleos/bindings/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ use kscaleos::hello_world as kscaleos_hello_world;
use pyo3::prelude::*;
use pyo3::{wrap_pyfunction, PyResult};
use pyo3_stub_gen::define_stub_info_gatherer;
use pyo3_stub_gen::derive::gen_stub_pyfunction;

#[gen_stub_pyfunction]
#[pyfunction]
pub fn hello_world() -> PyResult<()> {
kscaleos_hello_world();
Expand All @@ -11,7 +13,7 @@ pub fn hello_world() -> PyResult<()> {

#[pymodule]
fn bindings(m: &Bound<PyModule>) -> PyResult<()> {
m.add_wrapped(wrap_pyfunction!(hello_world))?;
m.add_function(wrap_pyfunction!(hello_world, m)?).unwrap();
Ok(())
}

Expand Down

0 comments on commit 5201a26

Please sign in to comment.