How do I assign my own directory for packages in Julia - 0.7.0 (analogue of the definition of JULIA_PKGDIR in file juliars.jl for Julia-0.6)?
Windows 8, 10.
I think this is JULIA_DEPOT_PATH
in v0.7.
What are you using it for? It is highly likely that what you used it for in Julia v0.6 is not needed anymore with the new package manager.
Itās very useful for me to avoid putting lots under my home directory (which sits on a network drive) and have it on local storage instead (though the OP could well have a different use case).
Though I notice that packages checked out with ]develop
still end up in my home directory - Iāve not worked out how to change that yet.
You can set ENV["JULIA_PKG_DEVDIR"]
to change the default location of where Pkg puts packages that are dev
ed.
Note that there is nothing special with this directory. You can put packages anywhere and dev localpath
them (where localpath
is the path to the local package).
Thanks, thatās good to know.
So, if you have a package on GitHub in an org, the directory in ENV[āJULIA_PKG_DEVDIRā] will have a local git clone of the package if you do dev <packagename>
?
Yes, in joinpath(ENV[āJULIA_PKG_DEVDIRā], PackageName)
. Not sure using an env variable for this is the best but that is how it is right now.
That seems indeed to be the package development/update configuration. I still run into a chicken and egg situation for new packages where ādevelopā canāt resolve the package. In those cases I add the package to the v0.7 project, clone the package to the designated ādevā location and then execute ādevelop PkgNameā. I wonder if in the future āgenerateā is supposed to simplify this step. Currently āgenerateā creates a bare minimum project (I think, e.g. no License file, appveyor.yml, etc.).
Yes, it is barebone right now because when it was written it wasnāt clear exactly how things would look.
Some stuff related to this was recently fixed but please open issues with workflow problems.
Thanks Kristoffer, yes, I understand (and agree with) the reasoning for keeping it barebone.
On the chicken and egg remark, Iāll get back on that in an issue on Pkg (although I donāt think it is an issue, more a question about a suggested workflow, weāve always had that intermediate step of uploading to Github). Once that has been done, Pkg.add() updates the uncurated registry.
We used JULIA_PKGDIR
and JULIA_LOAD_PATH
to share a set of common packages among users in a managed desktop environment for Linux, Windows and Mac hosts. What would be the preferred method to establish such behaviour with 0.7?
There are a few different ways and which one is best depends on your use case.
One way is to have your own registry. Pkg3 supports multiple simultaneous registries so by putting your own registry in .julia/registries
(in addition to the default one) you can have your own set of packages, add and upgrade them exactly like the ones in the default registry. The tooling for setting up a registry is however lacking at the moment.
Another is to track git repositories using pkg> add localpath#branch
where localpath
is a path to a git repository. This works exactly like adding a repo at some branch from the internet. When commits are added to the branch, update
will pull them in.
The third way is to track a directory, i.e. saying that julia should load the package from a certain path. This is done by doing dev localpath
where localpath is a path to a package (doesnāt have to be a git repository). This simply tells julia that when loading the package, load it from that path. Any changes made to the files in that path is reflected when the package is reloaded.
@kristoffer.carlsson thanks for the explanations. The ideal solution would be something like a JULIAPATH environment (analog to Pythonās PYTHONPATH) where one could specify a list of directories where to look for packages. This would be very useful for managed multi-user desktop environments.
That exists, itās called LOAD_PATH and itās controlled by the JULIA_LOAD_PATH environment variable.
When updating packages from Julia v0.6.3 to v0.7.0, I changed the directory to a non-system disk. Now they are in new path: JULIA_DEPOT_PATH.
Would it be safe now to delete the old packages in system disk?
(Win10+VScode)
I didnāt find JULIA_DEPOT_PATH
in the documentation. Could this be added?
Absolutely, see List JULIA_DEPOT_PATH under Environment variables in the docs Ā· Issue #29714 Ā· JuliaLang/julia Ā· GitHub. Feel like contributing?