Skip to content

pr-124/codepsace-template

Repository files navigation

Open in GitHub Codespaces

Python Codespace Template

Create or extend a ready-to-use repository for teaching Python in minutes

With this template repository you can quickly create a normalized environment to teach or learn Python. Make your students focus on learning rather than setting up their environment. This template uses Codespaces, a development environment that's hosted in the cloud with Visual Studio Code, a powerful text editor.

🤔 Curious? Watch the following video where we explain all the details:

Teaching Python with Codespaces

🎥 Watch the video tutorial to learn more about Codespaces

Codespaces Tutorial

🚀 Codespaces features:

  • Repeatable cloud environment offering a push-button experience.
  • Can be configured and customized.
  • Integrates with your repositories on GitHub and VSCode

As a teacher that means that you can create an environment, in the cloud, for your class that all students can use with zero or next to zero configuration regardless of what operating system they are using.

Customization

Customize your project for GitHub Codespaces by committing configuration files to your repository (often known as Configuration-as-Code), which creates a repeatable codespace configuration for all users of your project.

You can configure things like:

  • Extensions, you can specify what extensions should be preinstalled.
  • Dotfiles and settings.
  • Operating system libraries and dependencies

💡 Learn more about customization and configuration in the official documentation

Codespaces template

This repo is a GitHub template. It contains the following:

🔎 Found an issue or have an idea for improvement?

Help us make this template repository better by letting us know and opening an issue!.

🧐 Try it out

Try out this template repository using Codespaces following these steps:

  1. Create a repo from this template. Use this create repo link

  2. Navigate to the main page of the newly created repository.

  3. Under the repository name, use the Code drop-down menu, and in the Codespaces tab, select "Create codespace on main". Create codespace

  4. Creating codespace

    Creating codespace

Inspect your codespaces environment

What you have at this point is a pre-configured environment where all the runtimes and libraries you need are already installed - a zero config experience.

You also have a Jupyter Notebook that you can start using without any configuration.

This environment will run the same regardless of whether your students are on Windows, macOS or Linux.

Open up your Jupyter Notebook file example-notebook.ipynb and note how you can add code and run it.

Customize the Codespace

Let's make changes to your environment. We'll cover two different challenges that you are likely to want to do:

  1. Change the Python version installed
  2. Add an extension

Step 1: Change the Python environment

Let's say you want to change what version of Python is installed. This is something you can control.

Open .devcontainer/devcontainer.json and replace the following section:

"VARIANT": "3.8-bullseye"

with the following instruction:

"VARIANT": "3.9-bullseye"

this change will use Python 3.9 instead of 3.8.

Step 2: Add an extension

Your environment comes with preinstalled extensions. You can change which extensions your codespaces environment starts with, here's how:

  1. Open file .devcontainer/devcontainer.json and locate the following JSON element extensions:

    "extensions": [
     "ms-python.python",
     "ms-python.vscode-pylance"
    ]
  2. Add "ms-python.black-formatter" to the list of extensions. It should end up looking like the following:

    "extensions": [
     "ms-python.python",
     "ms-python.vscode-pylance",
     "ms-python.black-formatter"
    ]

    What you did above was to add the unique identifier of an extension of the Python Black Formatter extension. This will let Codespaces know that this extension should be pre-installed upon startup.

    Remainder: When you change any configuration on the json, a box will appear after saving.

    Reacreating codespace

    Click on rebuild. Wait for your codespace to rebuild the VS Code environment.

To find the unique identifier of an extension:

Learn more

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published