A starter Python project configured for GitHub Codespaces. This repository includes a development container configuration that provides a consistent Python development environment.
Note: If you already have a codespace open, you can jump to the Things to try section.
Follow these steps to open this project in a Codespace:
- Click the Code drop-down menu.
- Click on the Codespaces tab.
- Click Create codespace on main.
For more information on creating your codespace, visit the GitHub documentation.
Dependencies from requirements.txt are installed automatically when the codespace is created.
If you already have VS Code and Docker installed, you can use the Dev Containers extension:
-
If this is your first time using a development container, please ensure your system meets the prerequisites (i.e. have Docker installed) in the getting started steps.
-
Clone this repository to your local filesystem.
-
Press
F1and select the Dev Containers: Open Folder in Container... command. -
Select the cloned copy of this folder, wait for the container to start, and try things out!
Once you have this project opened in a codespace or dev container, you'll be able to work with it like you would locally.
Some things to try:
- Open
src/main.py - Try adding some code and check out the language features.
- Notice that utilities like the Python extension and Pylance are installed. These extensions are automatically installed because they are referenced in
.devcontainer/devcontainer.json.
-
Press
Ctrl+Shift+\`` (orCmd+Shift+`` on Mac) to open a terminal window. -
Run the application:
python -m src.main
Or:
python src/main.py
-
You should see the output:
Hello from Python Codespace!
- Open
src/main.py - Add a breakpoint (e.g., on line 2 inside the
main()function). - Press
F5to launch the app in the container. - Once the breakpoint is hit, try hovering over variables, examining locals, and more.
- Edit
requirements.txtto add Python packages you need. - Rebuild your container for the changes to take effect:
- Press
F1and select Dev Containers: Rebuild Container or Codespaces: Rebuild Container.
- Press
.
├── .devcontainer/
│ └── devcontainer.json # Dev container configuration
├── src/
│ ├── __init__.py # Package initialization
│ └── main.py # Main entry point
├── requirements.txt # Python dependencies
├── .gitignore # Git ignore rules
└── README.md # This file