I'm trying to create Julia processes that aren't initially bound to a project, and then bind themselves to a project on demand. I'm wondering if I can create a result similar to julia --project=X
if a Julia process is created with an "unset project" (or similar) such that a Pkg.activate(X)
(or similar) yeilds a result indistinguishable from julia --project=X
.
If you haven't set JULIA_LOAD_PATH
then those area already equivalent.
I'm thinking of setting JULIA_LOAD_PATH
to @v#.#:@stdlib
then running push!(LOAD_PATH, "@")
and set_active_project(<project>)
might work.
What are you trying to achieve? If you can manipulate the environment variable I would do only that and nothing from Julia.
I'm trying to create Julia processes that aren't initially bound to a project, and then bind themselves to a project on demand.
I have a way of creating Julia daemon processes for a particular project, but when they start up they take ~2s to do the setup and compiling. So, I'm thinking I could perhaps create an "unbound" daemon process in reserve, and then when requested simply set its project and hand it over, instead of going through the whole initialisation process at that point.
Okay, the I would just do push!(empty!(LOAD_PATH), "new/project")
or something like that
Timothy said:
I'm thinking of setting
JULIA_LOAD_PATH
to@v#.#:@stdlib
then runningpush!(LOAD_PATH, "@")
andset_active_project(<project>)
might work.
This seems to work
Timothy has marked this topic as resolved.
You might as well put the @
in the environment variable too then.
It doesn't matter what the project/load-path is during julia
startup?
No
Oh good, that resolves some of my worries. I took note of this line in the environment variables docs:
JULIA_PROJECT must be defined before starting julia; defining it in startup.jl is too late in the startup process.
You are not using JULIA_PROJECT
though.
Mmm, I just took this to say the full effect of setting JULIA_PROJECT
could not be simulated/applied after launching julia
Last updated: Nov 06 2024 at 04:40 UTC