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

Feature request: probing installed versions #99

Open
jlapeyre opened this issue Dec 14, 2021 · 4 comments
Open

Feature request: probing installed versions #99

jlapeyre opened this issue Dec 14, 2021 · 4 comments

Comments

@jlapeyre
Copy link

I'd like to be able to do something like query for the path to the installation of the most recent stable version. For example, under linux, this might return

/home/username/packages/julias/julia-1.6/

I looked through the jill source and it seems the functions to do this are not immediately available. It may be out of scope for the jill project. But, I am thinking of using jill in conjunction with pyjulia and in particular this: julia_project. With a little more functionality in jill I could do this.

  1. Make a python package that uses julia_project (or a similar tool, I think there may be others) to manage the Julia dependency. The python package is, say, mypackage.
  2. Provide a function mypackage.install_julia() (Perhaps make it automatic, but I don't favor that.) that uses julia_project and jill to download and install julia. New feature --> Use jill to find the installation directory. Then julia_project uses this path to configure pyjulia.

There are two advantages. First, the user does not need ensure that the symlinked directory is in their PATH. It requires no user intervention outside of Python. Second, some people, like myself use a Julia with a custom system image as their default Julia. But, for mypackage I can't use this, I need a Julia with this stock image. In fact, via, julia_project, mypackage will manage it's own custom system image.

@johnnychen94
Copy link
Owner

johnnychen94 commented Dec 15, 2021

I'm not sure how to do it correctly; should I just limited myself to jill-specific structure julias/julia-?.?, or even juliaup-specific version and broader cases?

If it's the first case, then it might be as simple as checking default_install_dir()? For instance:

import os
from jill.utils.defaults import default_install_dir as jill_install_dir

julias_root = jill_install_dir()
julias = [os.path.join(julias_root , x) for x in os.listdir(julias_root ) if x.startswith("julia")]

This gives me the following results on my windows machine:

['C:\\Users\\jc\\AppData\\Local\\julias\\julia-1.6',
 'C:\\Users\\jc\\AppData\\Local\\julias\\julia-1.7']

@jlapeyre
Copy link
Author

That's a good question. I had been thinking only of jill installations. But, perhaps covering juliaup would also be useful. Your example looks good. I was reluctant to roll my own using jill because I am unable to test on mac and windows (I have only linux), and because I am unsure of what might appear in jill_install_dir. For example, whether you might find both julia-1.6 and julia-1.6.4. I think the latter never happens, but I am not sure. Another thing is that I can hard code in my application that 1.6 is the current LTS and 1.7 the latest stable. But, that assignment might get stale.

@johnnychen94
Copy link
Owner

Okay so we can get the installed dir from default_install_dir, and then we can try to find if there exists a folder named julia-$stable_version in the install dir.

from jill.utils.version_utils import latest_version as jill_latest_version
from jill.utils.sys_utils import current_architecture, current_system
from jill.utils.defaults import default_install_dir as jill_install_dir
stable_version = jill_latest_version("", current_system(), current_architecture()) # '1.7.0'
stable_version  = '.'.join(stable_version.split('.')[0:2]) # '1.7'

I'm not sure how you would like it to be, maybe you can put up a PR for this?

FYI, jill uses https://julialang-s3.julialang.org/bin/versions.json to find out the latest stable version. That file doesn't have LTS information so people still need to hardcode what the latest LTS is.

@jlapeyre
Copy link
Author

This looks like it's on the right track. Yes, since I have an immediate use case, I'll try to find time soon to make a PR to jill.py that is generally useful.

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

No branches or pull requests

2 participants