Skip to content

Commit

Permalink
Merge pull request #23 from stefmolin/troubleshooting-devcontainer-ju…
Browse files Browse the repository at this point in the history
…pyter

Enable JupyterLab option for codespaces
  • Loading branch information
stefmolin authored Jun 12, 2023
2 parents b860974 + cf60669 commit a1536f9
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 16 deletions.
7 changes: 6 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ RUN cd /tmp \

# Create the conda environment
COPY environment.yml /tmp/conda-tmp/
RUN umask 0002 && $MAMBA_EXE env create --file /tmp/conda-tmp/environment.yml && $MAMBA_EXE init
RUN $MAMBA_EXE env create --file /tmp/conda-tmp/environment.yml --prefix /home/vscode/.conda/envs/data_viz_workshop \
&& $MAMBA_EXE init

# Update PATH for Jupyter editing option
ENV PATH="/home/vscode/.conda/envs/data_viz_workshop/bin:${PATH}"
ENV PROJ_LIB="/home/vscode/.conda/envs/data_viz_workshop/share/proj"
2 changes: 1 addition & 1 deletion .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Select the **Python Environments...** option:

<img width="600px" src="../media/devcontainer-python-environments-select.png" alt="initial options in select kernel menu">

Select the **data_viz_workshop** option:
Select the **data_viz_workshop** option (the Python version can vary):

<img width="600px" src="../media/devcontainer-conda-env-select.png" alt="selecting a virtual environment">

Expand Down
10 changes: 1 addition & 9 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"ms-toolsai.jupyter"
]
}
Expand All @@ -47,12 +46,5 @@
// "postCreateCommand": "",

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",

"features": {
"ghcr.io/devcontainers/features/python:1": {
"installJupyterlab": "true",
"configureJupyterlabAllowOrigin": "*"
}
}
"remoteUser": "vscode"
}
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ You can work through the notebooks locally or in your browser. Pick the installa

[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/stefmolin/python-data-viz-workshop)

The [GitHub Codespaces](https://github.com/features/codespaces) setup provides a pre-configured machine with Jupyter Notebooks running in [Visual Studio Code](https://code.visualstudio.com/) in your browser. You will need a GitHub account and available quota (all users get more than enough free monthly quota to be able to run this workshop). Note that this will take a while to build. It's recommended that you click the badge above to build the codespace in advance of the workshop and then [stop the codespace](https://docs.github.com/en/codespaces/developing-in-codespaces/stopping-and-starting-a-codespace) until the workshop, at which point you can simply resume and pick up where you left off.
The [GitHub Codespaces](https://github.com/features/codespaces) setup provides a pre-configured machine accessible via your browser. You will need a GitHub account and available quota (all users get more than enough free monthly quota to be able to run this workshop). Note that this will take a while to build. It's recommended that you click the badge above to build the codespace in advance of the workshop and then [stop the codespace](https://docs.github.com/en/codespaces/developing-in-codespaces/stopping-and-starting-a-codespace) until the workshop, at which point you can simply resume and pick up where you left off.
Note that if you want to save your changes, you will need to fork the repository before creating the codespace. You will then be able to commit your changes directly from the codespace. Be sure to create your codespace in advance of the session and resume when we start.
Expand All @@ -94,9 +94,13 @@ Note that if you want to save your changes, you will need to fork the repository
<img width="400px" src="./media/create_codespace.png" alt="location of create codespace button">
4. Stop the codespace until the session starts (click the name to resume).
4. Stop the codespace until the session starts by selecting **Stop codespace** from the **...** menu.
<img width="400px" src="./media/edit-codespace.png" alt="ways to modify an existing codespace">
<img width="400px" src="./media/stop-codespace.png" alt="stop codespace">
5. To resume the codespace, click **Open in ...** and then select your preferred method. If you aren't sure, select JupyterLab.

<img width="400px" src="./media/resume-codespace.png" alt="resuming a codespace">

#### Binder

Expand Down
Binary file removed media/edit-codespace.png
Binary file not shown.
Binary file added media/resume-codespace.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/stop-codespace.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions notebooks/check_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def run_env_check(raise_exc=False):
Whether to raise an `Exception` if any of the packages doesn't
match the requirements (used for GitHub Action).
"""

failures = []
_print_failure = partial(_print_version_failure, failures=failures)

Expand Down Expand Up @@ -153,8 +153,9 @@ def run_env_check(raise_exc=False):
_print_version_ok(pkg)
except ImportError:
if pkg == 'ffmpeg':
env_spec = '-n data_viz_workshop' if os.environ.get('CODESPACES') else ''
try:
pkg_info = json.loads(os.popen('conda list -f ffmpeg --json').read())[0]
pkg_info = json.loads(os.popen(' '.join(['conda list -f ffmpeg --json', env_spec])).read())[0]
if pkg_info:
if req_version:
if isinstance(req_version, list):
Expand Down

0 comments on commit a1536f9

Please sign in to comment.