Skip to content

Commit 9b6385a

Browse files
authored
better jupyterlab integration
1 parent d66b26d commit 9b6385a

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

.devcontainer/devcontainer.json

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "Py 3.14.0 with JupyterLab 4.5.0",
2+
"name": "Py 3.14.0 with Jupyter, ruff and uv.",
33
"image": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu",
44
"features": {
55
"ghcr.io/devcontainers/features/git:1": {},
@@ -13,40 +13,50 @@
1313
"version": "3.14.0"
1414
},
1515
"ghcr.io/va-h/devcontainers-features/uv:1": {},
16+
"ghcr.io/devcontainers-extra/features/mypy:2": {},
1617
"ghcr.io/devcontainers-extra/features/ruff:1": {},
1718
"ghcr.io/warrenbuckley/codespace-features/sqlite:1": {}
1819
},
1920
"customizations": {
2021
"vscode": {
2122
"settings": {
2223
"terminal.integrated.defaultProfile.linux": "bash",
23-
"python.defaultInterpreterPath": "/workspaces/${localWorkspaceFolderBasename}/.venv/bin/python",
2424
"editor.formatOnSave": true,
25+
"python.pythonPath": "~/.pyenv/versions/3.14.0/bin/python",
2526
"python.linting.enabled": true,
2627
"python.linting.ruffEnabled": true,
28+
"editor.defaultFormatter": "ms-python.vscode-pylance",
2729
"[python]": {
2830
"editor.defaultFormatter": "charliermarsh.ruff",
2931
"editor.codeActionsOnSave": {
3032
"source.fixAll": "explicit"
31-
},
32-
"containerEnv": {
33-
"VIRTUAL_ENV": "/workspaces/${localWorkspaceFolderBasename}/.venv",
34-
"PATH": "/workspaces/${localWorkspaceFolderBasename}/.venv/bin:${PATH}"
3533
}
34+
}
3635
},
3736
"extensions": [
3837
"ms-python.python",
3938
"ms-python.debugpy",
4039
"ms-python.vscode-pylance",
4140
"charliermarsh.ruff",
41+
"matangover.mypy",
4242
"perras.UV",
43+
"ms-toolsai.jupyter",
4344
"eamodio.gitlens"
4445
]
45-
},
46-
"postAttachCommand": "if [ \"$CODESPACES\" = \"true\" ]; then echo 'In Codespaces: Running minimal setup'; else bash source .devcontainer/.bashrc; fi || true",
47-
"postCreateCommand": "export UV_LINK_MODE=copy && uv venv .venv --clear --python 3.14.0",
48-
"postStartCommand": "bash -c 'source /workspaces/${localWorkspaceFolderBasename}/.venv/bin/activate && nohup uv run main.py\" > /tmp/postStart.log 2>&1 &'",
46+
}
47+
},
48+
"onCreateCommand": "if [ \"$CODESPACES\" = \"true\" ]; then echo 'In Codespaces: Running minimal setup'; else bash .devcontainer/provisioning.sh; fi || true",
49+
"postCreateCommand": "export UV_LINK_MODE=copy && uv venv .venv --clear --python 3.14.0 && uv pip install --no-cache -U jupyterlab ipykernel",
50+
"postStartCommand": "nohup bash -c 'source .venv/bin/activate && jupyter lab --ip=0.0.0.0 --port=8888 --allow-root --no-browser --ServerApp.token=\"\" --ServerApp.password=\"\" > .jupyter.log 2>&1 &'",
51+
"forwardPorts": [8888],
52+
"portsAttributes": {
53+
"8888": {
54+
"label": "JupyterLab",
55+
"onAutoForward": "notify"
56+
}
57+
},
58+
"runArgs": ["--network=host"],
4959
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/${localWorkspaceFolderBasename},type=bind",
5060
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
5161
"remoteUser": "vscode"
52-
}}}
62+
}

0 commit comments

Comments
 (0)