Skip to content
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

🛠️ Add Jupyter Kernel alteration scripts #47

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Gary-H9
Copy link
Contributor

@Gary-H9 Gary-H9 commented Nov 18, 2024

Caution

If this is merged, and the image is published, any users that consume the image will have changes made to any kernel.json files in home/joyvan

This PR is being raised in relation to this piece of work.

This PR allows users to run the scripts alter-jupyter-kernels.sh and reverse-alter-jupyter-kernels.sh to update kernels in their home directories for use in JupyterLab.

Summary for alter-jupyter-kernels.sh

This PR updates the script to enhance functionality by:

  1. Copying the .local directory from the source location to the target location.
  • source: /home/jovyan/.local/share/jupyter/kernels
  • target: /home/analyticalplatform/.local/share/jupyter/kernels
  1. Editing all kernel.json files in the copied directory to replace instances of jovyan with analyticalplatform.

Script Explanation

Key Features:

  1. Copy Operation:

    • The script now copies the entire .local/share/jupyter/kernels directory structure from the SOURCE_DIR (/home/jovyan/.local/share/jupyter/kernels) to the TARGET_DIR (/home/analyticalplatform/.local).
    • Ensures all subdirectories are included in the copy. (I've tested this locally)
  2. Kernel Editing:

    • Searches for all kernel.json files within the target directory (/home/analyticalplatform/.local/share/jupyter/kernels).
    • Replaces occurrences of jovyan with analyticalplatform using sed.

Note:

  • SOURCE_DIR: Location of the source files.
  • TARGET_DIR: Base directory for the copied files.
  • BASE_DIR: Subdirectory where kernel.json files are located for editing.

reverse-alter-jupyter-kernels.sh effectively works in reverse.

@Gary-H9 Gary-H9 changed the title 🛠️ Add Jupyter Kernel script to entrypoint 🛠️ Add Jupyter Kernel script Jan 28, 2025
@Gary-H9 Gary-H9 changed the title 🛠️ Add Jupyter Kernel script 🛠️ Add Jupyter Kernel alteration scripts Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant