Skip to content

Commit b6dff12

Browse files
authored
Match current template, add info on Features and image metadata (#62)
* Match current template, add info on Features and image metadata * Update * Fix typo * Fix typo * Remove bad comment about user name * Update portsAttributs ref * Remove otherPortsAttributes given the reference * Typo
1 parent 0c1547c commit b6dff12

File tree

3 files changed

+30
-85
lines changed

3 files changed

+30
-85
lines changed

.devcontainer/Dockerfile

Lines changed: 0 additions & 30 deletions
This file was deleted.

.devcontainer/devcontainer.json

Lines changed: 16 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,39 @@
1-
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
2-
// https://github.com/microsoft/vscode-dev-containers/tree/v0.202.3/containers/python-3
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/python
33
{
44
"name": "Python 3",
5-
"build": {
6-
"dockerfile": "Dockerfile",
7-
"context": "..",
8-
"args": {
9-
// Update 'VARIANT' to pick a Python version: 3, 3.9, 3.8, 3.7, 3.6.
10-
// Append -bullseye or -buster to pin to an OS version.
11-
// Use -bullseye variants on local on arm64/Apple Silicon.
12-
"VARIANT": "3.9-bullseye",
13-
// Options
14-
"NODE_VERSION": "lts/*"
15-
}
16-
},
17-
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"image": "mcr.microsoft.com/devcontainers/python:0-3.11",
7+
8+
// Features to add to the dev container. More info: https://containers.dev/features.
9+
// "features": {},
10+
1811
// Configure tool-specific properties.
1912
"customizations": {
2013
// Configure properties specific to VS Code.
2114
"vscode": {
22-
// Set *default* container specific settings.json values on container create.
23-
"settings": {
24-
"terminal.integrated.profiles.linux": {
25-
"bash": {
26-
"path": "/bin/bash"
27-
}
28-
},
29-
"python.defaultInterpreterPath": "/usr/local/bin/python",
30-
"python.languageServer": "Default",
31-
"python.linting.enabled": true,
32-
"python.linting.pylintEnabled": true,
33-
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
34-
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
35-
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
36-
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
37-
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
38-
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
39-
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
40-
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
41-
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
42-
},
43-
44-
// Add the IDs of extensions you want installed when the container is created.
15+
"settings": {},
4516
"extensions": [
46-
"ms-python.python",
47-
"ms-python.vscode-pylance"
17+
"streetsidesoftware.code-spell-checker"
4818
]
4919
}
5020
},
51-
21+
5222
// Use 'forwardPorts' to make a list of ports inside the container available locally.
5323
// "forwardPorts": [9000],
5424

55-
// Use 'portsAttributes' to set default properties for specific forwarded ports. More info: https://code.visualstudio.com/docs/remote/devcontainerjson-reference.
25+
// Use 'portsAttributes' to set default properties for specific forwarded ports.
26+
// More info: https://containers.dev/implementors/json_reference/#port-attributes
5627
"portsAttributes": {
5728
"9000": {
5829
"label": "Hello Remote World",
5930
"onAutoForward": "notify"
6031
}
6132
},
6233

63-
// Use 'otherPortsAttributes' to configure any ports that aren't configured using 'portsAttributes'.
64-
// "otherPortsAttributes": {
65-
// "onAutoForward": "silent"
66-
// },
67-
6834
// Use 'postCreateCommand' to run commands after the container is created.
69-
"postCreateCommand": "pip3 install -r requirements.txt",
35+
"postCreateCommand": "pip3 install -r requirements.txt"
7036

71-
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
72-
"remoteUser": "vscode"
37+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
38+
// "remoteUser": "root"
7339
}

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/vscode-remote-try-python)
44

5-
A **development container** is a running [Docker](https://www.docker.com) container with a well-defined tool/runtime stack and its prerequisites. You can try out development containers with **[GitHub Codespaces](https://github.com/features/codespaces)** or **[Visual Studio Code Dev Containers](https://aka.ms/vscode-remote/containers)**.
5+
A **development container** is a running container with a well-defined tool/runtime stack and its prerequisites. You can try out development containers with **[GitHub Codespaces](https://github.com/features/codespaces)** or **[Visual Studio Code Dev Containers](https://aka.ms/vscode-remote/containers)**.
66

77
This is a sample project that lets you try out either option in a few easy steps. We have a variety of other [vscode-remote-try-*](https://github.com/search?q=org%3Amicrosoft+vscode-remote-try-&type=Repositories) sample projects, too.
88

@@ -12,8 +12,9 @@ This is a sample project that lets you try out either option in a few easy steps
1212

1313
### GitHub Codespaces
1414
Follow these steps to open this sample in a Codespace:
15-
1. Click the Code drop-down menu and select the **Open with Codespaces** option.
16-
1. Select **+ New codespace** at the bottom on the pane.
15+
1. Click the **Code** drop-down menu.
16+
2. Click on the **Codespaces** tab.
17+
3. Click **Create codespace on main** .
1718

1819
For more information on creating your codespace, visit the [GitHub documentation](https://docs.github.com/en/free-pro-team@latest/github/developing-online-with-codespaces/creating-a-codespace#creating-a-codespace).
1920

@@ -41,13 +42,14 @@ Follow these steps to open this sample in a container using the VS Code Dev Cont
4142

4243
Once you have this sample opened, you'll be able to work with it like you would locally.
4344

44-
> **Note:** This container runs as a non-root user with sudo access by default. Comment out `"remoteUser": "vscode"` in `.devcontainer/devcontainer.json` if you'd prefer to run as root.
45-
4645
Some things to try:
4746

4847
1. **Edit:**
4948
- Open `app.py`
5049
- Try adding some code and check out the language features.
50+
- Make a spelling mistake and notice it is detected. The [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) extension was automatically installed because it is referenced in `.devcontainer/devcontainer.json`.
51+
- Also notice that utilities like `pylint` and the [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python) extension are installed. Tools are installed in the `mcr.microsoft.com/devcontainers/python` image and Dev Container settings and metadata are automatically picked up from [image labels](https://containers.dev/implementors/reference/#labels).
52+
5153

5254
2. **Terminal:**
5355
- Press <kbd>ctrl</kbd>+<kbd>shift</kbd>+<kbd>\`</kbd> to open a terminal window.
@@ -79,6 +81,13 @@ Some things to try:
7981
- Modify the `"onAutoForward"` attribute in your `portsAttributes` from `"notify"` to `"openBrowser"`.
8082
- Press <kbd>F1</kbd> and select the **Dev Containers: Rebuild Container** or **Codespaces: Rebuild Container** command so the modifications are picked up.
8183

84+
5. **Install Node.js using a Dev Container Feature:**
85+
- Press <kbd>F1</kbd> and select the **Dev Containers: Configure Container Features...** or **Codespaces: Configure Container Features...** command.
86+
- Type "node" in the text box at the top.
87+
- Check the check box next to "Node.js (via nvm) and yarn" (published by devcontainers)
88+
- Click OK
89+
- Press <kbd>F1</kbd> and select the **Dev Containers: Rebuild Container** or **Codespaces: Rebuild Container** command so the modifications are picked up.
90+
8291
### More samples
8392

8493
- [Tweeter App - Python and Django](https://github.com/Microsoft/python-sample-tweeterapp)

0 commit comments

Comments
 (0)