Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Commit

Permalink
Merge pull request #113 from brettcannon/python-updates
Browse files Browse the repository at this point in the history
Python updates
  • Loading branch information
brettcannon committed Aug 9, 2019
2 parents 67f1f40 + 3058f46 commit ae361c0
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 41 deletions.
17 changes: 9 additions & 8 deletions containers/python-2/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Copy requirements.txt (if found) to a temp locaition so we can install it. Also
# copy "noop.txt" so the COPY instruction does not fail if no requirements.txt exists.
COPY requirements.txt* .devcontainer/noop.txt /tmp/pip-tmp/
# Uncomment the following COPY line and the corresponding lines in the `RUN` command if you wish to
# include your requirements in the image itself. It is suggested that you only do this if your
# requirements rarely (if ever) change.
# COPY requirements.txt /tmp/pip-tmp/

# Configure apt and install packages
RUN apt-get update \
Expand All @@ -28,11 +29,11 @@ RUN apt-get update \
&& apt-get -y install git procps lsb-release \
#
# Install pylint
&& pip install pylint \
&& pip --disable-pip-version-check --no-cache-dir install pylint \
#
# Update Python environment based on requirements.txt (if presenet)
&& if [ -f "/tmp/pip-tmp/requirements.txt" ]; then pip install -r /tmp/pip-tmp/requirements.txt; fi \
&& rm -rf /tmp/pip-tmp \
# Update Python environment based on requirements.txt
# && pip --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
# && rm -rf /tmp/pip-tmp \
#
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
&& groupadd --gid $USER_GID $USERNAME \
Expand All @@ -48,4 +49,4 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*

# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=
ENV DEBIAN_FRONTEND=
5 changes: 3 additions & 2 deletions containers/python-2/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// "appPort": [],

// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "java -version",
// "postCreateCommand": "pip install -r requirements.txt",

// Uncomment the next line to use a non-root user. On Linux, this will prevent
// new files getting created as root, but you may need to update the USER_UID
Expand All @@ -19,7 +19,8 @@
],
"settings": {
"python.pythonPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.enabled": true
"python.linting.pylintPath": "/usr/local/bin/pylint"
}
}
3 changes: 0 additions & 3 deletions containers/python-2/.devcontainer/noop.txt

This file was deleted.

4 changes: 2 additions & 2 deletions containers/python-2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

*Develop Python 2 applications. Installs dependencies from your requirements.txt file and the Python extension.*

| Metadata | Value |
| Metadata | Value |
|----------|-------|
| *Contributors* | The [VS Code Python extension](https://marketplace.visualstudio.com/itemdetails?itemName=ms-python.python) team |
| *Definition type* | Dockerfile |
| *Languages, platforms* | Python |

## Using this definition with an existing folder

For convenience, this definition will automatically install dependencies from your `requirements.txt` file when the container is built. Also note that only the integrated terminal is supported by the Remote - Containers extension. You may need to modify `launch.json` configurations to include the following value if an external console is used.
Note that only the integrated terminal is supported by the Remote - Containers extension. You may need to modify `launch.json` configurations to include the following value if an external console is used.

```json
"console": "integratedTerminal"
Expand Down
7 changes: 4 additions & 3 deletions containers/python-3-anaconda/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Python 3 - Anaconda",
"context": "..",
"dockerFile": "Dockerfile",

// Uncomment the next line if you want to publish any ports.
// "appPort": [],

Expand All @@ -19,7 +19,8 @@
],
"settings": {
"python.pythonPath": "/opt/conda/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.enabled": true
"python.linting.pylintPath": "/opt/conda/bin/pylint"
}
}
}
5 changes: 3 additions & 2 deletions containers/python-3-miniconda/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
],
"settings": {
"python.pythonPath": "/opt/conda/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.enabled": true
"python.linting.pylintPath": "/opt/conda/bin/pylint"
}
}
}
13 changes: 7 additions & 6 deletions containers/python-3-postgres/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Copy requirements.txt (if found) to a temp locaition so we can install it. Also
# copy "noop.txt" so the COPY instruction does not fail if no requirements.txt exists.
COPY requirements.txt* .devcontainer/noop.txt /tmp/pip-tmp/
# Uncomment the following COPY line and the corresponding lines in the `RUN` command if you wish to
# include your requirements in the image itself. It is suggested that you only do this if your
# requirements rarely (if ever) change.
# COPY requirements.txt /tmp/pip-tmp/

# Configure apt and install packages
RUN apt-get update \
Expand All @@ -32,9 +33,9 @@ RUN apt-get update \
# Install pylint
&& pip install pylint \
#
# Update Python environment based on requirements.txt (if presenet)
&& if [ -f "/tmp/pip-tmp/requirements.txt" ]; then pip install -r /tmp/pip-tmp/requirements.txt; fi \
&& rm -rf /tmp/pip-tmp \
# Update Python environment based on requirements.txt
# && pip --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
# && rm -rf /tmp/pip-tmp \
#
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
&& groupadd --gid $USER_GID $USERNAME \
Expand Down
7 changes: 4 additions & 3 deletions containers/python-3-postgres/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
// "shutdownAction": "none",

// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "python --version",
// "postCreateCommand": "pip install -r requirements.txt",

"extensions": [
"ms-python.python"
],
"settings": {
"python.pythonPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.enabled": true
"python.linting.pylintPath": "/usr/local/bin/pylint"
}
}
}
3 changes: 0 additions & 3 deletions containers/python-3-postgres/.devcontainer/noop.txt

This file was deleted.

5 changes: 3 additions & 2 deletions containers/python-3-postgres/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"--noreload",
"--nothreading"
],
"django": true
"django": true,
"preLaunchTask": "pip install"
}
]
}
}
10 changes: 10 additions & 0 deletions containers/python-3-postgres/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "pip install",
"type": "shell",
"command": "pip install -r ./test-project/requirements.txt"
}
]
}
4 changes: 2 additions & 2 deletions containers/python-3-postgres/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

*Develop applications with Python 3 and PostgreSQL. Includes a Python application container and PostgreSQL server, and a Django test project.*

| Metadata | Value |
| Metadata | Value |
|----------|-------|
| *Contributors* | The [VS Code Python extension](https://marketplace.visualstudio.com/itemdetails?itemName=ms-python.python) team |
| *Definition type* | Dockerfile |
| *Languages, platforms* | Python |

## Using this definition with an existing folder

First, for convenience, this definition will automatically install dependencies from your `requirements.txt` file when the container is built. However, note that `requirements.txt` in the root of this definition folder is **only present for testing** and is not used or required by the definition itself.
Note that `requirements.txt` in the root of this definition folder is **only present for testing** and is not used or required by the definition itself.

Second, only the integrated terminal is supported by the Remote - Containers extension. You may need to modify `launch.json` configurations to include the following value if an external console is used.

Expand Down
2 changes: 0 additions & 2 deletions containers/python-3-postgres/requirements.txt

This file was deleted.

3 changes: 2 additions & 1 deletion containers/python-3-postgres/test-project/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Django
Django
psycopg2-binary
4 changes: 2 additions & 2 deletions containers/python-3/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
],
"settings": {
"python.pythonPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.pylintPath": "/usr/local/bin/pylint",
"python.linting.enabled": true
"python.linting.pylintPath": "/usr/local/bin/pylint"
}
}

0 comments on commit ae361c0

Please sign in to comment.