Traditionally, there is considerable friction for developers when setting up development environments

Overview

Table of Contents

I. Overview
   A. Why you care
   B. What you will learn
II. How this training is structured
III. Requirements
IV. Overview of Development containers, GitHub Codespaces And Visual Studio Code
   A. Development Container
   B. Visual Studio Code
   C. GitHub Codespaces
V. Challenges
   A. Challenge1
   B. Challenge2
   C. Challenge3
   D. Challenge4
   E. Challenge5

Overview

Why you care

Traditionally, there is considerable friction for developers when setting up development environments. It is not uncommon for devs new to projects to spend days updating their environment before being able to start contributing to the project.

The more complex the requirements, the greater the friction. Consider the following 2 examples:

  1. Configuring a local Kubernetes development environment with the following:
  • Grafana
  • Prometheus
  • Fluentbit
  1. A Python API with:
  • The current version of Python
  • Debugging configured
  • Pytest
  • Flask

The above are 2 very real examples. The Retail Dev Crew team in CSE has been working with some of the largest Kubernetes deployments in the world. The dev environment includes everything listed above in example #1 plus much more. Despite the complex dev environment, the team prides itself upon new devs creating a PR on their first day. This is only possible because the Retail Dev Crew's use of development containers and GitHub Codespaces.

Python environments are notoriously challenging to configure. This is especially true with regard to debugging.

A large blocker to contributing to OSS projects is configuring the development environment. Imagine being able to instantiate a fully-configured development environment with the click of a button. That is the promise of development containers and GitHub Codespaces.

What you will learn

If you complete this self-directed training, you will:

  • Learn what development containers are
  • Learn what GitHub Codespaces are
  • Understand the relationship between Visual Studio Code, development containers and GitHub Codespaces
  • Learn how to build devcontainers
    • Using an existing docker image
    • Using the commands
      • onCreateCommand
      • postCreateCommand
      • postStartCommand
    • Creating a custom docker image
    • Updating the developer experience
      • Installing extensions
      • dotfiles
  • Patterns and best practices working with development containers and GitHub Codespaces

How this training is structured

This GitHub repository has a master branch and a collection of solution branches.

