A minimal working setup providing a devcontainer for vscode + python + jupyter notebooks.
- vscode
- Remote - Containers extension for vscode
- Docker + docker-compose
- Image: amalic/jupyterlab
- Found in this repository by @amalic
- Install vscode and the Remote - Containers extension
- Click on the small green button >< on the bottom left of vscode OR (ctrl+p)
- Type and choose
>Remote-Containers: Reopen in Container
Changing the current working directory (cwd) enables you to utilize relative imports in your jupyter notebook.
Example (included in repo):
- Local Module (src/util.py)
- Notebook (src/example.ipynb)
# This needs to be ran to make relative imports work
import os
os.chdir("/workspaces")
os.getcwd()
MIT