#messed up trying to build a python module
52 messages · Page 1 of 1 (latest)
yeah I can't do anything with that on mobile
^
Downloaded/extracted folder
python -m venv .venv
.\.venv\Scripts\activate
cargo add pyo3 --features extension-module
edit package name to have a _
maturin develop
in cmd not vscode right?
in a powershell but it shouldn't matter
are the versions of everything i am using
compiler 2 versions behind 
for the edit package name to have a _ part, are you talking about the Cargo.toml's module name?
-name = "snes-apu"
+name = "snes_apu"
do i just copy-paste these?
you replace the - with a _
in the Cargo.toml
[package]
name = "snes_apu"
version = "0.1.12"
authors = ["ferris <[email protected]>"]
description = "A Super Nintendo audio unit emulator."
homepage = "https://github.com/emu-rs/snes-apu"
repository = "https://github.com/emu-rs/snes-apu"
keywords = ["snes", "super", "nintendo", "spc", "emulator"]
license = "BSD-2-Clause"
[dependencies]
pyo3 = { version = "0.25.1", features = ["extension-module"] }
spc = "0.1.0"
[dev-dependencies]
cpal = "0.4.4"
futures = "0.1.1"
ok
this is kind of sad
i think that's done to disallow someone from entering the wrong u8 digit
its impossible for it to happen
the compiler checked
where are my functions ðŸ˜
i had smp's read function on there!
well the code you provided me has no pyo3 functions in it
wait what?
oh wait there is a sndEMU folder?
yeah...
whats that from
i thought i had to make this folder to develop it as a package...... (turns out i didnt need to)
did i even put smp's function correctly?
so you just copied all the .rs files to a new project?
yeah thats not going to work
well at least i understand how you got the errors you got
if you want a new crate you should use snes-apu as a path dependency
not copy all it's code over
how do i do that?
https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#specifying-path-dependencies (you could also doa git dependency instead)
what about the code itself? is that right? (other than that smp::read is supposed to be smp::Smp::read)
you can't access the read method
its private
could i add the #[pyfunction] decorator and make it public?
no
what could i do then?
fn read(&mut self, addr: u16) -> u8 {
self.cycles(1);
self.emulator().read_u8(addr as u32)
}
you use the library like it was ment to be used (as shown in the example binary) or you actually go modify the code to be what you want
the entire src folder is one library
have you by chance read the rust book?
rust book?
-book