The master branch contains the following:

  • Readme.md - The main training file. Start here.
  • Challenges/* - The challenge files for this training. Each Challenge file will contain some learnings/background on the challenge, the challenge itself and, optionally, some helpful hints.
  • api/math_api.py - A very simple python Flask REST API
  • tests/api/test_math_api.py - Pytest unit tests
  • requirements.txt and dev_requirements.txt - Python requirements files contining the dependencies for the application and application development environment
  • math.http - A manual test file for use in Challenge 5

Each challenge has its own solution branch. Use your git client to open each Solution branch. For example:

git checkout Solution1

Each branch contains the following:

  • Solution(1-N).md - File describing the solution. This file may also contain a "From the Field" section where we list some of the learnings the CSE Retail Dev Crews team has had working with GitHub codespaces with our largest customers
  • The solution configured in the .devcontainer folder
  • Solution(1-N).mp4 - A video outlining a solution to the challenge. Open the videos from the file system, not Visual Studio Code

Requirements

You will need the following to complete the development container challenges in this training (see detailed installation instructions here):

  • Docker for Windows/Mac/Linux
  • Visual Studio Code

You will need to be enabled for GitHub Codespaces in order to complete the codespaces challenges. (see documentation here about getting access to Codespaces)

Overview of Development containers, GitHub Codespaces And Visual Studio Code

The goal of these technologies is to allow developers to define a fully-configured development environment, run it in a container and develop against it with Visual Studio Code running as a client application or running in the browser. This section will provide a high-level overview of these technologies and how they interrelate. You will find links to more information throughout this section.

Development Container

As noted above, a development container is a fully-featured development environment running in a container. The development container is a Docker container running locally or remotely that, at a high-level, contains the following:

  • All the application dependencies - Defined in a Docker image, Dockerfile or docker-compose file and potentially updated via scripts called by well-defined hooks.
  • The application code - mounted, copied or cloned into the container
  • Visual Studio Code Server - configured with the appropriate Visual Studio Code Extensions required to develop

Default Images can be used for general development. However, for a more productive development experience, you will likely want to define your own development containers. The configuration for the development container is in a devcontainer.json file which exists either at the root of the project or under a .devcontainer folder at the root. From the field: We always put the devcontainer.json file under a .devcontainer folder. We do that because we always have additional files that accompany the devcontainer.json file. These files include bash scripts and a Dockerfile. We will get into more details about these files later. During the challenges in this training you will explore and learn the common configuration patterns in a devcontainer.json file. For the time being, we will show you a very simple example of a devcontainer.json file taken from the documentation:

{
  "image": "mcr.microsoft.com/vscode/devcontainers/typescript-node:0-12",
  "forwardPorts": [3000],
  "extensions": ["dbaeumer.vscode-eslint"]
}

Again, we will explore each of the above in more detail in the challenges. For now, it is enough to understand that the devcontainer.json points to an existing typescript-node image. This is the image that will be used when starting the developer (Docker) container. The configuration further specifies that port 3000 should be forwarded from the container to the host. Lastly, it specifies that a linting extension should be installed in the VS Code Server running in the developer container.

Visual Studio Code

Visual Studio Code has a Remote-Containers Extension that enables the use of a Docker container as a fully configured development environment. This is enabled through a client-server architecture. As noted above, running development containers have a Visual Studio Code Server running in them. The Visual Studio Code Client can access a running container or can create an instance of a new development container and connect to it.

The challenges will mainly be using Visual Studio Code to create and run development containers.

GitHub Codespaces

GitHub Codespaces enables exposing a fully configured development environment for GitHub repositories. This can be used for anthing from new feature development to code reviews. Codespaces extends the use of development containers by providing a remote hosting environment for them. Developers can simply click on a button in GitHub to open a Codespace for the repo. Behind the scenes, GitHub Codespaces is:

  • Spinning up a VM
  • Shallow cloning the repo in that VM. The shallow clone pulls the devcontainer.json onto the VM
  • Spins up the development container on the VM
  • Clones the repository in the development container
  • Connects you to the remotely hosted development container - via the browser or GitHub

The Challenges - Building a Devcontainer

The challenges below are designed to provide a stepwise approach to building development containers. They start with the simplist approach, with each subsequent challenge teaching you a further aspect. Throughout the challeges, we will be providing real-world guidance that we have learned working with real customers in the field.

Owner
CSE Labs at Spark
CSE Labs at Spark
pspsps(1) is a compyuter software to call an online catgirl to the Linux terminyal.

pspsps(1): call a catgirl from the Internyet to the Linux terminyal show processes: ps show catgirls: pspsps —@ Melissa Boiko 32 Dec 19, 2022

Remove Sheet Protection from .xlsx files. Easily.

🔓 Excel Sheet Unlocker Remove sheet protection from .xlsx files. How to use Run Run the script/packaged executable from the command line. Universal u

Daniel 3 Nov 16, 2022
Automatically remove user join messages when the user leaves the server.

CleanLeave Automatically remove user join messages when the user leaves the server. Installation You will need to install poetry to run this bot local

11 Sep 19, 2022
A male and female dog names python package

A male and female dog names python package

Fayas Noushad 3 Dec 12, 2021
Sodium is a general purpose programming language which is instruction-oriented

Sodium is a general purpose programming language which is instruction-oriented (a new programming concept that we are developing and devising)

Satin Wuker 22 Jan 11, 2022
Dot Browser is a privacy-conscious web browser with smarts built-in for protection against trackers and advertisments online.

🌍 Take back your privacy with Dot Browser, the privacy-conscious web browser that protects you from being tracked and monitored online.

Dot HQ 1k Jan 07, 2023
Materials for the Introduction in Python , Linux , Git and Github

This repository contains all the materials of the presentation on the introduction of python, linux, git and Github.

AMMI 3 Aug 28, 2022
A Python script made for the Python Discord Pixels event.

Python Discord Pixels A Python script made for the Python Discord Pixels event. Usage Create an image.png RGBA image with your pattern. Transparent pi

Stanisław Jelnicki 4 Mar 23, 2022
CuraMultiplyByGrid - Cura Плагин для размножения детали сеткой на весь стол автоматически без поворота

CuraMultiplyByGrid Cura Плагин для размножения детали сеткой на весь стол автоматически без поворота. Размножение в куре настолько ужасно реализовано,

3 Dec 02, 2022
Sacred is a tool to help you configure, organize, log and reproduce experiments developed at IDSIA.

Sacred Every experiment is sacred Every experiment is great If an experiment is wasted God gets quite irate Sacred is a tool to help you configure, or

IDSIA 4k Jan 02, 2023
A clipboard where a user can add and retrieve multiple items to and from (resp) from the clipboard cache.

A clipboard where a user can add and retrieve multiple items to and from (resp) from the clipboard cache.

Gaurav Bhattacharjee 2 Feb 07, 2022
creates a batch file that uses adb to auto-install apks into the Windows Subsystem for Android and registers it as the default application to open apks.

wsa-apktool creates a batch file that uses adb to auto-install apks into the Windows Subsystem for Android and registers it as the default application

Aditya Vikram 3 Apr 05, 2022
A Puzzle A Day Keep the Work Away

A Puzzle A Day Keep the Work Away No moyu again!

P4SSER8Y 5 Feb 12, 2022
Open Source defrag's mod code

Open Source defrag's mod code Goals: Code & License: Respect FOSS philosophy. Open source and community focus. Eliminate all traces of q3a-sdk licensi

sOkam! 1 Dec 10, 2022
The functions we created are included in a script. The necessary parts for pre-processing were taken. Analysis complete.

Feature-Engineering The functions we created are included in a script. The necessary parts for pre-processing were taken. Analysis complete. Business

Ayşe Nur Türkaslan 4 Oct 17, 2021
Windows symbol tables for Volatility 3

Windows Symbol Tables for Volatility 3 This repository is the Windows Symbol Table storage for Volatility 3. How to Use $ git clone https://github.com

JPCERT Coordination Center 31 Dec 25, 2022
WMIC Serial Checker For Python

WMIC Serial Checker Follow me here: Discord | Github FR: A but éducatif seulement. EN: For educational purposes only. ❓ Informations FR: WMIC Serial C

AkaTool's 0 Apr 25, 2022
Python meta class and abstract method library with restrictions.

abcmeta Python meta class and abstract method library with restrictions. This library provides a restricted way to validate abstract methods. The Pyth

Morteza NourelahiAlamdari 8 Dec 14, 2022
Python Service for MISP Feed Management

Python Service for MISP Feed Management This set of scripts is designed to offer better reliability and more control over the fetching of feeds into M

Chris 7 Aug 24, 2022
WhyNotWin11 - Detection Script to help identify why your PC isn't Windows 11 Release Ready

WhyNotWin11 - Detection Script to help identify why your PC isn't Windows 11 Release Ready

Robert C. Maehl 5.9k Dec 31, 2022