Skip to content
Branch: master
Find file History
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
.devcontainer Add less to definitions for git log Feb 6, 2020
.vscode Merge pull request #16 from Microsoft/python-tweaks Apr 23, 2019
test-project Make LICENSE a link so it can be clicked when used in projects Apr 25, 2019
.npmignore Image generation scipts Jan 14, 2020
README.md README.md tweaks Jan 28, 2020

README.md

Python 3

Summary

Develop Python 3 applications.

Metadata Value
Contributors The VS Code Python extension team
Definition type Dockerfile
Languages, platforms Python

Using this definition with an existing folder

While the definition itself works unmodified, there are some tips that can help you deal with some of common setup issues.

Debug Configuration

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.

"console": "integratedTerminal"

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.

"forwardPorts": [5000]

The appPort property publishes rather than forwards the port, so applications need to listen to * or 0.0.0.0 for the application to be accessible externally. This conflicts with the defaults of some Python frameworks, but fortunately the forwardPorts property does not have this limitation.

If you've already opened your folder in a container, rebuild the container using the Remote-Containers: Rebuild Container command from the Command Palette (F1) so the settings take effect.

Adding the definition to your folder

  1. If this is your first time using a development container, please follow the getting started steps to set up your machine.

  2. To use VS Code's copy of this definition:

    1. Start VS Code and open your project folder.
    2. Press F1 select and Remote-Containers: Add Development Container Configuration Files... from the command palette.
    3. Select the Python 3 definition.
  3. To use latest-and-greatest copy of this definition from the repository:

    1. Clone this repository.
    2. Copy the contents of containers/python-3/.devcontainer to the root of your project folder.
    3. Start VS Code and open your project folder.
  4. After following step 2 or 3, the contents of the .devcontainer folder in your project can be adapted to meet your needs.

  5. Finally, press F1 and run Remote-Containers: Reopen Folder in Container to start using the definition.

Testing the definition

This definition includes some test code that will help you verify it is working as expected on your system. Follow these steps:

  1. If this is your first time using a development container, please follow the getting started steps to set up your machine.
  2. Clone this repository.
  3. Start VS Code, press F1, and select Remote-Containers: Open Folder in Container...
  4. Select the containers/python-3 folder.
  5. After the folder has opened in the container, press F5 to start the project.
  6. You should see "Hello, remote world!" in a terminal window after the program executes.
  7. From here, you can add breakpoints or edit the contents of the test-project folder to do further testing.

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT License. See LICENSE

You can’t perform that action at this time.