-
-
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
RFC: major LOAD_PATH machinery simplification #27633
Conversation
If I'm understanding this correctly, this means that |
The current directory isn't in the default |
That's because the workflow of 0.6 is to put everything into a globally-accessible environment (
Right now this is easy because I think most of the changes in this PR are good; I like the shorthand you've introduced into
|
would you put |
I don't think these are quite comparable; this behavior is gated upon the existence of a I am against having |
I share the concerns with @staticfloat that this might be a bit annoying. Also, it seems a bit odd to swap one file Some workflow examples:
If we have to tell people to use some external tool to do this quite basic package management functionalities then we have in my opinion sort of failed. The suggestion of using the pwd when starting julia and having a command that updates it seems like a good compromise. |
Any program is going to have security problems if it can execute arbitrary code given the existence of a suitably-named file in the current working directory upon startup. This is the entire reason direnv has a mechanism for making sure such environment settings are desired and approved before any code is executed. |
Let me stick to a more concrete example: my |
What if there needs to be an explicit command to activate the pwd environment? |
This should eliminate my concern (though it would be good to think carefully through the details of how this would work with a security mind-set). |
4ff9c3a
to
1899084
Compare
Edit: Due to an outdated page, I wrote this before seeing most of the above responses but there's still an interesting observation at the end. The One consideration we have is that if you could trivially load something anyway, then being fussy about automatically adding it to the load path is silly. So, for example, if |
What if I put the |
I had also thought of this; "whitelisting" certain directories. In the end, I don't like it, because I want the rules to be dead-simple and easily manipulated by other pieces of code.
Whatever we do, I think having intelligent shorthands for all pieces of functionality here is important, so 👍 from me.
I think the big missing piece is a programmatic way of toggling that difference at runtime. E.g. my concerns about workflow could be all but eliminated with the existence of |
Does this qualify?
If I add back the
I'd prefer to avoid getting into the With the
You can put the exact same thing in your project's |
I don't think we're on the same page as to what
So there would be no centralized database. I'm totally in agreement with you that we don't want that. I suspect, however, that what we want is slightly more involved than an While the I also think we need to clarify really quick; when you say |
1899084
to
f3cfcd4
Compare
I think I get what you're saying now:
Does that seem right? I think that's a good arrangement. I will do 2 and 3 in separate PRs because we need to figure out the exact semantics of |
Yes, that sounds perfect to me. |
I admit I'm not certain we want |
I'm working on a version where it doesn't, so we can choose. |
I've got the How should
Thoughts, @staticfloat? (Or anyone else) |
As for where So I think the simplest thing makes sense; the current environment is
|
65f0b47
to
8df73eb
Compare
FWIW, this is pretty much exactly what I had in mind as well. |
Such sweet sorrow: CI straight flush with merge conflicts. |
This makes LOAD_PATH just a vector of strings again. Some special syntaxes in JULIA_LOAD_PATH are handled specially: - split on `:` or `;` (on Windows) - replace the first empty entry with DEFAULT_LOAD_PATH - ignore the remaining empty entries - replace `@` with `current_env()` Other special syntaxes are left alone and expanded during load path lookup: - occurrences of `#` in `@...` entries to version digits - `@name` is looked up in the depot path - `@` is replaced with `current_env()` The last functionality is not accessible via JULIA_LOAD_PATH in this version since `@` in that is expanded early. This does allow putting a literal `@` in LOAD_PATH to get late expansion to `current_env()` instead of early expansion. Fixes #27411
8df73eb
to
e1b0965
Compare
macOS failure is #26725 |
Good enough CI results given the previous straight flush. |
JuliaLang/Pkg.jl#360 inspired me to look at direnv and think that we should consider not doing anything dynamic with
the load path based on the current environment and instead let that be done with external tools like
direnv
which specialize in that sort of thing.Among other changes, in order to facilitate that, this PR expands empty
JULIA_LOAD_PATH
entries by replacing the first one withDEFAULT_LOAD_PATH
and ignoring the subsequent ones. This means that in a shell script one can do this:The effect of this will to prepend the current working directory to the
LOAD_PATH
regardless of whetherJULIA_LOAD_PATH
is set or not.This PR also makes
@stdlib
a syntax for the standard library path, which is handy since otherwise specifying it is annoying. As part of that change, it introducesSys.STDLIB
— remembering the incanation to find the stdlib directory was kind of a drag.Finally, this PR defers all dynamic expansion of
LOAD_PATH
entries until lookup time. These dynamic behavior include:@stdlib
toSys.STDLIB
.@v#.#
to@v0.7
for example; more generally this is replacing the first three#
in a named env with components of the Julia version number (i.e.VERSION.major
, etc.).DEPOT_PATH
.Project.toml
to project directories.