Skip to content

Conversation

@KristofferC
Copy link
Member

alternative to #1095

I am not much of a rust programmer so I kind of wrote pseudo code and had Claude Code translate it for me. Should still do some manual cleanups.

In use:

~/JuliaPkgs/TimerOutputs.jl
❯ julia --project -q
Info: Installing Julia 1.10.10 automatically per juliaup settings...
Checking for new Julia versions
Info: Successfully installed Julia 1.10.10.
julia> VERSION
v"1.10.10"

# Change the manifest file

~/JuliaPkgs/TimerOutputs.jl
❯ julia --project -q
Info: Installing Julia 1.10.8 automatically per juliaup settings...
Checking for new Julia versions
Installing Julia 1.10.8+0.aarch64.apple.darwin14
Info: Successfully installed Julia 1.10.8.
julia> VERSION
v"1.10.8"


// Search for manifest files in priority order
// JuliaManifest.toml takes precedence over Manifest.toml
for manifest_name in ["JuliaManifest.toml", "Manifest.toml"] {
Copy link
Member

@DilumAluthge DilumAluthge Oct 30, 2025

Choose a reason for hiding this comment

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

Needs support for {Julia,}Manifest-vX.Y.toml

Copy link
Member

Choose a reason for hiding this comment

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

One idea:

  1. Loop over all files in the directory. Ignore folders.
  2. Collect only the filenames that match the allowed patterns.

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 it would also be reasonable (and in my mind a bit less magical) to say that version selection via the manifest only happens from a JuliaManifest.toml or Manifest.toml file.

The {Julia,}Manifest-vX.Y.toml manifests would then only come into play if one used a higher precedent order override.

@DilumAluthge
Copy link
Member

How should this work if the project directory has multiple versioned manifests, e.g. Manifest-1.10.toml and Manifest-1.12.toml?

@KristofferC
Copy link
Member Author

Probably the highest version?

@KristofferC KristofferC force-pushed the kc/auto_version_select branch from 2510c05 to 842eafa Compare October 31, 2025 18:52
@DilumAluthge
Copy link
Member

DilumAluthge commented Oct 31, 2025

Probably the highest version?

That seems okay.

If the user explicitly provides the desired version (e.g. julia +1.10 --project or julia +1.10.3 --project or julia +lts --project), we'd respect the Julia version specified by julia +ver, right?

@KristofferC
Copy link
Member Author

If the user explicitly provides the desired version (e.g. julia +1.10 --project or julia +1.10.3 --project or julia +lts --project), we'd respect the Julia version specified by julia +ver, right?

Yes, if you look at the priority in the README (which I updated here) it is:

1. A command line Julia version specifier, such as `julia +release`.
2. The `JULIAUP_CHANNEL` environment variable.
3. A directory override, set with the `juliaup override set` command.
3. The default Juliaup channel.
4. Automatic version selection based on the active project.
5. The default Juliaup channel.

So an explicitly provided version has top-priority and will always be used.

@DilumAluthge
Copy link
Member

BTW I think item 3 should be removed from that list? Redundant with item 5, and IIUC you prefer item 4 over item 5?

@KristofferC KristofferC force-pushed the kc/auto_version_select branch 3 times, most recently from 220d16a to 58b6b04 Compare October 31, 2025 22:15
@KristofferC
Copy link
Member Author

I don't fully understand why it is redundant or why this PR makes it more redundant.

@davidanthoff
Copy link
Collaborator

I believe @DilumAluthge was just looking at the list as pasted in the comment here, where there are two 3) items. It is all correct in the PR that modifies the README.

@KristofferC
Copy link
Member Author

Oops, I must have copy pasted from the diff.

@KristofferC
Copy link
Member Author

I realize a better way of testing this is (of course) to call julia itself with the same project flag and env variable and get the truth from that.

@IanButterworth
Copy link
Member

Just had a thought.. how does this handle manifests from julia master, i.e. 1.14, given that there's no "1.14" channel? I guess there isn't a "1.13" either.

@KristofferC
Copy link
Member Author

KristofferC commented Nov 2, 2025

It uses nightly channel if the version is higher than any known version. But maybe it should emit some warning when that happens...

@KristofferC KristofferC force-pushed the kc/auto_version_select branch 3 times, most recently from c846ba4 to 988b305 Compare November 3, 2025 09:36
@tecosaur
Copy link
Member

tecosaur commented Nov 3, 2025

I may be missing something, but why is this ~3x the LOC of #1095? Is this PR larger in scope?

I do notice that #1095 was written before versioned manifests became a thing, but that seems like just a handful of extra lines.

@KristofferC KristofferC marked this pull request as draft November 3, 2025 11:21
@KristofferC
Copy link
Member Author

KristofferC commented Nov 3, 2025

I can remove tests if you want to... But as I have said, you are free to reopen your PR and we can try them on a bunch of cases. But based on

I don't think it's realistic that I'll get around to writing the missing tests, let alone resolving the merge conflicts any time soon.

I thought you didn't plan on getting back to that "any time soon" so I started this. I don't know if four days counts as "any time soon" or if just the fact that someone else started working on it made your desire come back.

However, some things that this does that might be different from that branch:

  • Launch +nightly if the version is > than anyone version we know
  • Launch 1.x+nightly if x is > than any version we now for 1.x
  • Expand ~ to homedir
  • LOAD_PATH
  • Logging
  • Versioned manifests
  • Maybe more, didn't look more.

@tecosaur
Copy link
Member

tecosaur commented Nov 3, 2025

I can remove tests if you want to... But as I have said, you are free to reopen your PR and we can try them on a bunch of cases. But based on

Oh, I'm talking about the non-testing code. Taking a slightly closer look, it seems like ~700 LOC compared to ~400 in the original PR, which doesn't seem too bad given the extra functionality you mentioned.

I thought you didn't plan on getting back to that "any time soon" so I started this. I don't know if four days counts as "any time soon" or if just the fact that someone else started working on it made your desire come back.

Yea, I wasn't thinking of getting back to this any time soon when I said that. I also have a track record of getting around to things later than I expected, which I try to account for.

After making that comment, and given you said that functionality seems needed, I then thought I should just "take a peek" at it that evening to see how bad the merge conflicts really are, and then we talked about how the functionality should work over Slack, and all that moved the work from back-of-mind to front-of-mind. I tend to work on what I'm thinking about.

Net result: I've ended up poking at this months earlier than I thought I would. If there is value in me spinning up that branch again, it's much more viable than it was four days ago. However, if Sonnet 4.5 can't take care of the test writing, or for some other reason the work ends up in limbo again, I don't currently have the motivation in this area to keep working on this for a prolonged period.

Looking at how hard adding project/nightly/versioned manifest support is, and doing it if it's easy, I am up for (but not much more).

@KristofferC KristofferC force-pushed the kc/auto_version_select branch 2 times, most recently from 0a18fe8 to f0e8600 Compare November 3, 2025 13:56
@KristofferC
Copy link
Member Author

KristofferC commented Nov 3, 2025

I rewrote a lot of the implementation here because I realized (while being on the treadmill 🏃‍♂️) that it made a lot of sense to just directly "transpile" the julia code itself that does the project and manifest file resolving. That should make it easier to review, easier to update and more likely to be correct.

As a test of one of the functionality I wanted to use this for I did:

(@v1.12) pkg> app add https://github.com/KristofferC/Rot13.jl
...
[ Info: For package: Rot13 installed apps rot13

which installs the rot13 Julia app. I then set the julia command to run apps with to the juliaup julia and we can see how it detects the julia version in the manifest for the app (which requires JULIA_LOAD_PATH handling support) and uses the correct version:

❯ JULIAUP_LOG=Debug JULIA_APPS_JULIA_CMD=~/juliaup/target/debug/julia rot13 foobar
[2025-11-03T13:54:58Z DEBUG julia] VersionDetect::Found valid project in JULIA_LOAD_PATH entry: /home/kc/.julia/environments/apps/Rot13
[2025-11-03T13:54:58Z DEBUG julia] VersionDetect::Using project file: /home/kc/.julia/environments/apps/Rot13/Project.toml
[2025-11-03T13:54:58Z DEBUG julia] VersionDetect::Detected manifest file: /home/kc/.julia/environments/apps/Rot13/Manifest.toml
[2025-11-03T13:54:58Z DEBUG julia] VersionDetect::Read Julia version from manifest: 1.12.1
sbbone

@KristofferC KristofferC marked this pull request as ready for review November 3, 2025 14:00
@KristofferC KristofferC force-pushed the kc/auto_version_select branch 2 times, most recently from b133d52 to e5e59b0 Compare November 3, 2025 14:03
@KristofferC KristofferC force-pushed the kc/auto_version_select branch from e5e59b0 to 8d605db Compare November 3, 2025 14:27
@KristofferC KristofferC force-pushed the kc/auto_version_select branch from 8d605db to 320a1b6 Compare November 3, 2025 15:27
@KristofferC
Copy link
Member Author

I think I am fairly happy with this now. Maybe the number of tests is a bit excessive; I basically added a test as soon as I found something missing or buggy.

@DilumAluthge
Copy link
Member

DilumAluthge commented Nov 3, 2025

Personally I'm always a fan of having lots of tests.

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.

5 participants