-
Notifications
You must be signed in to change notification settings - Fork 293
feat: allow self-update from URL #3833
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
base: main
Are you sure you want to change the base?
feat: allow self-update from URL #3833
Conversation
This commit adds the --url option to the pixi self-update command. This makes it possible to fetch a pixi update from an arbitrary location, instead of automatically getting it from GitHub releases. See issue prefix-dev#1047
20dcbf4
to
aed39c4
Compare
hey @yannham ! Thanks for this PR! I will start by answering the easiest questions ( to me :):
This is a small input from my side to guide you in continuing your PR. I will do a code review in a separate step |
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.
I like the modularity!
for the tests, we have integration_python
subfolder where we write our tests in python ( it is easier and faster to do it for some usecases)
maybe we can write one for self-update with URL? How I see it, is that we first add a new fixture pixi-to-replace
, which is a copy of pixi
one and we execute self-update for a older pixi version, and check the updated version.
src/cli/self_update.rs
Outdated
pub async fn execute(args: Args) -> miette::Result<()> { | ||
if let Some(url) = args.url { | ||
// If a URL is provided, download the archive from the URL | ||
let new_binary_path = download(url).await?; |
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.
should we also provide a UX message like eprintln!("Downloading pixi")
?
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.
Sure!
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.
Any preference for the styling, like an emoji or a specific styling to apply to those kind of "doing something" messages?
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.
we may use green style as others, with console::Emoji("🚚 ", "") like this with some downloading text
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.
eprintln!(
"{}Downloading Pixi from {},
console::style(console::Emoji("🚚 ", "")).green(),
our_url_here,
);
maybe like this
259d47d
to
28f5b42
Compare
Closes #1047
Allow self-update from URL
This PR adds the
--url
option to thepixi self-update
command. This makes it possible to fetch a pixi update from an arbitrary URL instead of automatically getting it from GitHub releases. See #1047 for the motivation.To avoid making
execute()
too large, I've tried to split stuff that isn't related to the console interaction - downloading files, unpacking the release archive - into smaller functions.This is a first draft, and I believe there are a number of questions that need to be answered before merging:
help
orversion
is the one from a valid pixi binary. Running<downloaded-pixi> --version
would also be a way to extract the new version and fix 1. at the same time..zip
or.tar.gz
and automatically unpacking them?Tests
I haven't found tests for self-update. I'm not sure this is really easy to test. I'll test it locally before making this ready for review but I'm open to suggestions if you think we could write potentially sensible tests.