Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use rattler_conda_types to parse conda version in wasm env #1078

Closed
2 tasks done
trim21 opened this issue Feb 19, 2025 · 3 comments · Fixed by #1079
Closed
2 tasks done

use rattler_conda_types to parse conda version in wasm env #1078

trim21 opened this issue Feb 19, 2025 · 3 comments · Fixed by #1079

Comments

@trim21
Copy link
Contributor

trim21 commented Feb 19, 2025

Checklist

  • I added a descriptive title
  • I searched open requests and couldn't find a duplicate

What is the idea?

I'm trying to add conda support to renovatebot, which is a dependency automation tool written in nodejs.

So unfortunately, it can only use wasm or javascript.

I don't want to reinvent the wheel again so I'm trying to use rattler_conda_types (actually rattler_conda_types::Version) to parse version defined in pixi.toml.

But I encounter a problem, rattler_conda_types has a requirement on tokio (rattler_conda_types -> fs-err -> tokit) which doesn't build on wasm target and there is no way to disable it.

Can I get some help on this?

the cargo.toml I'm using:

[dependencies]
wasm-bindgen = "0.2.84"
# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
# code size when deploying.
console_error_panic_hook = { version = "0.1.7", optional = true }
rattler_conda_types = { version = "0.30.3", default-features = false }

[dev-dependencies]
wasm-bindgen-test = "0.3.34"

and what happened:

❯❯ ~/proj/cargo-version (master) wasm-pack.exe test --node
[INFO]: 🎯  Checking for the Wasm target...
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
   Compiling serde_derive v1.0.217
   Compiling synstructure v0.13.1
   Compiling zerovec-derive v0.10.3
   Compiling displaydoc v0.2.5
   Compiling icu_provider_macros v1.5.0
   Compiling wasm-bindgen-backend v0.2.100
   Compiling darling_core v0.20.10
   Compiling regex-automata v0.4.9
   Compiling phf_macros v0.11.3
   Compiling ref-cast-impl v1.0.23
   Compiling thiserror-impl v1.0.69
   Compiling thiserror-impl v2.0.11
   Compiling strum_macros v0.27.1
   Compiling tokio v1.43.0
   Compiling tracing-attributes v0.1.28
error: Only features sync,macros,io-util,rt,time are supported on wasm.
   --> C:\Users\Trim21\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.43.0\src/lib.rs:476:1
    |
476 | compile_error!("Only features sync,macros,io-util,rt,time are supported on wasm.");
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: could not compile `tokio` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
Error: Compilation of your program failed
Caused by: Compilation of your program failed
Caused by: failed to execute `cargo build`: exited with exit code: 101
  full command: "cargo" "build" "--tests" "--target" "wasm32-unknown-unknown"

Why is this needed?

No response

What should happen?

No response

Additional Context

No response

@trim21 trim21 changed the title wasm build for rattler_conda_types use rattler_conda_types in wasm rust code Feb 19, 2025
@trim21 trim21 changed the title use rattler_conda_types in wasm rust code use rattler_conda_types to parse conda version in wasm env Feb 19, 2025
@wolfv
Copy link
Contributor

wolfv commented Feb 19, 2025

Hey @trim21 - we actually have a starting point for you!

@baszalmstra has started on TypeScript / WASM bindings here: https://github.com/baszalmstra/rattler/tree/feat/js-rattler

It would be super exciting if you take that to the next level!

@trim21
Copy link
Contributor Author

trim21 commented Feb 19, 2025

Thanks, really glad to know, just receive reply from baszalmstra in another issue renovatebot/renovate#2213 (comment) and he will make a PR soon, so I think I should wait for it.

And read the code on https://github.com/baszalmstra/rattler/tree/feat/js-rattler, it's based on old version of rattler_conda_types which doesn't depend on fs-err yet so it compile fine on wasm.

@baszalmstra
Copy link
Collaborator

I create an initial PR at: #1079

This code is rebased on the latest main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants