-
Notifications
You must be signed in to change notification settings - Fork 256
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: Proof of concept: Use ubi as a library instead of as a binary #2290
base: main
Are you sure you want to change the base?
Conversation
I honestly don't understand the internals of mise well enough to know if this PR is done or not. |
65dc88b
to
d794d4c
Compare
it seems to be failing but it's unclear why:
|
This test replaces the |
Also, I think it'd be nice to add support for some other features, like telling
The other options I can think of are:
|
mise has support for tool config which should be documented more clearly: [tools]
# send arbitrary options to the plugin, passed as:
# MISE_TOOL_OPTS__VENV=.venv
python = { version = '3.10', virtualenv = '.venv' } which could be leveraged here. What's missing is a way to configure this on the command line in part because it's tricky to know how to be able to do that with multiple tools |
I pushed a commit that adds the ability to set "exe" and "matching" in the config file. I think it's ok if this is only available via the config file for now. |
d1ec7db
to
aacf069
Compare
Hello not sure if linked but i have some issue with existing ubi for now like #2429 |
@autarch let me know when you think this is in a good place for review (or if it's ready now) |
aacf069
to
23eecad
Compare
@jdx I think this is mostly ready, but it wouldn't hurt to add some additional e2e tests, I think. |
Also, there's an e2e test failure I don't understand - https://github.com/jdx/mise/actions/runs/10548662451/job/29222829250?pr=2290 |
I think we can remove that e2e test file entirely since it involves mocking out ubi which isn't possible anymore baking the CLI into the codebase. It's running this which fails as you would expect:
|
there's a couple more issues I'd like to see tackled before we include this, generally to avoid adding a ton of crates to increase the build complexity of mise further than it already is:
|
.with_pr(ctx.pr.as_ref()) | ||
.envs(ctx.ts.env_with_path(&config)?) | ||
.prepend_path(ctx.ts.list_paths())? | ||
.prepend_path(self.depedency_toolset()?.list_paths())?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to be a blocker unfortunately. I need a way to set the env vars for the installation but there really isn't a good way to do that. I fear I will need to set the env vars inside the process which is a complete departure from what we have been doing.
An alternative idea I had was to expose ubi as a separate, hidden command but baked into mise, like mise ubi
, that way I could execute it like before with env vars specific to just that process.
@@ -4640,6 +4729,15 @@ dependencies = [ | |||
"zip", | |||
] | |||
|
|||
[[package]] | |||
name = "xz" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this may be a similar issue to the openssl things since I needed to statically compile xz in one of the libraries I use in mise (actually xz2 but xz is just a wrapper for xz2)
though perhaps not because in this case we don't need to remove any default features, we're only adding static
to the list—cargo may just add that feature to all dependencies using the same version but I need to verify that is the case.
In any case though in ubi I would change this to xz2
just to keep things tidy since that's the actual crate you're using.
EDIT: I confirmed it won't be necessary to expose the static
feature from xz2: https://doc.rust-lang.org/cargo/reference/features.html#feature-unification, you should directly use xz2 but that isn't going to block me or anything.
Not quite ready yet, so we need workarounds for: jdx/mise#2260 jdx/mise#2536 jdx/mise#2290
I took a stab at this using the
library-ize
branch ofubi
. It seems to work from my testing locally, and the test suite also passed locally.