-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Modify the custom Python kernel #2049
Modify the custom Python kernel #2049
Conversation
- to activate the custom environment - for the respective Jupyter Notebook and Jupyter Console
@mathbunnyru Please review. |
env variables are identical for IPython (started from JupyterLab Terminal after executing Cross reference: #2047 (comment) |
# Uncomment this section to activate custom environment by default | ||
# This changes the custom Python kernel so that the custom environment will | ||
# be activated for the respective Jupyter Notebook and Jupyter Console | ||
RUN sed -i.bak ":a;N;\$!ba;s| }\n}| },\n \"env\": {\n \"XML_CATALOG_FILES\": \"\",\n \"PATH\": \"${CONDA_DIR}/envs/${env_name}/bin:\$PATH\",\n \"CONDA_PREFIX\": \"${CONDA_DIR}/envs/${env_name}\",\n \"CONDA_PROMPT_MODIFIER\": \"\(${env_name}\) \",\n \"CONDA_SHLVL\": \"2\",\n \"CONDA_DEFAULT_ENV\": \"${env_name}\",\n \"CONDA_PREFIX_1\": \"${CONDA_DIR}\"\n }\n}|g" "/home/${NB_USER}/.local/share/jupyter/kernels/${env_name}/kernel.json" |
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.
May I ask you to rewrite this in Python?
It's so difficult to read and understand.
You can write inline multiline Python using heredoc
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 am no Python guy...
diff /home/${NB_USER}/.local/share/jupyter/kernels/python310/kernel.json.bak /home/${NB_USER}/.local/share/jupyter/kernels/python310/kernel.json
12a13,21
> },
> "env": {
> "XML_CATALOG_FILES": "",
> "PATH": "/opt/conda/envs/python310/bin:$PATH",
> "CONDA_PREFIX": "/opt/conda/envs/python310",
> "CONDA_PROMPT_MODIFIER": "(python310) ",
> "CONDA_SHLVL": "2",
> "CONDA_DEFAULT_ENV": "python310",
> "CONDA_PREFIX_1": "/opt/conda"
Using ${CONDA_DIR}
instead /opt/conda
and ${env_name}
instead of python310
with the sed
command.
What is different? |
among others. |
@@ -3,3 +3,4 @@ ignored: | |||
- DL3006 | |||
- DL3008 | |||
- DL3013 | |||
- DL3059 |
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.
We need to either update docs or simply ignore this rule just once:
https://github.com/jupyter/docker-stacks/blob/b6104850fa83d19555884a1443e38dababe7df7b/docs/contributing/lint.md#ignoring-rules
It is better you create a new pull request on your own, then. I.e. rewrite in Python and decide where to place the hadolint rule. |
Issue ticket if applicable
Properly fix #2047. Prevent #2047 (comment).
Checklist (especially for first-time contributors)