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

Commit 220ada3

Browse files
authored
Merge pull request #16 from Microsoft/python-tweaks
Updated Python READMEs, test projects to match others
2 parents 06cb262 + a1a2f02 commit 220ada3

File tree

13 files changed

+211
-55
lines changed

13 files changed

+211
-55
lines changed

containers/python-2/.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"version": "0.2.0",
66
"configurations": [
77
{
8-
"name": "Python: Current File (Integrated Terminal)",
8+
"name": "Python (Integrated Terminal)",
99
"type": "python",
1010
"request": "launch",
11-
"program": "${file}",
11+
"program": "${workspaceFolder}/test-project/hello.py",
1212
"console": "integratedTerminal"
1313
}
1414
]

containers/python-2/README.md

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,50 @@
66

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

13-
## Usage
13+
## Using this definition with an existing folder
1414

15-
[See here for information on using this definition with an existing project](https://aka.ms/vscode-remote/containers/getting-started/open).
15+
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.
1616

17-
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.
17+
```json
18+
"console": "integratedTerminal"
19+
```
1820

19-
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.
21+
Beyond that, just follow these steps:
22+
23+
1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine.
24+
25+
2. To use VS Code's copy of this definition:
26+
1. Start VS Code and open your project folder.
27+
2. Press <kbd>F1</kbd> select and **Remote-Containers: Create Container Configuration File...** from the command palette.
28+
3. Select the Python 2 definition.
29+
30+
3. To use latest-and-greatest copy of this definition from the repository:
31+
1. Clone this repository.
32+
2. Copy the contents of `containers/python-2/.devcontainer` to the root of your project folder.
33+
3. Start VS Code and open your project folder.
34+
35+
4. After following step 2 or 3, the contents of the `.devcontainer` folder in your project can be adapted to meet your needs.
36+
37+
5. Finally, press <kbd>F1</kbd> and run **Remote-Containers: Reopen Folder in Container** to start using the definition.
38+
39+
## Testing the definition
40+
41+
This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps:
42+
43+
1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine.
44+
2. Clone this repository.
45+
3. Start VS Code, press <kbd>F1</kbd>, and select **Remote-Containers: Open Folder in Container...**
46+
4. Select the `containers/python-2` folder.
47+
5. After the folder has opened in the container, press <kbd>F5</kbd> to start the project.
48+
6. You should see "Hello, remote world!" in a terminal window after the program executes.
49+
7. From here, you can add breakpoints or edit the contents of the `test-project` folder to do further testing.
2050

2151
## License
2252

2353
Copyright (c) Microsoft Corporation. All rights reserved.
2454

25-
Licensed under the MIT License. See [LICENSE](https://github.com/Microsoft/vscode-dev-containers/blob/master/LICENSE).
55+
Licensed under the MIT License. See [LICENSE](https://github.com/Microsoft/vscode-dev-containers/blob/master/LICENSE)

containers/python-3-anaconda/.vscode/launch.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
"version": "0.2.0",
66
"configurations": [
77
{
8-
"name": "Python: Current File (Integrated Terminal)",
8+
"name": "Python (Integrated Terminal)",
99
"type": "python",
1010
"request": "launch",
11-
"program": "${file}",
11+
"program": "${workspaceFolder}/test-project/hello.py",
12+
"cwd":"${workspaceFolder}/test-project",
1213
"console": "integratedTerminal"
1314
}
1415
]

containers/python-3-anaconda/README.md

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,52 @@
66

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

13-
## Usage
13+
## Using this definition with an existing folder
1414

15-
[See here for information on using this definition with an existing project](https://aka.ms/vscode-remote/containers/getting-started/open).
15+
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.
1616

17-
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.
17+
```json
18+
"console": "integratedTerminal"
19+
```
1820

19-
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.
21+
Beyond that, just follow these steps:
2022

21-
Then, open test-project/hello.py and press shift-enter to run the cell and see the interactive matplotlib output.
23+
1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine.
24+
25+
2. To use VS Code's copy of this definition:
26+
1. Start VS Code and open your project folder.
27+
2. Press <kbd>F1</kbd> select and **Remote-Containers: Create Container Configuration File...** from the command palette.
28+
3. Select the Python 3 - Anaconda definition.
29+
30+
3. To use latest-and-greatest copy of this definition from the repository:
31+
1. Clone this repository.
32+
2. Copy the contents of `containers/python-3-anaconda/.devcontainer` to the root of your project folder.
33+
3. Start VS Code and open your project folder.
34+
35+
4. After following step 2 or 3, the contents of the `.devcontainer` folder in your project can be adapted to meet your needs.
36+
37+
5. Finally, press <kbd>F1</kbd> and run **Remote-Containers: Reopen Folder in Container** to start using the definition.
38+
39+
## Testing the definition
40+
41+
This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps:
42+
43+
1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine.
44+
2. Clone this repository.
45+
3. Start VS Code, press <kbd>F1</kbd>, and select **Remote-Containers: Open Folder in Container...**
46+
4. Select the `containers/python-3-anaconda` folder.
47+
5. After the folder has opened in the container, press <kbd>F5</kbd> to start the project.
48+
6. A `test-project/plot.png` file should be added to the folder after it runs with the plot result.
49+
7. Next, open `test-project/hello.py` and press <kbd>ctrl/cmd</kbd>+<kbd>a</kbd> then <kbd>shift</kbd>+<kbd>enter</kbd>.
50+
8. You should see the `matplotlib` output in the interactive window.
51+
9. From here, you can add breakpoints or edit the contents of the `test-project` folder to do further testing.
2252

2353
## License
2454

2555
Copyright (c) Microsoft Corporation. All rights reserved.
2656

27-
Licensed under the MIT License. See [LICENSE](https://github.com/Microsoft/vscode-dev-containers/blob/master/LICENSE).
57+
Licensed under the MIT License. See [LICENSE](https://github.com/Microsoft/vscode-dev-containers/blob/master/LICENSE)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
plot.png

containers/python-3-anaconda/test-project/hello.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@
1414
title='About as simple as it gets, folks')
1515
ax.grid()
1616

17-
fig.savefig("test.png")
18-
plt.show()
17+
fig.savefig("plot.png")
18+
plt.show()
19+
20+
print('Open test-project/plot.png to see the result!')

containers/python-3-miniconda/.vscode/launch.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
"version": "0.2.0",
66
"configurations": [
77
{
8-
"name": "Python: Current File (Integrated Terminal)",
8+
"name": "Python (Integrated Terminal)",
99
"type": "python",
1010
"request": "launch",
11-
"program": "${file}",
11+
"program": "${workspaceFolder}/test-project/hello.py",
12+
"cwd":"${workspaceFolder}/test-project",
1213
"console": "integratedTerminal"
1314
}
1415
]

containers/python-3-miniconda/README.md

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,54 @@
66

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

13-
## Usage
13+
## Using this definition with an existing folder
1414

15-
[See here for information on using this definition with an existing project](https://aka.ms/vscode-remote/containers/getting-started/open).
15+
First, for convenience, this definition will automatically install dependencies from your `environment.yml` file when the container is built. However, note that `environment.yml` in the root of this definition folder is **only present for testing** and is not used or required by the definition itself.
1616

17-
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.
17+
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.
1818

19-
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.
19+
```json
20+
"console": "integratedTerminal"
21+
```
2022

21-
Then, open test-project/hello.py and press shift-enter to run the cell and see the interactive matplotlib output.
23+
Beyond that, just follow these steps:
24+
25+
1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine.
26+
27+
2. To use VS Code's copy of this definition:
28+
1. Start VS Code and open your project folder.
29+
2. Press <kbd>F1</kbd> select and **Remote-Containers: Create Container Configuration File...** from the command palette.
30+
3. Select the Python 3 - Miniconda definition.
31+
32+
3. To use latest-and-greatest copy of this definition from the repository:
33+
1. Clone this repository.
34+
2. Copy the contents of `containers/python-3-miniconda/.devcontainer` to the root of your project folder.
35+
3. Start VS Code and open your project folder.
36+
37+
4. After following step 2 or 3, the *only* the contents of the `.devcontainer` folder in your project can be adapted to meet your needs. Ignore other files and folders.
38+
39+
5. Finally, press <kbd>F1</kbd> and run **Remote-Containers: Reopen Folder in Container** to start using the definition.
40+
41+
## Testing the definition
42+
43+
This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps:
44+
45+
1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine.
46+
2. Clone this repository.
47+
3. Start VS Code, press <kbd>F1</kbd>, and select **Remote-Containers: Open Folder in Container...**
48+
4. Select the `containers/python-3-miniconda` folder.
49+
5. After the folder has opened in the container, press <kbd>F5</kbd> to start the project.
50+
6. A `test-project/plot.png` file should be added to the folder after it runs with the plot result.
51+
7. Next, open `test-project/hello.py` and press <kbd>ctrl/cmd</kbd>+<kbd>a</kbd> then <kbd>shift</kbd>+<kbd>enter</kbd>.
52+
8. You should see the `matplotlib` output in the interactive window.
53+
9. From here, you can add breakpoints or edit the contents of the `test-project` folder to do further testing.
2254

2355
## License
2456

2557
Copyright (c) Microsoft Corporation. All rights reserved.
2658

27-
Licensed under the MIT License. See [LICENSE](https://github.com/Microsoft/vscode-dev-containers/blob/master/LICENSE).
59+
Licensed under the MIT License. See [LICENSE](https://github.com/Microsoft/vscode-dev-containers/blob/master/LICENSE)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
plot.png

containers/python-3-miniconda/test-project/hello.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@
1414
title='About as simple as it gets, folks')
1515
ax.grid()
1616

17-
fig.savefig("test.png")
18-
plt.show()
17+
fig.savefig("plot.png")
18+
plt.show()
19+
20+
print('Open test-project/plot.png to see the result!')

0 commit comments

Comments
 (0)