Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: polish README.md #656

Merged
merged 5 commits into from
Apr 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ See **[history](history)** for information on the contents of published images.

### Configuration

You can directly reference pre-built versions of `Dockerfile` by using the `image` property in `.devcontainer/devcontainer.json` or updating the `FROM` statement in your own `Dockerfile` with one of the following:
You can directly reference pre-built versions of this image by using the `image` property in `.devcontainer/devcontainer.json` or updating the `FROM` statement in your own `Dockerfile` with one of the following:
dpprdan marked this conversation as resolved.
Show resolved Hide resolved

- `mcr.microsoft.com/devcontainers/python:3` (latest)
- `mcr.microsoft.com/devcontainers/python:3.8` (or `3.8-bookworm`, `3.8-bullseye`, `3.8-buster` to pin to an OS version)
Expand All @@ -37,13 +37,14 @@ You can decide how often you want updates by referencing a [semantic version](ht
- `mcr.microsoft.com/devcontainers/python:1.0-3.9` (or `1.0-3.9-bullseye`, `1.0-3.9-buster`)
- `mcr.microsoft.com/devcontainers/python:1.0.0-3.9` (or `1.0.0-3.9-bullseye`, `1.0.0-3.9-buster`)

However, we only do security patching on the latest [non-breaking, in support](https://github.com/devcontainers/images/issues/90) versions of images (e.g. `1-14`). You may want to run `apt-get update && apt-get upgrade` in your Dockerfile if you lock to a more specific version to at least pick up OS security updates.
However, we only do security patching on the latest [non-breaking, in support](https://github.com/devcontainers/images/issues/90) versions of images (e.g. `1-14`).
dpprdan marked this conversation as resolved.
Show resolved Hide resolved
You may want to run `apt-get update && apt-get upgrade` in your Dockerfile if you lock to a more specific version to at least pick up OS security updates.

See [history](history) for information on the contents of each version and [here for a complete list of available tags](https://mcr.microsoft.com/v2/devcontainers/python/tags/list).

Alternatively, you can use the contents of `Dockerfile` to fully customize the your container's contents or build for a container architecture the image does not support.
Alternatively, you can use the contents of [.devcontainer](.devcontainer) to fully customize the your container's contents or build for a container architecture the image does not support.

Beyond Python and `git`, this image / `Dockerfile` includes a number of Python tools, `zsh`, [Oh My Zsh!](https://ohmyz.sh/), a non-root `vscode` user with `sudo` access, and a set of common dependencies for development.
Beyond Python and `git`, this image includes a number of Python tools, `zsh`, [Oh My Zsh!](https://ohmyz.sh/), a non-root `vscode` user with `sudo` access, and a set of common dependencies for development, see [.devcontainer/devcontainer.json](.devcontainer/devcontainer.json).
dpprdan marked this conversation as resolved.
Show resolved Hide resolved

### Installing Node.js

Expand All @@ -63,7 +64,7 @@ Also, you can use a [Node feature](https://github.com/devcontainers/features/tre

#### Installing or updating Python utilities

This container installs all Python development utilities using [pipx](https://pipxproject.github.io/pipx/) to avoid impacting the global Python environment. You can use this same utility add additional utilities in an isolated environment. For example:
This container installs all Python development utilities using [pipx](https://pipxproject.github.io/pipx/) to avoid impacting the global Python environment. You can use this same utility to add additional utilities in an isolated environment. For example:

```bash
pipx install prospector
Expand All @@ -73,7 +74,7 @@ See the [pipx documentation](https://pipxproject.github.io/pipx/docs/) for addit

#### Using the forwardPorts property

By default, frameworks like Flask only listens to localhost inside the container. As a result, we recommend using the `forwardPorts` property (available in v0.98.0+) to make these ports available locally.
By default, frameworks like Flask only listen to localhost inside the container. As a result, we recommend using the `forwardPorts` property (available in v0.98.0+) to make these ports available locally.

```json
"forwardPorts": [5000]
Expand All @@ -97,7 +98,7 @@ Since `requirements.txt` is likely in the folder you opened be sure to include `

#### [Optional] Allowing the non-root vscode user to pip install globally without sudo

You can opt into using the `vscode` non-root user in the container by adding `"remoteUser": "vscode"` to `devcontainer.json`. However, by default, this you will need to use `sudo` to perform global pip installs.
You can opt into using the `vscode` non-root user in the container by adding `"remoteUser": "vscode"` to `devcontainer.json`. However, by default, you will need to use `sudo` to perform global pip installs.

```bash
sudo pip install <your-package-here>
Expand All @@ -124,7 +125,7 @@ RUN if ! cat /etc/group | grep -e "^pip-global:" > /dev/null 2>&1; then groupadd

#### [Optional] Installing multiple versions of Python in the same image

If you would prefer to have multiple Python versions in your container, use `Dockerfile` and update `FROM` statement:
If you would prefer to have multiple Python versions in your container, use `Dockerfile` and update the `FROM` statement:

```Dockerfile
FROM ubuntu:jammy
Expand Down