-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
what should be in LOAD_PATH, DEPOT_PATH #25709
Comments
cc @KristofferC, @stevengj (among others) |
Note: for convenience and compatibility reasons, if you have a directory with package entry-points in the [ Base.CurrentEnv(),
joinpath(DEPOT_PATH[1], "dev")
[ Base.NamedEnv("v0.7.0"),
Base.NamedEnv("v0.7"),
Base.NamedEnv("v0"),
Base.NamedEnv("default"),
Base.NamedEnv("v0.7", create=true) ],
"/usr/share/julia/stdlib" ] This would mean package name resolution would look in this order:
Reasoning for the order: the project should override anything it wants; if you're developing some package, that should come next; if you have standard things you like to use, that comes next, and finally whatever the system supplies by default should come last. Alternately, when you do |
What do nested arrays in LOAD_PATH mean? Is it just a convenient way to insert and remove several items at once? |
It resolves to a single item – the first one for which [ Base.NamedEnv("v0.7.0"),
Base.NamedEnv("v0.7"),
Base.NamedEnv("v0"),
Base.NamedEnv("default"),
Base.NamedEnv("v0.7", create=true) ] entry evaluates to:
|
How does that differ from the behavior you'd get if the arrays were flattened? |
If |
Now that I've written up how the new code loading system works, it would be great if people could read that and then help me figure out the answer to this issue. |
Note that |
I think the priority order for LOAD_PATH should be
Then DEPOT_PATH only needs to contain How about |
Ok, that's good thinking—thanks for the input. I think that
The reason I'm not sure about the latter is that the user can add those things to their own default named environment. Having a system-wide package directory at all just means that different people have different things available by default in the REPL, which I'm not sure is a good thing. I feel like the real reason sysadmins have pre-installed versions is so that everyone doesn't need to download, compile, install those things themselves since having many copies is a waste of space and they may be hard to compile and install correctly. The system-wide depot path entry already addresses that issue. |
A related concern is that we may want the package version resolver to favor versions that are already installed and available. Otherwise it won't really matter that there are pre-installed system versions of packages because people will do |
Ok, I can get on board with that. We just say that the purpose of system-wide packages is basically to download things for you (and de-duplicate), and not to muck with your environment. In that case LOAD_PATH is
and DEPOT_PATH is
|
Yes, I think that's the right answer. Excellent. I'll make a PR now that we have a decision. |
also: - rename "site" directory to "stdlib" since that's what it is now - use JULIA_LOAD_PATH as-is instead unconditionally appending the system package and stdlib directories to it - change default DEPOT_PATH to include system paths: one for arch-specific and one for arch-independent packages - delete comment about bundled code going in a versioned directory as it no longer applies since installed packages can and should be shared across different Julia versions
also: - rename "site" directory to "stdlib" since that's what it is now - use JULIA_LOAD_PATH as-is instead unconditionally appending the system package and stdlib directories to it - change default DEPOT_PATH to include system paths: one for arch-specific and one for arch-independent packages - delete comment about bundled code going in a versioned directory as it no longer applies since installed packages can and should be shared across different Julia versions - update Pkg3 and tests to work correctly when the stdlib directory isn't always included in LOAD_PATH fix failing tests
also: - rename "site" directory to "stdlib" since that's what it is now - use JULIA_LOAD_PATH as-is instead unconditionally appending the system package and stdlib directories to it - change default DEPOT_PATH to include system paths: one for arch-specific and one for arch-independent packages - delete comment about bundled code going in a versioned directory as it no longer applies since installed packages can and should be shared across different Julia versions - update Pkg3 and tests to work correctly when the stdlib directory isn't always included in LOAD_PATH fix failing tests
* origin/master: (22 commits) separate `isbitstype(::Type)` from `isbits` (#26850) bugfix for regex matches ending with non-ASCII (#26831) [NewOptimizer] track inbounds state as a per-statement flag change default LOAD_PATH and DEPOT_PATH (#26804, fix #25709) Change url scheme to https (#26835) [NewOptimizer] inlining: Refactor todo object inference: enable CodeInfo method_for_inference_limit_heuristics support (#26822) [NewOptimizer] Fix _apply elision (#26821) add test case from issue #26607, cfunction with no args (#26838) add `do` in front-end deparser. fixes #17781 (#26840) Preserve CallInst metadata in LateLowerGCFrame pass. Improve differences from R documentation (#26810) reserve syntax that could be used for computed field types (#18466) (#26816) Add support for Atomic{Bool} (Fix #26542). (#26597) Remove argument restriction on dims2string and inds2string (#26799) (#26817) remove some unnecessary `eltype` methods (#26791) optimize: ensure merge_value_ssa doesn't drop PiNodes inference: improve tmerge for Conditional and Const ensure more iterators stay type-stable code loading docs (#26787) ...
LOAD_PATH
In #25455, I tried to keep things as compatible as possible, leaving the contents of
LOAD_PATH
as a superset of what was in it previously. The current default contents is:This has the effect of looking in the following places:
Project.toml
file, if anyjoinpath(DEPOT_PATH[1], "environments", "v0.7.0")
if it existsjoinpath(DEPOT_PATH[1], "environments", "v0.7")
if it existsjoinpath(DEPOT_PATH[1], "environments", "v0")
if it existsjoinpath(DEPOT_PATH[1], "environments", "default")
if it existsjoinpath(DEPOT_PATH[1], "environments", "v0.7")
even if it doesn't existJULIA_PKGDIR
The first entry can be replaced and number of items by setting the
JULIA_LOAD_PATH
environment variable. The other threeLOAD_PATH
entries are added no matter what you do, which is not ideal since we would like for users to be able to control their load path entirely. However, that does mean that if the user does not include the stdlib environment in their load path, they will not be able to use stdlib packages.The second entry is a legacy thing that allows us to continue loading Pkg2-installed packages. We should deprecate this whenever we replace Pkg2 with Pkg3: at that point, we can have a
DeprecatedEnv
loader that allows this to continue working but prints a warning message if the target directory actually exists. That way people can keep using Pkg2-installed packages during the 0.7 transition, but they'll get a warning that they should reinstall packages using Pkg3.DEPOT_PATH
The new code loading system separates how to resolve what package names mean from where to look for installed versions of packages. The
LOAD_PATH
is involved in deciding whatimport Foo
means in various contexts. A package name can mean one thing in your code while meaning a different thing to each of your dependencies; this is essential in Pkg3 since there is no longer a single global namespace of package names: METADATA is replaced with a federated system of package registries, which can be public or private.Once the identity and version of
Foo
is resolved by looking in theLOAD_PATH
, finding the code for that version of the package is a separate step, which involves looking through theDEPOT_PATH
in thepackages
directory of each until an installed copy of the package is found (or isn't). Currently, theDEPOT_PATH
defaults to only containingjoinpath(homedir(), ".julia")
– i.e. your "home depot" (I did not anticipate this pun when choosing the name "depot" but there it is). However, we'll want to support looking for installed packages in multiple different places, most likely including:~/.julia
/usr/local/share/julia/site/
/usr/share/julia/site/
/usr/share/julia/stdlib
?I'm decreasingly sure what these paths should be so input and thoughts would be helpful here.
LOAD_PATH defaults
Since "what" is now addressed by
LOAD_PATH
while "where" is addressed byDEPOT_PATH
, we generally want far fewer things inLOAD_PATH
. In fact, when testing a project, you generally only want that project's environment – and maybe a a "test environment" – in theLOAD_PATH
so that if you try to load anything that isn't recorded and identified in the project'sProject.toml
file, you'll get a failure. However, it's handy when developing to be able to augment the project environment with tools like debuggers, profilers,Revise.jl
, etc.What should be in the default load path in 1.0? Maybe just this:
If you start Julia in a project directory the, you'll only be able to load the project's dependencies and standard libraries – which, incidentally should probably also be recorded as project dependencies. Or maybe we want something more like this:
That would mean that you can load whatever's in the current project if it exists, the standard library, and whatever's in your default named environment, which would presumably include all your dev tools and other favorite packages.
Controlling the LOAD_PATH
We'll want some convenient ways to manipulate the
LOAD_PATH
, e.g. to run with only the current environment visible. Design ideas are welcomed here, but my thought was that we'd have some command-line options to control this such as:It's a little weird to call this option
--env
when it manipulates theLOAD_PATH
but maybe that's ok. We could also write itjulia --load-path=...
but I still like--env
as a name for this since theLOAD_PATH
is a list of environments to look in for dependencies.The text was updated successfully, but these errors were encountered: