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

feat: initial wasm/ts/js bindings #1079

Merged
merged 6 commits into from
Feb 20, 2025
Merged

Conversation

baszalmstra
Copy link
Collaborator

This PR adds initial bindings for a WASM port of some functionality of rattler. This PR aims to add a framework, more bindings can be added later.

At this point only Version and VersionSpec are exposed in a fashion that I think meets the standards of this library.

Uses wasm-pack to create a WASM binary of Rust code including a javascript wrapper. This is then double wrapped in a typescript library that provides a more ergonomic API. Tests have also been added.

Im not an expert in this area, feedback is welcome!

Fixes #1078.

If CI succeeds Ill do an initial upload of this package to npmjs.org. But we still need to find a good home for it on npmjs.org since rattler is already taken.

@trim21
Copy link
Contributor

trim21 commented Feb 19, 2025

is @conda/rattler taken on npmjs?

@baszalmstra
Copy link
Collaborator Author

baszalmstra commented Feb 19, 2025

Thats indeed the name Im going for but Im not a member of the @conda organization. I put some feelers out to figure out who owns it and if I can contribute to it.

@baszalmstra
Copy link
Collaborator Author

I uploaded the current state to https://www.npmjs.com/package/@baszalmstra/rattler @trim21 does this help you?

@trim21
Copy link
Contributor

trim21 commented Feb 19, 2025

looks good.

Some ideas:

the JsVersion and JsVersionSpec may be a little bit confusing because it's not version of js but a conda package version

@baszalmstra
Copy link
Collaborator Author

Those should never be used, they are internal types. You should only need Version and VersionSpec.

@trim21
Copy link
Contributor

trim21 commented Feb 19, 2025

I think we also need Version.components to get details of version and Version::cmp to compare versions.

There is no api to know if a version is a pre-release(only is-dev but not alpha/beta/rc) and there is no api to compare which version is newer

@trim21
Copy link
Contributor

trim21 commented Feb 19, 2025

ParseStrictness is missing from npm distribution

@baszalmstra
Copy link
Collaborator Author

I can add all of that when I find the time.

But feel free to create PRs against this PR, or can we merge this already @wolfv ?

@trim21
Copy link
Contributor

trim21 commented Feb 20, 2025

The current npm distribution is broken. the ./pkg/ directory is referenced by dist but it's not uploaded

image

image

@trim21
Copy link
Contributor

trim21 commented Feb 20, 2025

I can add all of that when I find the time.

But feel free to create PRs against this PR, or can we merge this already @wolfv ?

Version.components is private and can't be used in wasm crate, can we export it?

Or should we add is_pre_release/is_stable method to Version crate?

@wolfv
Copy link
Contributor

wolfv commented Feb 20, 2025

Happy to merge and iterate in PRs. I know that some other folks from @QuantStack are also potentially interested (in the solver functionality, particularly).

@wolfv wolfv merged commit 2899cdd into conda:main Feb 20, 2025
16 checks passed
@baszalmstra
Copy link
Collaborator Author

baszalmstra commented Feb 20, 2025

Version.components is private and can't be used in wasm crate, can we export it?

What do you need this for? There are a number of higher. level methods to modify the version that can be used instead.

Or should we add is_pre_release/is_stable method to Version crate?

Conda does not define what a pre release is. There is "isDev" though

@baszalmstra baszalmstra mentioned this pull request Feb 19, 2025
@trim21
Copy link
Contributor

trim21 commented Feb 20, 2025

Conda does not define what a pre release is. There is "isDev" though

Thanks, I didn't know that 😄

This is because when you upgrade your version with tools, normally you don't want to upgrade from "stable" (pep440 for example) to "unstable" version.

If conda doesn't have "pre release" I have no more problems.

This was referenced Feb 20, 2025
travishathaway pushed a commit to travishathaway/rattler that referenced this pull request Feb 26, 2025
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 this pull request may close these issues.

use rattler_conda_types to parse conda version in wasm env
3 participants