From ac5b865711de4136146203f86dc662386e9ae970 Mon Sep 17 00:00:00 2001 From: "Dan Taylor (VS)" Date: Mon, 15 Apr 2019 23:56:26 -0700 Subject: [PATCH 01/13] Move django project to generic python3+postgres project --- .../.devcontainer/devcontainer.json | 10 --------- .../.devcontainer/requirements.txt | 2 -- .../python-3-django/.vscode/settings.json | 3 --- .../python-3-django/test-project/db.sqlite3 | 0 .../.devcontainer/Dockerfile | 10 ++++----- .../.devcontainer/devcontainer.json | 10 +++++++++ .../.devcontainer/docker-compose.yml | 19 +++++++++++++++++ .../.devcontainer/settings.vscode.json | 1 - .../.npmignore | 1 + .../.vscode/launch.json | 2 +- .../python-3-postgres/.vscode/settings.json | 3 +++ .../README.md | 21 ++++++++++++++++--- containers/python-3-postgres/requirements.txt | 2 ++ .../test-project/manage.py | 0 .../test-project/requirements.txt | 0 .../test-project/web_project/__init__.py | 0 .../test-project/web_project/settings.py | 9 +++++--- .../test-project/web_project/urls.py | 0 .../test-project/web_project/wsgi.py | 0 19 files changed, 65 insertions(+), 28 deletions(-) delete mode 100644 containers/python-3-django/.devcontainer/devcontainer.json delete mode 100644 containers/python-3-django/.devcontainer/requirements.txt delete mode 100644 containers/python-3-django/.vscode/settings.json delete mode 100644 containers/python-3-django/test-project/db.sqlite3 rename containers/{python-3-django => python-3-postgres}/.devcontainer/Dockerfile (71%) create mode 100644 containers/python-3-postgres/.devcontainer/devcontainer.json create mode 100644 containers/python-3-postgres/.devcontainer/docker-compose.yml rename containers/{python-3-django => python-3-postgres}/.devcontainer/settings.vscode.json (55%) rename containers/{python-3-django => python-3-postgres}/.npmignore (71%) rename containers/{python-3-django => python-3-postgres}/.vscode/launch.json (95%) create mode 100644 containers/python-3-postgres/.vscode/settings.json rename containers/{python-3-django => python-3-postgres}/README.md (53%) create mode 100644 containers/python-3-postgres/requirements.txt rename containers/{python-3-django => python-3-postgres}/test-project/manage.py (100%) rename containers/{python-3-django => python-3-postgres}/test-project/requirements.txt (100%) rename containers/{python-3-django => python-3-postgres}/test-project/web_project/__init__.py (100%) rename containers/{python-3-django => python-3-postgres}/test-project/web_project/settings.py (93%) rename containers/{python-3-django => python-3-postgres}/test-project/web_project/urls.py (100%) rename containers/{python-3-django => python-3-postgres}/test-project/web_project/wsgi.py (100%) diff --git a/containers/python-3-django/.devcontainer/devcontainer.json b/containers/python-3-django/.devcontainer/devcontainer.json deleted file mode 100644 index 04395ab449..0000000000 --- a/containers/python-3-django/.devcontainer/devcontainer.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "Python 3 & Django", - "dockerFile": "Dockerfile", - "appPort": 8080, - "extensions": [ - "ms-python.python", - "batisteo.vscode-django", - "LittleFoxTeam.vscode-python-test-adapter" - ] -} diff --git a/containers/python-3-django/.devcontainer/requirements.txt b/containers/python-3-django/.devcontainer/requirements.txt deleted file mode 100644 index 2799568f85..0000000000 --- a/containers/python-3-django/.devcontainer/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -pylint -Django \ No newline at end of file diff --git a/containers/python-3-django/.vscode/settings.json b/containers/python-3-django/.vscode/settings.json deleted file mode 100644 index 500bc70073..0000000000 --- a/containers/python-3-django/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "python.linting.pylintEnabled": true -} \ No newline at end of file diff --git a/containers/python-3-django/test-project/db.sqlite3 b/containers/python-3-django/test-project/db.sqlite3 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/containers/python-3-django/.devcontainer/Dockerfile b/containers/python-3-postgres/.devcontainer/Dockerfile similarity index 71% rename from containers/python-3-django/.devcontainer/Dockerfile rename to containers/python-3-postgres/.devcontainer/Dockerfile index 25a3f812b0..510ccd60a1 100644 --- a/containers/python-3-django/.devcontainer/Dockerfile +++ b/containers/python-3-postgres/.devcontainer/Dockerfile @@ -6,23 +6,23 @@ FROM python:3-slim # Copy default endpoint specific user settings overrides into container to specify Python path -COPY settings.vscode.json /root/.vscode-remote/data/Machine/settings.json +COPY .devcontainer/settings.vscode.json /root/.vscode-remote/data/Machine/settings.json ENV PYTHONUNBUFFERED 1 RUN mkdir /workspace WORKDIR /workspace -# Install pylint and Django -COPY requirements.txt /workspace/ -RUN pip install -r requirements.txt && rm -f requirements.txt - # Install git, process tools RUN apt-get update && apt-get -y install git procps # Install any missing dependencies for enhanced language service RUN apt-get install -y libicu[0-9][0-9] +# Install Python dependencies from requirements.txt if it exists +COPY .devcontainer/requirements.txt.tmp requirements.txt* /workspace/ +RUN if [ -f "requirements.txt" ]; then pip install -r requirements.txt && rm requirements.txt; fi + # Clean up RUN apt-get autoremove -y \ && apt-get clean -y \ diff --git a/containers/python-3-postgres/.devcontainer/devcontainer.json b/containers/python-3-postgres/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..205ce60a6f --- /dev/null +++ b/containers/python-3-postgres/.devcontainer/devcontainer.json @@ -0,0 +1,10 @@ +{ + "name": "Python3 + PostgreSQL", + "dockerComposeFile": "docker-compose.yml", + "service": "app", + "workspaceFolder": "/workspace", + "extensions": [ + "ms-python.python", + "VisualStudioExptTeam.vscodeintellicode" + ] +} \ No newline at end of file diff --git a/containers/python-3-postgres/.devcontainer/docker-compose.yml b/containers/python-3-postgres/.devcontainer/docker-compose.yml new file mode 100644 index 0000000000..b218641c50 --- /dev/null +++ b/containers/python-3-postgres/.devcontainer/docker-compose.yml @@ -0,0 +1,19 @@ +version: '3' + +services: + app: + build: + context: .. + dockerfile: .devcontainer/Dockerfile + ports: + - 5000:5000 + volumes: + - ..:/workspace + command: sleep infinity + db: + image: postgres + restart: always + ports: + - 5432:5432 + environment: + POSTGRES_PASSWORD: LocalPassword \ No newline at end of file diff --git a/containers/python-3-django/.devcontainer/settings.vscode.json b/containers/python-3-postgres/.devcontainer/settings.vscode.json similarity index 55% rename from containers/python-3-django/.devcontainer/settings.vscode.json rename to containers/python-3-postgres/.devcontainer/settings.vscode.json index 80a4895ace..8ad19d5bb5 100644 --- a/containers/python-3-django/.devcontainer/settings.vscode.json +++ b/containers/python-3-postgres/.devcontainer/settings.vscode.json @@ -1,4 +1,3 @@ { - "python.linting.pylintEnabled": true, "python.pythonPath": "/usr/local/bin/python" } \ No newline at end of file diff --git a/containers/python-3-django/.npmignore b/containers/python-3-postgres/.npmignore similarity index 71% rename from containers/python-3-django/.npmignore rename to containers/python-3-postgres/.npmignore index 1d72d293eb..b74d759b87 100644 --- a/containers/python-3-django/.npmignore +++ b/containers/python-3-postgres/.npmignore @@ -2,3 +2,4 @@ README.md test-project .vscode .npmignore +requirements.txt diff --git a/containers/python-3-django/.vscode/launch.json b/containers/python-3-postgres/.vscode/launch.json similarity index 95% rename from containers/python-3-django/.vscode/launch.json rename to containers/python-3-postgres/.vscode/launch.json index 84e34f89b3..5388c043ab 100644 --- a/containers/python-3-django/.vscode/launch.json +++ b/containers/python-3-postgres/.vscode/launch.json @@ -12,7 +12,7 @@ "console": "integratedTerminal", "args": [ "runserver", - "0.0.0.0:8080", + "0.0.0.0:5000", "--noreload", "--nothreading" ], diff --git a/containers/python-3-postgres/.vscode/settings.json b/containers/python-3-postgres/.vscode/settings.json new file mode 100644 index 0000000000..8ad19d5bb5 --- /dev/null +++ b/containers/python-3-postgres/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "/usr/local/bin/python" +} \ No newline at end of file diff --git a/containers/python-3-django/README.md b/containers/python-3-postgres/README.md similarity index 53% rename from containers/python-3-django/README.md rename to containers/python-3-postgres/README.md index bb3ec2a8c8..2523312a13 100644 --- a/containers/python-3-django/README.md +++ b/containers/python-3-postgres/README.md @@ -1,8 +1,9 @@ -# Python 3 & Django +# Python 3 & PostgreSQL ## Summary -*A basic dev container definition for building Django-based applications container. Includes everything you need to get up and running like Django, PyLint and the Python extension.* +*A basic dev container definition for building Python + PostgreSQL applications in containers. +Includes a Python application container and PostgreSQL server, and a Django test project.* | Metadata | Value | |----------|-------| @@ -16,7 +17,21 @@ If you prefer, you can also just look through the contents of the `.devcontainer` folder to understand how to make changes to your own project. -If you want to try out the test project instead, run **Remote-Container: Open Folder in Container...** in VS Code and select a cloned copy of the entire folder. You can then start the test program from Debug panel in VS Code. +If you want to try out the test project instead, run **Remote-Container: Open Folder in Container...** in VS Code and select a cloned copy of the entire folder. + +Initialize the database and super user by opening the terminal and running: +``` +cd test-project +python manage.py migrate +python manage.py createsuperuser +``` + +You can then start the test program from Debug panel in VS Code, or by running: +``` +python manage.py runserver 0.0.0.0:5000 +``` + +Then browse to [http://localhost:5000/admin](http://localhost:5000/admin) and login! ## License diff --git a/containers/python-3-postgres/requirements.txt b/containers/python-3-postgres/requirements.txt new file mode 100644 index 0000000000..b085736ab1 --- /dev/null +++ b/containers/python-3-postgres/requirements.txt @@ -0,0 +1,2 @@ +Django +psycopg2-binary \ No newline at end of file diff --git a/containers/python-3-django/test-project/manage.py b/containers/python-3-postgres/test-project/manage.py similarity index 100% rename from containers/python-3-django/test-project/manage.py rename to containers/python-3-postgres/test-project/manage.py diff --git a/containers/python-3-django/test-project/requirements.txt b/containers/python-3-postgres/test-project/requirements.txt similarity index 100% rename from containers/python-3-django/test-project/requirements.txt rename to containers/python-3-postgres/test-project/requirements.txt diff --git a/containers/python-3-django/test-project/web_project/__init__.py b/containers/python-3-postgres/test-project/web_project/__init__.py similarity index 100% rename from containers/python-3-django/test-project/web_project/__init__.py rename to containers/python-3-postgres/test-project/web_project/__init__.py diff --git a/containers/python-3-django/test-project/web_project/settings.py b/containers/python-3-postgres/test-project/web_project/settings.py similarity index 93% rename from containers/python-3-django/test-project/web_project/settings.py rename to containers/python-3-postgres/test-project/web_project/settings.py index 7a046993e8..5986fd3175 100644 --- a/containers/python-3-django/test-project/web_project/settings.py +++ b/containers/python-3-postgres/test-project/web_project/settings.py @@ -61,12 +61,15 @@ DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + 'ENGINE': 'django.db.backends.postgresql', + 'NAME': 'postgres', + 'USER': 'postgres', + 'PASSWORD': 'LocalPassword', + 'HOST': 'db', + 'PORT': '' } } - # Password validation # https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators diff --git a/containers/python-3-django/test-project/web_project/urls.py b/containers/python-3-postgres/test-project/web_project/urls.py similarity index 100% rename from containers/python-3-django/test-project/web_project/urls.py rename to containers/python-3-postgres/test-project/web_project/urls.py diff --git a/containers/python-3-django/test-project/web_project/wsgi.py b/containers/python-3-postgres/test-project/web_project/wsgi.py similarity index 100% rename from containers/python-3-django/test-project/web_project/wsgi.py rename to containers/python-3-postgres/test-project/web_project/wsgi.py From 29d325b73d71f8374d7abb03a9be9a65d0e3534a Mon Sep 17 00:00:00 2001 From: "Dan Taylor (VS)" Date: Tue, 16 Apr 2019 00:33:24 -0700 Subject: [PATCH 02/13] Update python 3 image: install requirements.txt if exists --- containers/python-3/.devcontainer/Dockerfile | 12 +++++++++--- containers/python-3/.devcontainer/devcontainer.json | 8 +++++--- containers/python-3/.devcontainer/docker-compose.yml | 12 ++++++++++++ .../python-3/.devcontainer/requirements.txt.temp | 0 containers/python-3/README.md | 2 +- 5 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 containers/python-3/.devcontainer/docker-compose.yml create mode 100644 containers/python-3/.devcontainer/requirements.txt.temp diff --git a/containers/python-3/.devcontainer/Dockerfile b/containers/python-3/.devcontainer/Dockerfile index 005fb4e7e6..91721e8304 100644 --- a/containers/python-3/.devcontainer/Dockerfile +++ b/containers/python-3/.devcontainer/Dockerfile @@ -6,9 +6,7 @@ FROM python:3 # Copy default endpoint specific user settings overrides into container to specify Python path -COPY settings.vscode.json /root/.vscode-remote/data/Machine/settings.json - -RUN pip install pylint +COPY .devcontainer/settings.vscode.json /root/.vscode-remote/data/Machine/settings.json # Install git, process tools RUN apt-get update && apt-get -y install git procps @@ -16,7 +14,15 @@ RUN apt-get update && apt-get -y install git procps # Install any missing dependencies for enhanced language service RUN apt-get install -y libicu[0-9][0-9] +# Install Python dependencies from requirements.txt if it exists +COPY .devcontainer/requirements.txt.temp requirements.txt* /workspace/ +RUN if [ -f "requirements.txt" ]; then pip install -r requirements.txt && rm requirements.txt; fi + +# Expose port 5000 as the default web port +EXPOSE 5000 + # Clean up RUN apt-get autoremove -y \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* + diff --git a/containers/python-3/.devcontainer/devcontainer.json b/containers/python-3/.devcontainer/devcontainer.json index ce4fb4bfcd..79dec45c42 100644 --- a/containers/python-3/.devcontainer/devcontainer.json +++ b/containers/python-3/.devcontainer/devcontainer.json @@ -1,8 +1,10 @@ { "name": "Python 3", - "dockerFile": "Dockerfile", + "dockerComposeFile": "docker-compose.yml", + "service": "app", + "workspaceFolder": "/workspace", "extensions": [ "ms-python.python", - "LittleFoxTeam.vscode-python-test-adapter" + "VisualStudioExptTeam.vscodeintellicode" ] -} +} \ No newline at end of file diff --git a/containers/python-3/.devcontainer/docker-compose.yml b/containers/python-3/.devcontainer/docker-compose.yml new file mode 100644 index 0000000000..9216ed013b --- /dev/null +++ b/containers/python-3/.devcontainer/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3' + +services: + app: + build: + context: .. + dockerfile: .devcontainer/Dockerfile + ports: + - 5000:5000 + volumes: + - ..:/workspace + command: sleep infinity diff --git a/containers/python-3/.devcontainer/requirements.txt.temp b/containers/python-3/.devcontainer/requirements.txt.temp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/containers/python-3/README.md b/containers/python-3/README.md index 79ac220a31..9687d67afd 100644 --- a/containers/python-3/README.md +++ b/containers/python-3/README.md @@ -2,7 +2,7 @@ ## Summary -*A basic dev container definition for developing Python 3 applications in a container. Includes everything you need to get up and running like PyLint and the Python extension.* +*A basic dev container definition for developing Python 3 applications in a container. Installs dependencies from your requirements.txt file and the Python extension.* | Metadata | Value | |----------|-------| From ad9a4d5522bde53f53198a1cb45653e1defe6a41 Mon Sep 17 00:00:00 2001 From: "Dan Taylor (VS)" Date: Tue, 16 Apr 2019 00:33:46 -0700 Subject: [PATCH 03/13] Fixes to python3+postgres image --- containers/python-3-postgres/.devcontainer/Dockerfile | 4 ++-- .../python-3-postgres/.devcontainer/requirements.txt.temp | 0 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 containers/python-3-postgres/.devcontainer/requirements.txt.temp diff --git a/containers/python-3-postgres/.devcontainer/Dockerfile b/containers/python-3-postgres/.devcontainer/Dockerfile index 510ccd60a1..feb38c1bf0 100644 --- a/containers/python-3-postgres/.devcontainer/Dockerfile +++ b/containers/python-3-postgres/.devcontainer/Dockerfile @@ -3,7 +3,7 @@ # Licensed under the MIT License. See LICENSE in the project root for license information. #----------------------------------------------------------------------------------------- -FROM python:3-slim +FROM python:3 # Copy default endpoint specific user settings overrides into container to specify Python path COPY .devcontainer/settings.vscode.json /root/.vscode-remote/data/Machine/settings.json @@ -20,7 +20,7 @@ RUN apt-get update && apt-get -y install git procps RUN apt-get install -y libicu[0-9][0-9] # Install Python dependencies from requirements.txt if it exists -COPY .devcontainer/requirements.txt.tmp requirements.txt* /workspace/ +COPY .devcontainer/requirements.txt.temp requirements.txt* /workspace/ RUN if [ -f "requirements.txt" ]; then pip install -r requirements.txt && rm requirements.txt; fi # Clean up diff --git a/containers/python-3-postgres/.devcontainer/requirements.txt.temp b/containers/python-3-postgres/.devcontainer/requirements.txt.temp new file mode 100644 index 0000000000..e69de29bb2 From 3f0fedb2cbe3d117cefc07cc0973d2b7a231e37b Mon Sep 17 00:00:00 2001 From: "Dan Taylor (VS)" Date: Tue, 16 Apr 2019 00:51:20 -0700 Subject: [PATCH 04/13] add anaconda container --- .../.devcontainer/Dockerfile | 28 +++++++++++++++++++ .../.devcontainer/devcontainer.json | 10 +++++++ .../.devcontainer/docker-compose.yml | 12 ++++++++ .../.devcontainer/environment.yml.temp | 0 .../.devcontainer/settings.vscode.json | 3 ++ containers/python-3-anaconda/.npmignore | 4 +++ .../python-3-anaconda/.vscode/launch.json | 15 ++++++++++ .../python-3-anaconda/.vscode/settings.json | 3 ++ containers/python-3-anaconda/README.md | 27 ++++++++++++++++++ 9 files changed, 102 insertions(+) create mode 100644 containers/python-3-anaconda/.devcontainer/Dockerfile create mode 100644 containers/python-3-anaconda/.devcontainer/devcontainer.json create mode 100644 containers/python-3-anaconda/.devcontainer/docker-compose.yml create mode 100644 containers/python-3-anaconda/.devcontainer/environment.yml.temp create mode 100644 containers/python-3-anaconda/.devcontainer/settings.vscode.json create mode 100644 containers/python-3-anaconda/.npmignore create mode 100644 containers/python-3-anaconda/.vscode/launch.json create mode 100644 containers/python-3-anaconda/.vscode/settings.json create mode 100644 containers/python-3-anaconda/README.md diff --git a/containers/python-3-anaconda/.devcontainer/Dockerfile b/containers/python-3-anaconda/.devcontainer/Dockerfile new file mode 100644 index 0000000000..7c26443580 --- /dev/null +++ b/containers/python-3-anaconda/.devcontainer/Dockerfile @@ -0,0 +1,28 @@ +#----------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See LICENSE in the project root for license information. +#----------------------------------------------------------------------------------------- + +FROM continuumio/anaconda3 + +# Copy default endpoint specific user settings overrides into container to specify Python path +COPY .devcontainer/settings.vscode.json /root/.vscode-remote/data/Machine/settings.json + +# Install git, process tools +RUN apt-get update && apt-get -y install git procps + +# Install any missing dependencies for enhanced language service +RUN apt-get install -y libicu[0-9][0-9] + +# Install Python dependencies from requirements.txt if it exists +COPY .devcontainer/environment.yml.temp environment.yml* /workspace/ +RUN if [ -f "environment.yml" ]; then conda install environment.yml && rm environment.yml*; fi + +# Expose port 5000 as the default web port +EXPOSE 5000 + +# Clean up +RUN apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* + diff --git a/containers/python-3-anaconda/.devcontainer/devcontainer.json b/containers/python-3-anaconda/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..eb62c26830 --- /dev/null +++ b/containers/python-3-anaconda/.devcontainer/devcontainer.json @@ -0,0 +1,10 @@ +{ + "name": "Anaconda 3", + "dockerComposeFile": "docker-compose.yml", + "service": "app", + "workspaceFolder": "/workspace", + "extensions": [ + "ms-python.python", + "VisualStudioExptTeam.vscodeintellicode" + ] +} \ No newline at end of file diff --git a/containers/python-3-anaconda/.devcontainer/docker-compose.yml b/containers/python-3-anaconda/.devcontainer/docker-compose.yml new file mode 100644 index 0000000000..9216ed013b --- /dev/null +++ b/containers/python-3-anaconda/.devcontainer/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3' + +services: + app: + build: + context: .. + dockerfile: .devcontainer/Dockerfile + ports: + - 5000:5000 + volumes: + - ..:/workspace + command: sleep infinity diff --git a/containers/python-3-anaconda/.devcontainer/environment.yml.temp b/containers/python-3-anaconda/.devcontainer/environment.yml.temp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/containers/python-3-anaconda/.devcontainer/settings.vscode.json b/containers/python-3-anaconda/.devcontainer/settings.vscode.json new file mode 100644 index 0000000000..1b3cd28238 --- /dev/null +++ b/containers/python-3-anaconda/.devcontainer/settings.vscode.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "/opt/conda/bin/python" +} \ No newline at end of file diff --git a/containers/python-3-anaconda/.npmignore b/containers/python-3-anaconda/.npmignore new file mode 100644 index 0000000000..1d72d293eb --- /dev/null +++ b/containers/python-3-anaconda/.npmignore @@ -0,0 +1,4 @@ +README.md +test-project +.vscode +.npmignore diff --git a/containers/python-3-anaconda/.vscode/launch.json b/containers/python-3-anaconda/.vscode/launch.json new file mode 100644 index 0000000000..1298fb1ca1 --- /dev/null +++ b/containers/python-3-anaconda/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Current File (Integrated Terminal)", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal" + } + ] +} \ No newline at end of file diff --git a/containers/python-3-anaconda/.vscode/settings.json b/containers/python-3-anaconda/.vscode/settings.json new file mode 100644 index 0000000000..1b3cd28238 --- /dev/null +++ b/containers/python-3-anaconda/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "/opt/conda/bin/python" +} \ No newline at end of file diff --git a/containers/python-3-anaconda/README.md b/containers/python-3-anaconda/README.md new file mode 100644 index 0000000000..d3f706a76a --- /dev/null +++ b/containers/python-3-anaconda/README.md @@ -0,0 +1,27 @@ +# Python 3 + +## Summary + +*A basic dev container definition for developing Python 3 applications in an Anaconda container. Installs dependencies from your environment.yml file and the Python extension.* + +| Metadata | Value | +|----------|-------| +| *Contributors* | The VS Code Team | +| *Definition type* | Dockerfile | +| *Languages, platforms* | Python | + +## Usage + +[See here for information on using this definition with an existing project](../../README.md#using-a-definition). + +If you prefer, you can also just look through the contents of the `.devcontainer` folder to understand how to make changes to your own project. + +If you want to try out the test project instead, run **Remote-Container: Open Folder in Container...** in VS Code and select a cloned copy of the entire folder. + +Then, open test-project/hello.py and press shift-enter to run the cell and see the interactive matplotlib output. + +## License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Licensed under the MIT License. See [LICENSE](../../LICENSE). From 22cfcd6f27bd301261a51985311507b6e62c596b Mon Sep 17 00:00:00 2001 From: "Dan Taylor (VS)" Date: Tue, 16 Apr 2019 00:51:39 -0700 Subject: [PATCH 05/13] Update hello.py in anaconda container --- .../python-3-anaconda/test-project/hello.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 containers/python-3-anaconda/test-project/hello.py diff --git a/containers/python-3-anaconda/test-project/hello.py b/containers/python-3-anaconda/test-project/hello.py new file mode 100644 index 0000000000..97af5dc28e --- /dev/null +++ b/containers/python-3-anaconda/test-project/hello.py @@ -0,0 +1,18 @@ +#%% +import matplotlib +import matplotlib.pyplot as plt +import numpy as np + +# Data for plotting +t = np.arange(0.0, 2.0, 0.01) +s = 1 + np.sin(2 * np.pi * t) + +fig, ax = plt.subplots() +ax.plot(t, s) + +ax.set(xlabel='time (s)', ylabel='voltage (mV)', + title='About as simple as it gets, folks') +ax.grid() + +fig.savefig("test.png") +plt.show() \ No newline at end of file From 92a4e63cac164d1f900ebf94d901abb94f75c7d3 Mon Sep 17 00:00:00 2001 From: "Dan Taylor (VS)" Date: Tue, 16 Apr 2019 01:25:09 -0700 Subject: [PATCH 06/13] Fix requirements.txt install in python3 devcontainer --- containers/python-3/.devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers/python-3/.devcontainer/Dockerfile b/containers/python-3/.devcontainer/Dockerfile index 91721e8304..7806a85dc5 100644 --- a/containers/python-3/.devcontainer/Dockerfile +++ b/containers/python-3/.devcontainer/Dockerfile @@ -16,7 +16,7 @@ RUN apt-get install -y libicu[0-9][0-9] # Install Python dependencies from requirements.txt if it exists COPY .devcontainer/requirements.txt.temp requirements.txt* /workspace/ -RUN if [ -f "requirements.txt" ]; then pip install -r requirements.txt && rm requirements.txt; fi +RUN if [ -f "requirements.txt" ]; then pip install -r requirements.txt && rm requirements.txt*; fi # Expose port 5000 as the default web port EXPOSE 5000 From fd61bd5e8b70f05a8c296b9c71311eca0df80a6a Mon Sep 17 00:00:00 2001 From: "Dan Taylor (VS)" Date: Tue, 16 Apr 2019 01:25:40 -0700 Subject: [PATCH 07/13] Fix requirements.txt install in python3 devcontainer --- containers/python-3/.devcontainer/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/containers/python-3/.devcontainer/Dockerfile b/containers/python-3/.devcontainer/Dockerfile index 7806a85dc5..25271135bf 100644 --- a/containers/python-3/.devcontainer/Dockerfile +++ b/containers/python-3/.devcontainer/Dockerfile @@ -14,6 +14,9 @@ RUN apt-get update && apt-get -y install git procps # Install any missing dependencies for enhanced language service RUN apt-get install -y libicu[0-9][0-9] +RUN mkdir /workspace +WORKDIR /workspace + # Install Python dependencies from requirements.txt if it exists COPY .devcontainer/requirements.txt.temp requirements.txt* /workspace/ RUN if [ -f "requirements.txt" ]; then pip install -r requirements.txt && rm requirements.txt*; fi From f9cfd5b8cca633d02ec0ca24cc9181d63ac9ebc9 Mon Sep 17 00:00:00 2001 From: "Dan Taylor (VS)" Date: Tue, 16 Apr 2019 01:26:40 -0700 Subject: [PATCH 08/13] Fix environment.yml install in anaconda container --- containers/python-3-anaconda/.devcontainer/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/containers/python-3-anaconda/.devcontainer/Dockerfile b/containers/python-3-anaconda/.devcontainer/Dockerfile index 7c26443580..cc93ab030b 100644 --- a/containers/python-3-anaconda/.devcontainer/Dockerfile +++ b/containers/python-3-anaconda/.devcontainer/Dockerfile @@ -14,9 +14,12 @@ RUN apt-get update && apt-get -y install git procps # Install any missing dependencies for enhanced language service RUN apt-get install -y libicu[0-9][0-9] +RUN mkdir /workspace +WORKDIR /workspace + # Install Python dependencies from requirements.txt if it exists COPY .devcontainer/environment.yml.temp environment.yml* /workspace/ -RUN if [ -f "environment.yml" ]; then conda install environment.yml && rm environment.yml*; fi +RUN if [ -f "environment.yml" ]; then conda env update base -f environment.yml && rm environment.yml*; fi # Expose port 5000 as the default web port EXPOSE 5000 From bf3cf074e1ad06f952a6e1ea08747208e4dc31c2 Mon Sep 17 00:00:00 2001 From: "Dan Taylor (VS)" Date: Tue, 16 Apr 2019 01:31:39 -0700 Subject: [PATCH 09/13] Adding miniconda dev container --- .../.devcontainer/Dockerfile | 31 +++++++++++++++++++ .../.devcontainer/devcontainer.json | 10 ++++++ .../.devcontainer/docker-compose.yml | 12 +++++++ .../.devcontainer/environment.yml.temp | 0 .../.devcontainer/settings.vscode.json | 3 ++ containers/python-3-miniconda/.npmignore | 5 +++ .../python-3-miniconda/.vscode/launch.json | 15 +++++++++ .../python-3-miniconda/.vscode/settings.json | 3 ++ containers/python-3-miniconda/README.md | 27 ++++++++++++++++ containers/python-3-miniconda/environment.yml | 3 ++ .../python-3-miniconda/test-project/hello.py | 18 +++++++++++ 11 files changed, 127 insertions(+) create mode 100644 containers/python-3-miniconda/.devcontainer/Dockerfile create mode 100644 containers/python-3-miniconda/.devcontainer/devcontainer.json create mode 100644 containers/python-3-miniconda/.devcontainer/docker-compose.yml create mode 100644 containers/python-3-miniconda/.devcontainer/environment.yml.temp create mode 100644 containers/python-3-miniconda/.devcontainer/settings.vscode.json create mode 100644 containers/python-3-miniconda/.npmignore create mode 100644 containers/python-3-miniconda/.vscode/launch.json create mode 100644 containers/python-3-miniconda/.vscode/settings.json create mode 100644 containers/python-3-miniconda/README.md create mode 100644 containers/python-3-miniconda/environment.yml create mode 100644 containers/python-3-miniconda/test-project/hello.py diff --git a/containers/python-3-miniconda/.devcontainer/Dockerfile b/containers/python-3-miniconda/.devcontainer/Dockerfile new file mode 100644 index 0000000000..4d2302c34c --- /dev/null +++ b/containers/python-3-miniconda/.devcontainer/Dockerfile @@ -0,0 +1,31 @@ +#----------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See LICENSE in the project root for license information. +#----------------------------------------------------------------------------------------- + +FROM continuumio/miniconda3 + +# Copy default endpoint specific user settings overrides into container to specify Python path +COPY .devcontainer/settings.vscode.json /root/.vscode-remote/data/Machine/settings.json + +# Install git, process tools +RUN apt-get update && apt-get -y install git procps + +# Install any missing dependencies for enhanced language service +RUN apt-get install -y libicu[0-9][0-9] + +RUN mkdir /workspace +WORKDIR /workspace + +# Install Python dependencies from requirements.txt if it exists +COPY .devcontainer/environment.yml.temp environment.yml* /workspace/ +RUN if [ -f "environment.yml" ]; then conda env update base -f environment.yml && rm environment.yml*; fi + +# Expose port 5000 as the default web port +EXPOSE 5000 + +# Clean up +RUN apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* + diff --git a/containers/python-3-miniconda/.devcontainer/devcontainer.json b/containers/python-3-miniconda/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..8539debd33 --- /dev/null +++ b/containers/python-3-miniconda/.devcontainer/devcontainer.json @@ -0,0 +1,10 @@ +{ + "name": "Miniconda 3", + "dockerComposeFile": "docker-compose.yml", + "service": "app", + "workspaceFolder": "/workspace", + "extensions": [ + "ms-python.python", + "VisualStudioExptTeam.vscodeintellicode" + ] +} \ No newline at end of file diff --git a/containers/python-3-miniconda/.devcontainer/docker-compose.yml b/containers/python-3-miniconda/.devcontainer/docker-compose.yml new file mode 100644 index 0000000000..9216ed013b --- /dev/null +++ b/containers/python-3-miniconda/.devcontainer/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3' + +services: + app: + build: + context: .. + dockerfile: .devcontainer/Dockerfile + ports: + - 5000:5000 + volumes: + - ..:/workspace + command: sleep infinity diff --git a/containers/python-3-miniconda/.devcontainer/environment.yml.temp b/containers/python-3-miniconda/.devcontainer/environment.yml.temp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/containers/python-3-miniconda/.devcontainer/settings.vscode.json b/containers/python-3-miniconda/.devcontainer/settings.vscode.json new file mode 100644 index 0000000000..1b3cd28238 --- /dev/null +++ b/containers/python-3-miniconda/.devcontainer/settings.vscode.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "/opt/conda/bin/python" +} \ No newline at end of file diff --git a/containers/python-3-miniconda/.npmignore b/containers/python-3-miniconda/.npmignore new file mode 100644 index 0000000000..8a2e37fb02 --- /dev/null +++ b/containers/python-3-miniconda/.npmignore @@ -0,0 +1,5 @@ +README.md +test-project +.vscode +.npmignore +environment.yml diff --git a/containers/python-3-miniconda/.vscode/launch.json b/containers/python-3-miniconda/.vscode/launch.json new file mode 100644 index 0000000000..1298fb1ca1 --- /dev/null +++ b/containers/python-3-miniconda/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Current File (Integrated Terminal)", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal" + } + ] +} \ No newline at end of file diff --git a/containers/python-3-miniconda/.vscode/settings.json b/containers/python-3-miniconda/.vscode/settings.json new file mode 100644 index 0000000000..1b3cd28238 --- /dev/null +++ b/containers/python-3-miniconda/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "/opt/conda/bin/python" +} \ No newline at end of file diff --git a/containers/python-3-miniconda/README.md b/containers/python-3-miniconda/README.md new file mode 100644 index 0000000000..d3f706a76a --- /dev/null +++ b/containers/python-3-miniconda/README.md @@ -0,0 +1,27 @@ +# Python 3 + +## Summary + +*A basic dev container definition for developing Python 3 applications in an Anaconda container. Installs dependencies from your environment.yml file and the Python extension.* + +| Metadata | Value | +|----------|-------| +| *Contributors* | The VS Code Team | +| *Definition type* | Dockerfile | +| *Languages, platforms* | Python | + +## Usage + +[See here for information on using this definition with an existing project](../../README.md#using-a-definition). + +If you prefer, you can also just look through the contents of the `.devcontainer` folder to understand how to make changes to your own project. + +If you want to try out the test project instead, run **Remote-Container: Open Folder in Container...** in VS Code and select a cloned copy of the entire folder. + +Then, open test-project/hello.py and press shift-enter to run the cell and see the interactive matplotlib output. + +## License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Licensed under the MIT License. See [LICENSE](../../LICENSE). diff --git a/containers/python-3-miniconda/environment.yml b/containers/python-3-miniconda/environment.yml new file mode 100644 index 0000000000..2a6b35fb84 --- /dev/null +++ b/containers/python-3-miniconda/environment.yml @@ -0,0 +1,3 @@ +jupyter +numpy +matplotlib diff --git a/containers/python-3-miniconda/test-project/hello.py b/containers/python-3-miniconda/test-project/hello.py new file mode 100644 index 0000000000..97af5dc28e --- /dev/null +++ b/containers/python-3-miniconda/test-project/hello.py @@ -0,0 +1,18 @@ +#%% +import matplotlib +import matplotlib.pyplot as plt +import numpy as np + +# Data for plotting +t = np.arange(0.0, 2.0, 0.01) +s = 1 + np.sin(2 * np.pi * t) + +fig, ax = plt.subplots() +ax.plot(t, s) + +ax.set(xlabel='time (s)', ylabel='voltage (mV)', + title='About as simple as it gets, folks') +ax.grid() + +fig.savefig("test.png") +plt.show() \ No newline at end of file From 348215782f6b85d58094d7b3a65f43726c0e24d5 Mon Sep 17 00:00:00 2001 From: "Dan Taylor (VS)" Date: Tue, 16 Apr 2019 18:22:56 -0700 Subject: [PATCH 10/13] updating per code review feedback --- .../.devcontainer/devcontainer.json | 7 ++-- .../.devcontainer/docker-compose.yml | 12 ------- .../.devcontainer/Dockerfile | 27 --------------- .../.devcontainer/devcontainer.json | 11 ------ .../.devcontainer/docker-compose.yml | 18 ---------- .../.devcontainer/requirements.txt | 3 -- .../.devcontainer/settings.vscode.json | 3 -- containers/python-3-flask-redis/.npmignore | 4 --- .../python-3-flask-redis/.vscode/launch.json | 28 --------------- .../.vscode/settings.json | 3 -- containers/python-3-flask-redis/README.md | 25 -------------- .../test-project/Dockerfile | 5 --- .../python-3-flask-redis/test-project/app.py | 29 ---------------- .../test-project/docker-compose.yml | 8 ----- .../test-project/requirements.txt | 2 -- .../.devcontainer/Dockerfile | 34 ------------------- .../.devcontainer/devcontainer.json | 10 ------ .../.devcontainer/docker-compose.yml | 19 ----------- .../.devcontainer/jupyter_notebook_config.py | 8 ----- .../.devcontainer/settings.vscode.json | 4 --- .../python-3-jupyter-pyspark/.npmignore | 4 --- .../.vscode/settings.json | 5 --- containers/python-3-jupyter-pyspark/README.md | 32 ----------------- .../test-project/notebook.py | 8 ----- .../.devcontainer/devcontainer.json | 7 ++-- .../.devcontainer/docker-compose.yml | 12 ------- .../python-3/.devcontainer/devcontainer.json | 5 +-- .../python-3/.devcontainer/docker-compose.yml | 12 ------- 28 files changed, 11 insertions(+), 334 deletions(-) delete mode 100644 containers/python-3-anaconda/.devcontainer/docker-compose.yml delete mode 100644 containers/python-3-flask-redis/.devcontainer/Dockerfile delete mode 100644 containers/python-3-flask-redis/.devcontainer/devcontainer.json delete mode 100644 containers/python-3-flask-redis/.devcontainer/docker-compose.yml delete mode 100644 containers/python-3-flask-redis/.devcontainer/requirements.txt delete mode 100644 containers/python-3-flask-redis/.devcontainer/settings.vscode.json delete mode 100644 containers/python-3-flask-redis/.npmignore delete mode 100644 containers/python-3-flask-redis/.vscode/launch.json delete mode 100644 containers/python-3-flask-redis/.vscode/settings.json delete mode 100644 containers/python-3-flask-redis/README.md delete mode 100644 containers/python-3-flask-redis/test-project/Dockerfile delete mode 100644 containers/python-3-flask-redis/test-project/app.py delete mode 100644 containers/python-3-flask-redis/test-project/docker-compose.yml delete mode 100644 containers/python-3-flask-redis/test-project/requirements.txt delete mode 100644 containers/python-3-jupyter-pyspark/.devcontainer/Dockerfile delete mode 100644 containers/python-3-jupyter-pyspark/.devcontainer/devcontainer.json delete mode 100644 containers/python-3-jupyter-pyspark/.devcontainer/docker-compose.yml delete mode 100644 containers/python-3-jupyter-pyspark/.devcontainer/jupyter_notebook_config.py delete mode 100644 containers/python-3-jupyter-pyspark/.devcontainer/settings.vscode.json delete mode 100644 containers/python-3-jupyter-pyspark/.npmignore delete mode 100644 containers/python-3-jupyter-pyspark/.vscode/settings.json delete mode 100644 containers/python-3-jupyter-pyspark/README.md delete mode 100644 containers/python-3-jupyter-pyspark/test-project/notebook.py delete mode 100644 containers/python-3-miniconda/.devcontainer/docker-compose.yml delete mode 100644 containers/python-3/.devcontainer/docker-compose.yml diff --git a/containers/python-3-anaconda/.devcontainer/devcontainer.json b/containers/python-3-anaconda/.devcontainer/devcontainer.json index eb62c26830..4dec8f9162 100644 --- a/containers/python-3-anaconda/.devcontainer/devcontainer.json +++ b/containers/python-3-anaconda/.devcontainer/devcontainer.json @@ -1,7 +1,8 @@ { - "name": "Anaconda 3", - "dockerComposeFile": "docker-compose.yml", - "service": "app", + "name": "Python 3 - Anaconda", + "context": "..", + "dockerFile": "Dockerfile", + "appPort": "5000:5000", "workspaceFolder": "/workspace", "extensions": [ "ms-python.python", diff --git a/containers/python-3-anaconda/.devcontainer/docker-compose.yml b/containers/python-3-anaconda/.devcontainer/docker-compose.yml deleted file mode 100644 index 9216ed013b..0000000000 --- a/containers/python-3-anaconda/.devcontainer/docker-compose.yml +++ /dev/null @@ -1,12 +0,0 @@ -version: '3' - -services: - app: - build: - context: .. - dockerfile: .devcontainer/Dockerfile - ports: - - 5000:5000 - volumes: - - ..:/workspace - command: sleep infinity diff --git a/containers/python-3-flask-redis/.devcontainer/Dockerfile b/containers/python-3-flask-redis/.devcontainer/Dockerfile deleted file mode 100644 index 87975814ee..0000000000 --- a/containers/python-3-flask-redis/.devcontainer/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -#----------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See LICENSE in the project root for license information. -#----------------------------------------------------------------------------------------- - -FROM python:3 - -# Copy default endpoint specific user settings overrides into container to specify Python path -COPY settings.vscode.json /root/.vscode-remote/data/Machine/settings.json - -RUN mkdir /workspace -WORKDIR /workspace - -# Install pylint, flask, redis -COPY requirements.txt /workspace/ -RUN pip install -r requirements.txt && rm -f requirements.txt - -# Install git -RUN apt-get update && apt-get -y install git - -# Install any missing dependencies for enhanced language service -RUN apt-get install -y libicu[0-9][0-9] - -# Clean up -RUN apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* diff --git a/containers/python-3-flask-redis/.devcontainer/devcontainer.json b/containers/python-3-flask-redis/.devcontainer/devcontainer.json deleted file mode 100644 index 4ee5e18b59..0000000000 --- a/containers/python-3-flask-redis/.devcontainer/devcontainer.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "Python & Redis", - "dockerComposeFile": "docker-compose.yml", - "service": "web", - "workspaceFolder": "/workspace", - "shutdownAction": "stopCompose", - "extensions": [ - "ms-python.python", - "LittleFoxTeam.vscode-python-test-adapter" - ] -} \ No newline at end of file diff --git a/containers/python-3-flask-redis/.devcontainer/docker-compose.yml b/containers/python-3-flask-redis/.devcontainer/docker-compose.yml deleted file mode 100644 index e6232b25c2..0000000000 --- a/containers/python-3-flask-redis/.devcontainer/docker-compose.yml +++ /dev/null @@ -1,18 +0,0 @@ -#----------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See LICENSE in the project root for license information. -#----------------------------------------------------------------------------------------- - -version: '3' -services: - web: - build: - context: . - dockerfile: Dockerfile - ports: - - "5000:5000" - volumes: - - ..:/workspace - command: sleep infinity - redis: - image: "redis:alpine" diff --git a/containers/python-3-flask-redis/.devcontainer/requirements.txt b/containers/python-3-flask-redis/.devcontainer/requirements.txt deleted file mode 100644 index 7ec70d54d7..0000000000 --- a/containers/python-3-flask-redis/.devcontainer/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -pylint -flask -redis \ No newline at end of file diff --git a/containers/python-3-flask-redis/.devcontainer/settings.vscode.json b/containers/python-3-flask-redis/.devcontainer/settings.vscode.json deleted file mode 100644 index 8ad19d5bb5..0000000000 --- a/containers/python-3-flask-redis/.devcontainer/settings.vscode.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "python.pythonPath": "/usr/local/bin/python" -} \ No newline at end of file diff --git a/containers/python-3-flask-redis/.npmignore b/containers/python-3-flask-redis/.npmignore deleted file mode 100644 index 1d72d293eb..0000000000 --- a/containers/python-3-flask-redis/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -README.md -test-project -.vscode -.npmignore diff --git a/containers/python-3-flask-redis/.vscode/launch.json b/containers/python-3-flask-redis/.vscode/launch.json deleted file mode 100644 index 47c8750ecf..0000000000 --- a/containers/python-3-flask-redis/.vscode/launch.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Flask", - "type": "python", - "request": "launch", - "module": "flask", - "env": { - "FLASK_APP": "app.py", - "FLASK_ENV": "development", - "FLASK_DEBUG": "0" - }, - "cwd": "${workspaceFolder}/test-project", - "args": [ - "run", - "-h", "0.0.0.0", - "-p", "5000", - "--no-debugger", - "--no-reload" - ], - "jinja": true - } - ] -} \ No newline at end of file diff --git a/containers/python-3-flask-redis/.vscode/settings.json b/containers/python-3-flask-redis/.vscode/settings.json deleted file mode 100644 index 8ad19d5bb5..0000000000 --- a/containers/python-3-flask-redis/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "python.pythonPath": "/usr/local/bin/python" -} \ No newline at end of file diff --git a/containers/python-3-flask-redis/README.md b/containers/python-3-flask-redis/README.md deleted file mode 100644 index b6f25a4289..0000000000 --- a/containers/python-3-flask-redis/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Python 3, Flask, & Redis - -## Summary - -*A basic multi-container dev container definition for building Flask applications in a container that rely on Redis. Includes everything you need to get up and running.* - -| Metadata | Value | -|----------|-------| -| *Contributors* | The VS Code Team | -| *Definition type* | Docker Compose | -| *Languages, platforms* | Python, Flask, Redis | - -## Usage - -[See here for information on using this definition with an existing project](../../README.md#using-a-definition). - -If you prefer, you can also just look through the contents of the `.devcontainer` folder to understand how to make changes to your own project. - -If you want to try out the test project instead, run **Remote-Container: Open Folder in Container...** in VS Code and select a cloned copy of the entire folder. You can then start the test program from Debug panel in VS Code. - -## License - -Copyright (c) Microsoft Corporation. All rights reserved. - -Licensed under the MIT License. See [LICENSE](../../LICENSE). diff --git a/containers/python-3-flask-redis/test-project/Dockerfile b/containers/python-3-flask-redis/test-project/Dockerfile deleted file mode 100644 index f0308bcc7e..0000000000 --- a/containers/python-3-flask-redis/test-project/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM python:3 -ADD . /app -WORKDIR /app -RUN pip install -r requirements.txt -CMD ["python", "app.py"] \ No newline at end of file diff --git a/containers/python-3-flask-redis/test-project/app.py b/containers/python-3-flask-redis/test-project/app.py deleted file mode 100644 index 92b243bdb4..0000000000 --- a/containers/python-3-flask-redis/test-project/app.py +++ /dev/null @@ -1,29 +0,0 @@ -import time - -import redis -from flask import Flask - - -app = Flask(__name__) -cache = redis.Redis(host='redis', port=6379) - - -def get_hit_count(): - retries = 5 - while True: - try: - return cache.incr('hits') - except redis.exceptions.ConnectionError as exc: - if retries == 0: - raise exc - retries -= 1 - time.sleep(0.5) - - -@app.route('/') -def hello(): - count = get_hit_count() - return 'Hello World! I have been seen {} times.\n'.format(count) - -if __name__ == "__main__": - app.run(host="0.0.0.0", debug=True) diff --git a/containers/python-3-flask-redis/test-project/docker-compose.yml b/containers/python-3-flask-redis/test-project/docker-compose.yml deleted file mode 100644 index 899cf44491..0000000000 --- a/containers/python-3-flask-redis/test-project/docker-compose.yml +++ /dev/null @@ -1,8 +0,0 @@ -version: '3' -services: - web: - build: . - ports: - - "5000:5000" - redis: - image: "redis:alpine" diff --git a/containers/python-3-flask-redis/test-project/requirements.txt b/containers/python-3-flask-redis/test-project/requirements.txt deleted file mode 100644 index 1a5dc97b12..0000000000 --- a/containers/python-3-flask-redis/test-project/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -flask -redis diff --git a/containers/python-3-jupyter-pyspark/.devcontainer/Dockerfile b/containers/python-3-jupyter-pyspark/.devcontainer/Dockerfile deleted file mode 100644 index 5e1f132c86..0000000000 --- a/containers/python-3-jupyter-pyspark/.devcontainer/Dockerfile +++ /dev/null @@ -1,34 +0,0 @@ -#----------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See LICENSE in the project root for license information. -#----------------------------------------------------------------------------------------- - -FROM jupyter/pyspark-notebook - -USER root - -# Install git, process tools -RUN apt-get update && apt-get -y install git procps - -# Install any missing dependencies for enhanced language service -RUN apt-get install -y libicu[0-9][0-9] - -# Clean up -RUN apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* - -# Copy jupyter_notebook_config.py with token that matches settings -COPY jupyter_notebook_config.py /home/jovyan/.jupyter/jupyter_notebook_config.py - -# Copy default endpoint specific user settings overrides into container to specify Python path, token -COPY settings.vscode.json /home/jovyan/.vscode-remote/data/Machine/settings.json - -RUN chown jovyan -R /home/jovyan - -USER jovyan - -RUN pip install pylint - - - diff --git a/containers/python-3-jupyter-pyspark/.devcontainer/devcontainer.json b/containers/python-3-jupyter-pyspark/.devcontainer/devcontainer.json deleted file mode 100644 index eb88b8f139..0000000000 --- a/containers/python-3-jupyter-pyspark/.devcontainer/devcontainer.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "Python 3, Jupyter, & PySpark", - "dockerComposeFile": "docker-compose.yml", - "service": "jupyter", - "workspaceFolder": "/notebooks", - "shutdownAction": "stopCompose", - "extensions": [ - "ms-python.python" - ] -} diff --git a/containers/python-3-jupyter-pyspark/.devcontainer/docker-compose.yml b/containers/python-3-jupyter-pyspark/.devcontainer/docker-compose.yml deleted file mode 100644 index 048127d8e8..0000000000 --- a/containers/python-3-jupyter-pyspark/.devcontainer/docker-compose.yml +++ /dev/null @@ -1,19 +0,0 @@ -#----------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See LICENSE in the project root for license information. -#----------------------------------------------------------------------------------------- - -# Using Docker Compose so VS Code does not override the default command and the container -# stays running after VS Code stops so you can access Jupyter Notebooks via port 8888. - -version: '3' -services: - jupyter: - build: - context: . - dockerfile: Dockerfile - ports: - - "8888:8888" - volumes: - - ..:/notebooks - diff --git a/containers/python-3-jupyter-pyspark/.devcontainer/jupyter_notebook_config.py b/containers/python-3-jupyter-pyspark/.devcontainer/jupyter_notebook_config.py deleted file mode 100644 index 31b7e52958..0000000000 --- a/containers/python-3-jupyter-pyspark/.devcontainer/jupyter_notebook_config.py +++ /dev/null @@ -1,8 +0,0 @@ -#----------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See LICENSE in the project root for license information. -#----------------------------------------------------------------------------------------- - -c.NotebookApp.open_browser = False -c.NotebookApp.port = 8888 -c.NotebookApp.token = '1e8a4466-396e-4a1b-bec6-729de2772f29' diff --git a/containers/python-3-jupyter-pyspark/.devcontainer/settings.vscode.json b/containers/python-3-jupyter-pyspark/.devcontainer/settings.vscode.json deleted file mode 100644 index 3e849cce2c..0000000000 --- a/containers/python-3-jupyter-pyspark/.devcontainer/settings.vscode.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "python.pythonPath": "/opt/conda/bin/python", - "python.dataScience.jupyterServerURI": "http://localhost:8888?token=1e8a4466-396e-4a1b-bec6-729de2772f29" -} \ No newline at end of file diff --git a/containers/python-3-jupyter-pyspark/.npmignore b/containers/python-3-jupyter-pyspark/.npmignore deleted file mode 100644 index 1d72d293eb..0000000000 --- a/containers/python-3-jupyter-pyspark/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -README.md -test-project -.vscode -.npmignore diff --git a/containers/python-3-jupyter-pyspark/.vscode/settings.json b/containers/python-3-jupyter-pyspark/.vscode/settings.json deleted file mode 100644 index e5c3e74405..0000000000 --- a/containers/python-3-jupyter-pyspark/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "python.dataScience.notebookFileRoot": "${workspaceFolder}/test-project", - "python.linting.enabled": true - -} \ No newline at end of file diff --git a/containers/python-3-jupyter-pyspark/README.md b/containers/python-3-jupyter-pyspark/README.md deleted file mode 100644 index b6b63ade0c..0000000000 --- a/containers/python-3-jupyter-pyspark/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# Python 3, Jupyter, & PySpark - -## Summary - -*A basic dev container definition that sets up Jupyter Notebooks in a container for use with the VS Code Python Extension. Includes everything you need to get up and running.* - -| Metadata | Value | -|----------|-------| -| *Contributors* | The VS Code Team | -| *Definition type* | Docker Compose | -| *Languages, platforms* | Python, Jupyter, PySpark| - -## Usage - -[See here for information on using this definition with an existing project](../../README.md#using-a-definition). - -The definition connects the Python Extension to Jupyter using a token. You can change this token by editing: - -- The token portion of `python.dataScience.jupyterServerURI` in `.devcontainer/settings.vscode.json` -- The the value of `c.NotebookApp.token` in `jupyter_notebook_config.py` - -...and then running **Remote-Containers: Rebuild Container**. - -If you prefer, you can also just look through the contents of the `.devcontainer` folder to understand how to make changes to your own project. - -If you want to try out the test project instead, run **Remote-Container: Open Folder in Container...** in VS Code and select a cloned copy of the entire folder and using the Notebook in the `test-project` folder. - -## License - -Copyright (c) Microsoft Corporation. All rights reserved. - -Licensed under the MIT License. See [LICENSE](../../LICENSE). diff --git a/containers/python-3-jupyter-pyspark/test-project/notebook.py b/containers/python-3-jupyter-pyspark/test-project/notebook.py deleted file mode 100644 index 3916097149..0000000000 --- a/containers/python-3-jupyter-pyspark/test-project/notebook.py +++ /dev/null @@ -1,8 +0,0 @@ -#%% -import matplotlib.pyplot as plt -import matplotlib as mpl -import numpy as np - -x = np.linspace(0, 20, 100) -plt.plot(x, np.sin(x)) -plt.show() \ No newline at end of file diff --git a/containers/python-3-miniconda/.devcontainer/devcontainer.json b/containers/python-3-miniconda/.devcontainer/devcontainer.json index 8539debd33..22f4420afb 100644 --- a/containers/python-3-miniconda/.devcontainer/devcontainer.json +++ b/containers/python-3-miniconda/.devcontainer/devcontainer.json @@ -1,7 +1,8 @@ { - "name": "Miniconda 3", - "dockerComposeFile": "docker-compose.yml", - "service": "app", + "name": "Python 3 - Miniconda", + "context": "..", + "dockerFile": "Dockerfile", + "appPort": "5000:5000", "workspaceFolder": "/workspace", "extensions": [ "ms-python.python", diff --git a/containers/python-3-miniconda/.devcontainer/docker-compose.yml b/containers/python-3-miniconda/.devcontainer/docker-compose.yml deleted file mode 100644 index 9216ed013b..0000000000 --- a/containers/python-3-miniconda/.devcontainer/docker-compose.yml +++ /dev/null @@ -1,12 +0,0 @@ -version: '3' - -services: - app: - build: - context: .. - dockerfile: .devcontainer/Dockerfile - ports: - - 5000:5000 - volumes: - - ..:/workspace - command: sleep infinity diff --git a/containers/python-3/.devcontainer/devcontainer.json b/containers/python-3/.devcontainer/devcontainer.json index 79dec45c42..612ce11228 100644 --- a/containers/python-3/.devcontainer/devcontainer.json +++ b/containers/python-3/.devcontainer/devcontainer.json @@ -1,7 +1,8 @@ { "name": "Python 3", - "dockerComposeFile": "docker-compose.yml", - "service": "app", + "context": "..", + "dockerFile": "Dockerfile", + "appPort": "5000:5000", "workspaceFolder": "/workspace", "extensions": [ "ms-python.python", diff --git a/containers/python-3/.devcontainer/docker-compose.yml b/containers/python-3/.devcontainer/docker-compose.yml deleted file mode 100644 index 9216ed013b..0000000000 --- a/containers/python-3/.devcontainer/docker-compose.yml +++ /dev/null @@ -1,12 +0,0 @@ -version: '3' - -services: - app: - build: - context: .. - dockerfile: .devcontainer/Dockerfile - ports: - - 5000:5000 - volumes: - - ..:/workspace - command: sleep infinity From 24ada5316adba9a43fb6b9c118f08e60ced0821c Mon Sep 17 00:00:00 2001 From: "Dan Taylor (VS)" Date: Tue, 16 Apr 2019 18:24:40 -0700 Subject: [PATCH 11/13] Update readme for anaconda/minconda --- containers/python-3-anaconda/README.md | 2 +- containers/python-3-miniconda/README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/containers/python-3-anaconda/README.md b/containers/python-3-anaconda/README.md index d3f706a76a..50070f582f 100644 --- a/containers/python-3-anaconda/README.md +++ b/containers/python-3-anaconda/README.md @@ -1,4 +1,4 @@ -# Python 3 +# Python 3 - Anaconda ## Summary diff --git a/containers/python-3-miniconda/README.md b/containers/python-3-miniconda/README.md index d3f706a76a..99c587f29f 100644 --- a/containers/python-3-miniconda/README.md +++ b/containers/python-3-miniconda/README.md @@ -1,8 +1,8 @@ -# Python 3 +# Python 3 - Miniconda ## Summary -*A basic dev container definition for developing Python 3 applications in an Anaconda container. Installs dependencies from your environment.yml file and the Python extension.* +*A basic dev container definition for developing Python 3 applications in an Miniconda container. Installs dependencies from your environment.yml file and the Python extension.* | Metadata | Value | |----------|-------| From 70f04ab8205aa442d69eb4689150540d7180da13 Mon Sep 17 00:00:00 2001 From: "Dan Taylor (VS)" Date: Wed, 17 Apr 2019 13:41:41 -0700 Subject: [PATCH 12/13] Python updates - remove default port mapping - remove libicu (no longer needed) - update python2 container to match others --- containers/python-2/.devcontainer/Dockerfile | 9 +++++---- containers/python-2/.devcontainer/devcontainer.json | 4 +++- containers/python-2/.devcontainer/requirements.txt.temp | 0 containers/python-3-anaconda/.devcontainer/Dockerfile | 6 ------ containers/python-3-miniconda/.devcontainer/Dockerfile | 6 ------ .../python-3-miniconda/.devcontainer/devcontainer.json | 1 - containers/python-3-postgres/.devcontainer/Dockerfile | 3 --- containers/python-3/.devcontainer/Dockerfile | 6 ------ containers/python-3/.devcontainer/devcontainer.json | 1 - 9 files changed, 8 insertions(+), 28 deletions(-) create mode 100644 containers/python-2/.devcontainer/requirements.txt.temp diff --git a/containers/python-2/.devcontainer/Dockerfile b/containers/python-2/.devcontainer/Dockerfile index bc1e86e831..71d72fa5bc 100644 --- a/containers/python-2/.devcontainer/Dockerfile +++ b/containers/python-2/.devcontainer/Dockerfile @@ -3,18 +3,19 @@ # Licensed under the MIT License. See LICENSE in the project root for license information. #----------------------------------------------------------------------------------------- -FROM python:2-slim +FROM python:2 # Copy endpoint specific user settings overrides into container to specify Python path -COPY settings.vscode.json /root/.vscode-remote/data/Machine/settings.json +COPY .devcontainer/settings.vscode.json /root/.vscode-remote/data/Machine/settings.json RUN pip install pylint # Install git, process tools RUN apt-get update && apt-get -y install git procps -# Install any missing dependencies for enhanced language service -RUN apt-get install -y libicu57 +# Install Python dependencies from requirements.txt if it exists +COPY .devcontainer/requirements.txt.temp requirements.txt* /workspace/ +RUN if [ -f "requirements.txt" ]; then pip install -r requirements.txt && rm requirements.txt*; fi # Clean up RUN apt-get autoremove -y \ diff --git a/containers/python-2/.devcontainer/devcontainer.json b/containers/python-2/.devcontainer/devcontainer.json index 001fc5c022..b01864a771 100644 --- a/containers/python-2/.devcontainer/devcontainer.json +++ b/containers/python-2/.devcontainer/devcontainer.json @@ -1,8 +1,10 @@ { "name": "Python 2", + "context": "..", "dockerFile": "Dockerfile", + "workspaceFolder": "/workspace", "extensions": [ "ms-python.python", - "LittleFoxTeam.vscode-python-test-adapter" + "VisualStudioExptTeam.vscodeintellicode" ] } diff --git a/containers/python-2/.devcontainer/requirements.txt.temp b/containers/python-2/.devcontainer/requirements.txt.temp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/containers/python-3-anaconda/.devcontainer/Dockerfile b/containers/python-3-anaconda/.devcontainer/Dockerfile index cc93ab030b..dc33193602 100644 --- a/containers/python-3-anaconda/.devcontainer/Dockerfile +++ b/containers/python-3-anaconda/.devcontainer/Dockerfile @@ -11,9 +11,6 @@ COPY .devcontainer/settings.vscode.json /root/.vscode-remote/data/Machine/settin # Install git, process tools RUN apt-get update && apt-get -y install git procps -# Install any missing dependencies for enhanced language service -RUN apt-get install -y libicu[0-9][0-9] - RUN mkdir /workspace WORKDIR /workspace @@ -21,9 +18,6 @@ WORKDIR /workspace COPY .devcontainer/environment.yml.temp environment.yml* /workspace/ RUN if [ -f "environment.yml" ]; then conda env update base -f environment.yml && rm environment.yml*; fi -# Expose port 5000 as the default web port -EXPOSE 5000 - # Clean up RUN apt-get autoremove -y \ && apt-get clean -y \ diff --git a/containers/python-3-miniconda/.devcontainer/Dockerfile b/containers/python-3-miniconda/.devcontainer/Dockerfile index 4d2302c34c..07182c1fe4 100644 --- a/containers/python-3-miniconda/.devcontainer/Dockerfile +++ b/containers/python-3-miniconda/.devcontainer/Dockerfile @@ -11,9 +11,6 @@ COPY .devcontainer/settings.vscode.json /root/.vscode-remote/data/Machine/settin # Install git, process tools RUN apt-get update && apt-get -y install git procps -# Install any missing dependencies for enhanced language service -RUN apt-get install -y libicu[0-9][0-9] - RUN mkdir /workspace WORKDIR /workspace @@ -21,9 +18,6 @@ WORKDIR /workspace COPY .devcontainer/environment.yml.temp environment.yml* /workspace/ RUN if [ -f "environment.yml" ]; then conda env update base -f environment.yml && rm environment.yml*; fi -# Expose port 5000 as the default web port -EXPOSE 5000 - # Clean up RUN apt-get autoremove -y \ && apt-get clean -y \ diff --git a/containers/python-3-miniconda/.devcontainer/devcontainer.json b/containers/python-3-miniconda/.devcontainer/devcontainer.json index 22f4420afb..88be075462 100644 --- a/containers/python-3-miniconda/.devcontainer/devcontainer.json +++ b/containers/python-3-miniconda/.devcontainer/devcontainer.json @@ -2,7 +2,6 @@ "name": "Python 3 - Miniconda", "context": "..", "dockerFile": "Dockerfile", - "appPort": "5000:5000", "workspaceFolder": "/workspace", "extensions": [ "ms-python.python", diff --git a/containers/python-3-postgres/.devcontainer/Dockerfile b/containers/python-3-postgres/.devcontainer/Dockerfile index feb38c1bf0..975410868d 100644 --- a/containers/python-3-postgres/.devcontainer/Dockerfile +++ b/containers/python-3-postgres/.devcontainer/Dockerfile @@ -16,9 +16,6 @@ WORKDIR /workspace # Install git, process tools RUN apt-get update && apt-get -y install git procps -# Install any missing dependencies for enhanced language service -RUN apt-get install -y libicu[0-9][0-9] - # Install Python dependencies from requirements.txt if it exists COPY .devcontainer/requirements.txt.temp requirements.txt* /workspace/ RUN if [ -f "requirements.txt" ]; then pip install -r requirements.txt && rm requirements.txt; fi diff --git a/containers/python-3/.devcontainer/Dockerfile b/containers/python-3/.devcontainer/Dockerfile index 25271135bf..43b7b6cb3f 100644 --- a/containers/python-3/.devcontainer/Dockerfile +++ b/containers/python-3/.devcontainer/Dockerfile @@ -11,9 +11,6 @@ COPY .devcontainer/settings.vscode.json /root/.vscode-remote/data/Machine/settin # Install git, process tools RUN apt-get update && apt-get -y install git procps -# Install any missing dependencies for enhanced language service -RUN apt-get install -y libicu[0-9][0-9] - RUN mkdir /workspace WORKDIR /workspace @@ -21,9 +18,6 @@ WORKDIR /workspace COPY .devcontainer/requirements.txt.temp requirements.txt* /workspace/ RUN if [ -f "requirements.txt" ]; then pip install -r requirements.txt && rm requirements.txt*; fi -# Expose port 5000 as the default web port -EXPOSE 5000 - # Clean up RUN apt-get autoremove -y \ && apt-get clean -y \ diff --git a/containers/python-3/.devcontainer/devcontainer.json b/containers/python-3/.devcontainer/devcontainer.json index 612ce11228..33e6fd5de5 100644 --- a/containers/python-3/.devcontainer/devcontainer.json +++ b/containers/python-3/.devcontainer/devcontainer.json @@ -2,7 +2,6 @@ "name": "Python 3", "context": "..", "dockerFile": "Dockerfile", - "appPort": "5000:5000", "workspaceFolder": "/workspace", "extensions": [ "ms-python.python", From d1ffc8af8dc66eea9bfa8811fa206518bc3a045d Mon Sep 17 00:00:00 2001 From: "Dan Taylor (VS)" Date: Wed, 17 Apr 2019 13:43:09 -0700 Subject: [PATCH 13/13] Updating Python2 readme --- containers/python-2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers/python-2/README.md b/containers/python-2/README.md index 6fa00e3901..3f83dfc86c 100644 --- a/containers/python-2/README.md +++ b/containers/python-2/README.md @@ -2,7 +2,7 @@ ## Summary -*A basic dev container definition for developing Python 2 applications in a container. Includes everything you need to get up and running like PyLint and the Python extension.* +*A basic dev container definition for developing Python 2 applications in a container. Installs dependencies from your requirements.txt file and the Python extension.* | Metadata | Value | |----------|-------|