From ec8a6ed12d556e8fb510257d62ccdb38f10da1ac Mon Sep 17 00:00:00 2001 From: Leonid Kostrykin Date: Tue, 28 Nov 2023 19:33:05 +0100 Subject: [PATCH 01/11] Add substitute for `%pylab` magic %pylab is deprecated, adds a substitute which omits the warning message. --- .gitignore | 1 + ingredients/Dockerfile | 3 +++ ingredients/substitute_pylab.ipy | 11 +++++++++++ 3 files changed, 15 insertions(+) create mode 100644 .gitignore create mode 100644 ingredients/substitute_pylab.ipy diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1377554 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.swp diff --git a/ingredients/Dockerfile b/ingredients/Dockerfile index b96f7fd..1607075 100644 --- a/ingredients/Dockerfile +++ b/ingredients/Dockerfile @@ -3,3 +3,6 @@ FROM mcr.microsoft.com/devcontainers/python:3.11-bullseye COPY requirements.txt /tmp/pip-tmp/ RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt RUN rm -rf /tmp/pip-tmp + +WORKDIR /home/vscode/.ipython/profile_default/startup +ADD substitute_pylab.ipy diff --git a/ingredients/substitute_pylab.ipy b/ingredients/substitute_pylab.ipy new file mode 100644 index 0000000..1cd7c39 --- /dev/null +++ b/ingredients/substitute_pylab.ipy @@ -0,0 +1,11 @@ +if __name__ == '__main__': + from IPython.core import magic + + @magic.register_line_magic + def pylab(*args): + import numpy as np + import matplotlib.pyplot as plt + globals().update(np.__dict__) + globals().update(plt.__dict__) + + del pylab From 22016bf0993e995cf401ad35f0f624ff00b16fc1 Mon Sep 17 00:00:00 2001 From: Leonid Kostrykin Date: Tue, 28 Nov 2023 19:35:37 +0100 Subject: [PATCH 02/11] Fix Dockerfile --- ingredients/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ingredients/Dockerfile b/ingredients/Dockerfile index 1607075..35a94bb 100644 --- a/ingredients/Dockerfile +++ b/ingredients/Dockerfile @@ -5,4 +5,4 @@ RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requ RUN rm -rf /tmp/pip-tmp WORKDIR /home/vscode/.ipython/profile_default/startup -ADD substitute_pylab.ipy +ADD . substitute_pylab.ipy From ff3c03a9251a5a98089b886100cbb08631a53bee Mon Sep 17 00:00:00 2001 From: Leonid Kostrykin Date: Tue, 28 Nov 2023 19:49:16 +0100 Subject: [PATCH 03/11] Fix Dockerfile --- ingredients/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ingredients/Dockerfile b/ingredients/Dockerfile index 35a94bb..d879025 100644 --- a/ingredients/Dockerfile +++ b/ingredients/Dockerfile @@ -5,4 +5,4 @@ RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requ RUN rm -rf /tmp/pip-tmp WORKDIR /home/vscode/.ipython/profile_default/startup -ADD . substitute_pylab.ipy +ADD substitute_pylab.ipy . From efb49e364d6669efda954cc45d43894b569c70d8 Mon Sep 17 00:00:00 2001 From: Leonid Kostrykin Date: Tue, 28 Nov 2023 19:59:53 +0100 Subject: [PATCH 04/11] Fix Dockerfile --- ingredients/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/ingredients/Dockerfile b/ingredients/Dockerfile index d879025..7904e34 100644 --- a/ingredients/Dockerfile +++ b/ingredients/Dockerfile @@ -6,3 +6,4 @@ RUN rm -rf /tmp/pip-tmp WORKDIR /home/vscode/.ipython/profile_default/startup ADD substitute_pylab.ipy . +RUN chown -R vscode:vscode /home/vscode/.ipython From c22e4658215d884a377fe9a9eb26a0ec037caf97 Mon Sep 17 00:00:00 2001 From: Leonid Kostrykin Date: Tue, 28 Nov 2023 20:06:19 +0100 Subject: [PATCH 05/11] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 61bb86c..96f11d8 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ This repository builds a Docker image for [Molecular Biotechnology Python Lesson - Python 3.9 and 3.11 (3.11 selected as default Jupyter kernel) - VS Code with `ms-toolsai.jupyter` extension - Packages specified in `ingredients/requirements.txt` installed for Python 3.11 +- Substitute for `%pylab` which imports `numpy` and `matplotlib.pyplot` into the global namespace and omits the deprection warning produced by the original `%pylab` instruction Dotfiles `**/.*` and Markdown files `**/*.md` are hidden in the VS Code file manager. Pylance is disabled. From 6fcd82b34902f2ec618bbad99ada8e3eef22c441 Mon Sep 17 00:00:00 2001 From: Leonid Kostrykin Date: Tue, 28 Nov 2023 21:47:18 +0100 Subject: [PATCH 06/11] Ignore all linting in VS Code --- ingredients/.devcontainer.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ingredients/.devcontainer.json b/ingredients/.devcontainer.json index e58201a..024e3e5 100644 --- a/ingredients/.devcontainer.json +++ b/ingredients/.devcontainer.json @@ -24,7 +24,10 @@ "**/*.md": true }, "python.linting.enabled": false, - "python.linting.pylintEnabled": false + "python.linting.pylintEnabled": false, + "python.analysis.ignore": [ + "*" + ] } } } From 8f804f36d15b6b1c82551f932f6d80db620f4e02 Mon Sep 17 00:00:00 2001 From: Leonid Kostrykin Date: Tue, 28 Nov 2023 22:25:04 +0100 Subject: [PATCH 07/11] Update .devcontainer.json --- ingredients/.devcontainer.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ingredients/.devcontainer.json b/ingredients/.devcontainer.json index 024e3e5..0b68d04 100644 --- a/ingredients/.devcontainer.json +++ b/ingredients/.devcontainer.json @@ -25,9 +25,8 @@ }, "python.linting.enabled": false, "python.linting.pylintEnabled": false, - "python.analysis.ignore": [ - "*" - ] + "python.analysis.ignore": ["*"], + "python.analysis.exclude": ["*"] } } } From 1bd365921439b7f9a9adae8cac833e9ad77e6b29 Mon Sep 17 00:00:00 2001 From: Leonid Kostrykin Date: Tue, 28 Nov 2023 23:02:22 +0100 Subject: [PATCH 08/11] Add `"python.languageServer": "None"` --- ingredients/.devcontainer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ingredients/.devcontainer.json b/ingredients/.devcontainer.json index 0b68d04..11008e8 100644 --- a/ingredients/.devcontainer.json +++ b/ingredients/.devcontainer.json @@ -26,7 +26,8 @@ "python.linting.enabled": false, "python.linting.pylintEnabled": false, "python.analysis.ignore": ["*"], - "python.analysis.exclude": ["*"] + "python.analysis.exclude": ["*"], + "python.languageServer": "None" } } } From 08abb75a17ab36a31fe6b25de84c9eb42b1ae13e Mon Sep 17 00:00:00 2001 From: Leonid Kostrykin Date: Tue, 28 Nov 2023 23:13:15 +0100 Subject: [PATCH 09/11] Test --- .devcontainer/devcontainer.json | 5 +++++ ingredients/.devcontainer.json | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index cebc69c..ef033d5 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,6 +3,11 @@ "customizations": { "codespaces": { "openFiles": [] + }, + "vscode": { + "settings": { + "python.languageServer": "None" + } } } } diff --git a/ingredients/.devcontainer.json b/ingredients/.devcontainer.json index 11008e8..1b029cc 100644 --- a/ingredients/.devcontainer.json +++ b/ingredients/.devcontainer.json @@ -23,10 +23,7 @@ "**/.*": true, "**/*.md": true }, - "python.linting.enabled": false, - "python.linting.pylintEnabled": false, - "python.analysis.ignore": ["*"], - "python.analysis.exclude": ["*"], + // Disable all help for linters etc. "python.languageServer": "None" } } From 2db916fd040689e3a86fcf928fae1d46ec8f14d9 Mon Sep 17 00:00:00 2001 From: Leonid Kostrykin Date: Tue, 28 Nov 2023 23:30:22 +0100 Subject: [PATCH 10/11] Test --- .devcontainer/devcontainer.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index ef033d5..cebc69c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,11 +3,6 @@ "customizations": { "codespaces": { "openFiles": [] - }, - "vscode": { - "settings": { - "python.languageServer": "None" - } } } } From ad300b6cb2a1e3f7d5d1b582e82afa002745c76d Mon Sep 17 00:00:00 2001 From: Leonid Kostrykin Date: Wed, 29 Nov 2023 07:06:03 +0100 Subject: [PATCH 11/11] Update image --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index cebc69c..58fc832 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,5 @@ { - "image": "docker.io/kostrykin/mobi-devcontainer-python:2023.1", + "image": "docker.io/kostrykin/mobi-devcontainer-python:test_pylab", "customizations": { "codespaces": { "openFiles": []