# Teaching Python with Codespaces

DevFeed: [Teaching Python with Codespaces](<https://devfeed.tech/articles/teaching-python-with-codespaces-21735.md>)

Original publisher: [Read original article](<http://blog.pamelafox.org/2025/06/teaching-python-with-codespaces.html>)

Author: Pamela Fox (noreply@blogger.com)

Published: 2025-06-01T15:14:00Z

Content type: tutorial

Language: en

Sources: [Pamela Fox](<https://devfeed.tech/sources/pamela-fox.md>)

Topics: [Python](<https://devfeed.tech/topics/python.md>), [GitHub](<https://devfeed.tech/topics/github.md>), [Development](<https://devfeed.tech/topics/development.md>), [configuration](<https://devfeed.tech/topics/configuration.md>), [vs-code](<https://devfeed.tech/topics/vs-code.md>), [Docker](<https://devfeed.tech/topics/docker.md>), [Docker Image](<https://devfeed.tech/topics/docker-image.md>), [Dockerfile](<https://devfeed.tech/topics/dockerfile.md>)

Tags: [configuration](<https://devfeed.tech/tags/configuration.md>), [docker](<https://devfeed.tech/tags/docker.md>), [github](<https://devfeed.tech/tags/github.md>), [python](<https://devfeed.tech/tags/python.md>), [tutorials](<https://devfeed.tech/tags/tutorials.md>), [vs-code](<https://devfeed.tech/tags/vs-code.md>), [vscode](<https://devfeed.tech/tags/vscode.md>)

## AI overview

A tutorial on using GitHub Codespaces to teach Python, including browser-based VS Code environments and dev container configurations. It covers simple devcontainer.json files, Python-specific images, custom Dockerfiles, and Docker-based project setup for web app, data science, and generative AI classes.

## Source excerpt

Whenever I am teaching Python workshops, tutorials, or classes, I love to use GitHub Codespaces. Any repository on GitHub can be opened inside a GitHub Codespace, which gives the student a full Python environment and a browser-based VS Code. Students spend less time setting up their environment and more time actually coding - the fun part! In this post, I'll walk through my tips for using Codespaces for teaching Python, particularly for classes about web apps, data science, or generative AI. Getting started You can start a GitHub Codespace from any repository. Navigate to the front page of the repository, then select "Code" > "Codespaces" > "Create codespace on main": By default, the Codespace will build an environment based off a universal Docker image, which includes Python, NodeJS, Java, and other popular languages. But what if you want more control over the environment? Dev Containers A dev container is an open specification for describing how a project should be opened in a development environment, and is supported by several IDEs, including GitHub Codespaces and VS Code (via Dev Containers extension). To define a dev container for your repository, add a devcontainer.json that describes the desired Docker image, VS Code extensions, and project settings. Let's look at a few examples, from simple to complex. A simple dev container configuration The simplest devcontainer.json specifies a Docker image, like from Docker Hub or the Microsoft Artifact Registry. Microsoft provides several Python-specific images optimized for dev containers. For example, my python-3.13-playground repository sets up Python 3.13 using one of those images, and also configures a few settings and default extensions: { "name": "Python 3.13 playground", "image": "mcr.microsoft.com/devcontainers/python:3.13-bullseye", "customizations": { "vscode": { "settings": { "python.defaultInterpreterPath": "/usr/local/bin/python", "python.linting.enabled": true }, "extensions": [ "ms-python.python", "ms-p