Skip to content

Offer to / automatically install versions via channel selection #1218

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

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

IanButterworth
Copy link
Member

@IanButterworth IanButterworth commented Jul 14, 2025

Makes it such that if you specify a channel which you don't have installed but is valid, it installs and launches it, with a message.

Screenshot 2025-07-22 at 3 52 59 PM Screenshot 2025-07-22 at 3 53 14 PM

Works for all valid channel descriptors (including PRs).

% julia +badchannel
ERROR: Invalid Juliaup channel `badchannel`. Please run `juliaup list` to get a list of valid channels and versions.

Developed with Claude.


Note unrelated bugfixes that are included:

If this PR isn't a simple merge it might be worth separating those out as a bugfix.

IanButterworth and others added 9 commits July 13, 2025 21:45
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Instead of using sorted_by() with an iterator chain, which can cause sorting panics with unstable comparison functions, this now:

Collects all the database channels into a vector
Extending it with the non-database channels
Uses sort_by() to sort the entire collection in place
This should resolve the i686 Windows CI failure because:

sort_by() is more robust than sorted_by() for handling comparison functions that might not provide perfect total ordering
All channels are sorted together rather than having separate sorted and unsorted sections
The sorting happens on the complete dataset rather than being chained
@IanButterworth
Copy link
Member Author

@davidanthoff I would prefer to be able to force push tidying these commits up into meaningful commits, but force push remains disallowed here. I think it should only be disabled for main and release branches.

@IanButterworth
Copy link
Member Author

@StefanKarpinski FYI. I think you mentioned this idea somewhere.

@davidanthoff
Copy link
Collaborator

Cool, I really like this feature!

A few comments:

  • I think we should have a little more opt-in for this, i.e. I don't think it is ideal that launching Julia might start a pretty large download. I think ideally what we want is this: If Julia is started in such a way that the REPL will eventually appear, then there should be an interactive prompt "Do you want to install channel X (y/n)", if Julia is started in non-interactive mode we should have a flag like --force-juliaupor something like that. I think we could also add a config setting where people can switch to the kind of fully automatic mode that is the default in this PR right now.
  • So far the julialauncher binary does not contain any of the more complicated code that adds stuff etc. Instead it largely spawns juliaupwith secret command line flags that do things. The reasoning was twofold: 1) I wanted to keep the binary size of julialauncherdown (not sure how relevant that actually is), and 2) I have some ideas that would require juliaupto adopt tokio, and then we definitely don't want that in julialauncher, and I think mixing things would make that more difficult. So maybe there is a way that have the actual install step spawn juliaupand then wait until that finishes?

Implementation wise, it might be the best strategy to separate the interactive mode detection code from #1095 as a separate PR, merge that, and then my first point above could probably be implemented fairly quickly?

I hear you on the push restriction, but without it things happened in the past where I ended up literally spending hours trying to fix push/merge conflicts and I really don't want to deal with that :) The history here is a total mess in any case already, so there is no point in putting time into a nice history for a PR, it would be a diamond in a very rough sea ;)

@IanButterworth
Copy link
Member Author

IanButterworth commented Jul 21, 2025

UI updated under my mouse.. accidental close.


@davidanthoff sounds good. I've made some changes along those lines

When a channel isn't installed, users now get prompted:

Question: The Julia channel 'nightly' is not installed. Would you like to install it?
  [y]es (default), [Y]es and remember, [n]o
Choice: 

In non-interactive mode (no TTY), it defaults to "no" and shows the standard error message.

The config is 3-state:

  • juliaup config autoinstallchannels true - Always auto-install (no prompts)
  • juliaup config autoinstallchannels false - Never auto-install (no prompts)
  • juliaup config autoinstallchannels default - Reset to prompt behavior
  • Unset (default) - Prompt in interactive mode, fail in non-interactive mode

And the launcher now spawns juliaup add <channel> as a subprocess rather than calling installation functions directly.

@@ -132,6 +134,119 @@ fn run_selfupdate(_config_file: &juliaup::config_file::JuliaupReadonlyConfigFile
Ok(())
}

fn is_interactive() -> bool {
std::io::stdin().is_terminal() && std::io::stderr().is_terminal()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a necessary condition, but I think in addition we need to parse the command line arguments and figure out whether the Julia process will jump into the REPL or execute either a script/code snippet. I think generally that if someone runs julia +FOO main.jlwe should not show anything interactive, regardless of whether things are running in a terminal or not.

I think the PR I linked to above should have code that does that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find that check in the linked PR, but added this check based on julia args.

std::io::stderr().flush()?;

let mut input = String::new();
std::io::stdin().read_line(&mut input)?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already use https://github.com/console-rs/dialoguer in the installer, we could use it here as well and have a consistent UI? But I'm not sure whether it actually has the kind of one-key-press option that I think would be ideal here.

I'm happy to merge as is if you want to keep it that way, just wanted to point to it :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's nicer. I wasn't aware. Updated

Copy link
Collaborator

@davidanthoff davidanthoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, that was fast :)

The only thing that I think we need to address is the interactive detection, otherwise looks great.

@davidanthoff
Copy link
Collaborator

Oh, and I should say: Once we have that, we should do a similar thing for the message that a channel is out-of-date, it also should just show a prompt offering to update right away if we are in interactive mode!

@IanButterworth IanButterworth changed the title Auto install versions via channel selection Offer to / automatically install versions via channel selection Jul 22, 2025
@christiangnrd

This comment was marked as resolved.

@IanButterworth
Copy link
Member Author

Bump @davidanthoff

Also,

Once we have that, we should do a similar thing for the message that a channel is out-of-date, it also should just show a prompt offering to update right away if we are in interactive mode!

I've been thinking about this and I don't think we should. I very often don't want to update because I just want to test what I have (and not hit more precompilation). I think adding a prompt in there might be more annoying than helpful.

@KristofferC
Copy link
Member

Yes, please no prompts.

@IanButterworth
Copy link
Member Author

@davidanthoff bump.

To try and help this along I'll see what copilot makes of it.

@IanButterworth IanButterworth requested a review from Copilot August 15, 2025 10:01
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements automatic installation of Julia channels when they are requested via command line channel selection (e.g., julia +1.8.2). It adds a new configuration option autoinstallchannels that controls whether to automatically install missing but valid channels.

  • Adds autoinstallchannels configuration option with true/false/default values
  • Implements automatic installation of valid channels when requested via +channel syntax
  • Updates test suite to verify auto-installation behavior works correctly

Reviewed Changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/command_config_autoinstall.rs New module implementing the autoinstallchannels configuration command
src/config_file.rs Adds auto_install_channels field to configuration structure with proper serialization
src/cli.rs Adds AutoInstallChannels subcommand to the config CLI interface
src/lib.rs Exports the new command_config_autoinstall module
src/operations.rs Fixes missing win32 handling and improves error message for pull request downloads
tests/channel_selection.rs Updates existing tests and adds new test for auto-installation functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

4 participants