-
-
Notifications
You must be signed in to change notification settings - Fork 285
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
⚙ new config system without environment variables #367
Conversation
3140108
to
e29de19
Compare
@@ -82,7 +82,7 @@ function create_emptyworkspacemodule(pid::Integer)::Symbol | |||
end | |||
|
|||
function default_environment_path(::Nothing) | |||
get_pl_env("PLUTO_DEFAULT_ENVIRONMENT_PATH") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fonsp sorry I didn't bring this up in last PR. I'm wondering what's the reason to change PLUTO_PROJECT
to PLUTO_DEFAULT_ENVIRONMENT_PATH
? I think at least at CLI side, this variable is exactly the same as JULIA_PROJECT
: it can be used to interact with some environment manager tool (e.g direnv
) to control the environment variable, but when pluto --project
is used, it gets overwrite by --project
. I find PLUTO_PROJECT
is more consistent with Pkg, which is easier to remember, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this name is short enough to be explicit. If you want to make the environment variable name actually matches the field name in the struct
s, I think renaming the internal field names is probably better.
There is a few things I will update if @fonsp agrees with that:
|
src/evaluation/WorkspaceManager.jl
Outdated
@@ -97,6 +97,9 @@ function resolved_environment_path(notebook::Notebook) | |||
else | |||
if isabspath(notebook.environment_path) | |||
tamepath(notebook.environment_path) | |||
elseif notebook.environment_path == "@." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this fix the issue that when notebooks are specified with @.
the project is using notebook_dir/@.
path.
there a few other things I just realize that the workspace process is currently spawned by inheriting all main process flags - which is something we don't want. e.g if I start the main process in CLI with I'm thinking about implementing a kwargs interface in |
Thanks! I'll write a comment here: #366 |
bbaf1db
to
0302e50
Compare
to be short, I basically make all the configs go into a For interface level, I haven't implement the All paths are handle dynamically, this will make system image build happy. |
src/webserver/Session.jl
Outdated
working_directory::String = default_working_directory() | ||
run_notebook_on_load::Bool = true | ||
workspace_use_distributed::Bool = true | ||
require_token_for_open_links::Bool = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put security struct back.
@Roger-luo what do you think? |
perfect, now let me add:
then I think we are good to go! |
I just added the kwargs interface for but somehow I cannot start a notebook session from this PR, something is broken... I need to check what's wrong. It seems that I need to take some more time to figure out this. |
|
Let's merge? |
cool, it works now! I didn't realize there were other things that need to update. I tried to add some tests. I think it should be good to merge. |
Can you check why the tests failed? |
oops I wrote a wrong path in the test, let's see if it passes now. |
|
OK I think this is because when we assume each project starts with However, the newly created notebooks are in a |
umm, it seems before |
About About |
I think I find out why, this is also the reason for #342 , basically, this is because Pluto will try to create a workspace in the server process to make UI loading faster. But it does not cd back when it finishes the job. This is causing
|
offline_workspace = WorkspaceManager.make_workspace(notebook, false) | ||
|
||
# "A Workspace on the main process, used to prerender markdown before starting a notebook process for speedy UI." | ||
offline_workspace = WorkspaceManager.make_workspace( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this workspace is created in the server process, which is causing the following workspace's compiler options pwd become incorrect.
Aha! good catch |
I fixed #342 with a workaround for now in this PR, but I think it's not fully resolved: if a user config the server process to not use now, all the notebook environment behaviour, no matter it's new notebook or not should be the same. to summarize the current behaviour: Session Environment
Notebook Environmentone can create a notebook with notebook environment, or open a single notebook via |
This PR makes most of the path and env relocatable by runtime evaluating them (instead of compile time) and enable all Pluto environment variables to have a prefix
JULIA_
or not. (note this needs #341 to be merged first)