diff --git a/examples/rustjswasm.yaml b/examples/rustjswasm.yaml index 6672bfe..b594ef7 100644 --- a/examples/rustjswasm.yaml +++ b/examples/rustjswasm.yaml @@ -5,6 +5,6 @@ add_extension: rustjswasm email: 3105306+timkpaine@users.noreply.github.com github: python-project-templates project_description: A Rust-Python project template -project_name: python template rust +project_name: python template rustjswasm python_version_primary: '3.9' team: Python Project Template Authors diff --git a/rustjswasm/Cargo.toml.jinja b/rustjswasm/Cargo.toml.jinja index 5403f72..335f9a9 100644 --- a/rustjswasm/Cargo.toml.jinja +++ b/rustjswasm/Cargo.toml.jinja @@ -17,3 +17,12 @@ strum = "0.24.1" [profile.release] panic = 'abort' lto = true + +[profile.test.junit] +path = "junit.xml" + +[workspace] +members = [ + "js", + "rust", +] diff --git a/rustjswasm/js/Cargo.lock.jinja b/rustjswasm/js/Cargo.lock.jinja deleted file mode 100644 index c7c78a7..0000000 --- a/rustjswasm/js/Cargo.lock.jinja +++ /dev/null @@ -1,193 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "bumpalo" -version = "3.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" - -[[package]] -name = "cfg-if" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" - -[[package]] -name = "itoa" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" - -[[package]] -name = "log" -version = "0.4.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" - -[[package]] -name = "memchr" -version = "2.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" - -[[package]] -name = "once_cell" -version = "1.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" - -[[package]] -name = "proc-macro2" -version = "1.0.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "{{module}}" -version = "0.1.0" -dependencies = [ - "serde", - "serde_json", -] - -[[package]] -name = "{{module}}_js" -version = "0.1.0" -dependencies = [ - "{{module}}", - "wasm-bindgen", -] - -[[package]] -name = "quote" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rustversion" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" - -[[package]] -name = "ryu" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" - -[[package]] -name = "serde" -version = "1.0.219" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.219" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.142" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7" -dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "syn" -version = "2.0.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "unicode-ident" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" - -[[package]] -name = "wasm-bindgen" -version = "0.2.101" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e14915cadd45b529bb8d1f343c4ed0ac1de926144b746e2710f9cd05df6603b" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.101" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28d1ba982ca7923fd01448d5c30c6864d0a14109560296a162f80f305fb93bb" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.101" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c3d463ae3eff775b0c45df9da45d68837702ac35af998361e2c84e7c5ec1b0d" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.101" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bb4ce89b08211f923caf51d527662b75bdc9c9c7aab40f86dcb9fb85ac552aa" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.101" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f143854a3b13752c6950862c906306adb27c7e839f7414cec8fea35beab624c1" -dependencies = [ - "unicode-ident", -] diff --git a/rustjswasm/js/Cargo.toml.jinja b/rustjswasm/js/Cargo.toml.jinja index cc867b0..07b04f9 100644 --- a/rustjswasm/js/Cargo.toml.jinja +++ b/rustjswasm/js/Cargo.toml.jinja @@ -14,7 +14,3 @@ crate-type = ["cdylib"] [dependencies] {{module}} = { path = "../rust", version = "*" } wasm-bindgen = "0.2.84" - -[profile.release] -panic = 'abort' -lto = true \ No newline at end of file diff --git a/rustjswasm/js/package.json.jinja b/rustjswasm/js/package.json.jinja index f73d007..22ec3fc 100644 --- a/rustjswasm/js/package.json.jinja +++ b/rustjswasm/js/package.json.jinja @@ -29,7 +29,7 @@ "setup": "cargo install -f wasm-bindgen-cli --version 0.2.101", "build:debug": "node build.mjs --debug", "build:rust": "cargo build --release --all-features --target wasm32-unknown-unknown", - "build:wasm-bindgen": "wasm-bindgen target/wasm32-unknown-unknown/release/{{module}}.wasm --out-dir ./dist/pkg --target web", + "build:wasm-bindgen": "wasm-bindgen ../target/wasm32-unknown-unknown/release/{{module}}.wasm --out-dir ./dist/pkg --target web", "build:prod": "node build.mjs", "build": "npm-run-all build:rust build:wasm-bindgen build:prod", "clean": "rm -rf dist lib playwright-report ../{{module}}/extension", diff --git a/rustjswasm/rust/Cargo.lock.jinja b/rustjswasm/rust/Cargo.lock.jinja deleted file mode 100644 index 1c3581a..0000000 --- a/rustjswasm/rust/Cargo.lock.jinja +++ /dev/null @@ -1,89 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "{{module}}" -version = "0.1.0" -dependencies = [ - "serde", - "serde_json", -] - -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "serde" -version = "1.0.204" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.204" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.120" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "syn" -version = "2.0.71" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b146dcf730474b4bcd16c311627b31ede9ab149045db4d6088b3becaea046462" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/rustjswasm/rust/Cargo.toml.jinja b/rustjswasm/rust/Cargo.toml.jinja index 42be352..de6c452 100644 --- a/rustjswasm/rust/Cargo.toml.jinja +++ b/rustjswasm/rust/Cargo.toml.jinja @@ -16,7 +16,3 @@ crate-type = ["rlib"] [dependencies] serde = { version = "1.0", features = ["derive"] } serde_json = "1" - -[profile.test.junit] -path = "junit.xml" - diff --git a/rustjswasm/src/example/mod.rs.jinja b/rustjswasm/src/example/mod.rs.jinja index c9df21c..3d96ef5 100644 --- a/rustjswasm/src/example/mod.rs.jinja +++ b/rustjswasm/src/example/mod.rs.jinja @@ -2,7 +2,6 @@ use pyo3::prelude::*; use {{module}}::Example as BaseExample; - #[pyclass] pub struct Example { pub example: BaseExample, @@ -12,21 +11,18 @@ pub struct Example { impl Example { #[new] fn py_new(value: String) -> PyResult { - Ok( - Example { - example: BaseExample { - stuff: value.as_str().to_string() - }, - } - ) - + Ok(Example { + example: BaseExample { + stuff: value.as_str().to_string(), + }, + }) } - fn __str__(&self) -> PyResult { + fn __str__(&self) -> PyResult { Ok(format!("{}", self.example.stuff)) } - fn __repr__(&self) -> PyResult { + fn __repr__(&self) -> PyResult { Ok(format!("Example<{}>", self.example.stuff)) } } diff --git a/rustjswasm/src/lib.rs.jinja b/rustjswasm/src/lib.rs.jinja index 9dae75b..19d9814 100644 --- a/rustjswasm/src/lib.rs.jinja +++ b/rustjswasm/src/lib.rs.jinja @@ -4,7 +4,6 @@ mod example; pub use example::Example; - #[pymodule] fn {{module}}(_py: Python, m: &Bound) -> PyResult<()> { // Example