Unverified Commit f9acb6aa authored by Samruddhi Khandale's avatar Samruddhi Khandale Committed by GitHub

Python bug fix - Add jupyterlab even if python is not installed by Feature but exists (#244)

* python fix bug

* fix test

* address comments

* address comment
parent a5655189
{
"id": "python",
"version": "1.0.13",
"version": "1.0.14",
"name": "Python",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/python",
"description": "Installs the provided version of Python, as well as PIPX, and other common Python utilities. JupyterLab is conditionally installed with the python feature. Note: May require source code compilation.",
......
......@@ -322,7 +322,7 @@ sudo_if() {
install_user_package() {
PACKAGE="$1"
sudo_if "$INSTALL_PATH/bin/python3" -m pip install --user --upgrade --no-cache-dir "$PACKAGE"
sudo_if "${PYTHON_SRC}" -m pip install --user --upgrade --no-cache-dir "$PACKAGE"
}
add_user_jupyter_config() {
......@@ -413,6 +413,10 @@ if [ "${PYTHON_VERSION}" != "none" ]; then
chown -R "${USERNAME}:python" "${PYTHON_INSTALL_PATH}"
chmod -R g+r+w "${PYTHON_INSTALL_PATH}"
find "${PYTHON_INSTALL_PATH}" -type d -print0 | xargs -0 -n 1 chmod g+s
PYTHON_SRC="${INSTALL_PATH}/bin/python3"
else
PYTHON_SRC=$(which python)
fi
# Install Python tools if needed
......@@ -464,6 +468,11 @@ fi
# Install JupyterLab if needed
if [ "${INSTALL_JUPYTERLAB}" = "true" ]; then
if [ -z "${PYTHON_SRC}" ]; then
echo "(!) Could not install Jupyterlab. Python not found."
exit 1
fi
install_user_package jupyterlab
install_user_package jupyterlab-git
......
#!/bin/bash
set -e
# Optional: Import test library
source dev-container-features-test-lib
# Always run these checks as the non-root user
user="$(whoami)"
check "user" grep vscode <<< "$user"
# Check for an installation of JupyterLab
check "version" jupyter lab --version
# Report result
reportResults
......@@ -13,6 +13,7 @@
"remoteUser": "vscode",
"features": {
"python": {
"version": "latest",
"installJupyterlab": true,
"configureJupyterlabAllowOrigin": "*"
}
......@@ -36,6 +37,17 @@
"python": "os-provided"
}
},
"install_jupyterlab_from_python_image": {
"image": "mcr.microsoft.com/devcontainers/python:3.10-bullseye",
"remoteUser": "vscode",
"features": {
"python": {
"version": "none",
"installTools": false,
"installJupyterlab": true
}
}
},
"install_via_oryx": {
"image": "mcr.microsoft.com/oryx/build:full-debian-bullseye",
"features": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment