lib50

lib50 is CS50’s library for common functionality shared between its tools. The library is, like most of CS50’s projects, open-source, but its intention is to serve as an internal library for CS50’s own tools. As such it is our current recommendation to not use lib50 as a dependency of one’s own projects.

The following concepts live primarily in lib50:

  • CS50 slugs

  • git

  • GitHub

  • .cs50.yml config files

  • signing and verification of payloads

Design

To promote reuse of functionality across CS50 tools, lib50 is designed to be tool agnostic. lib50 provides just the core functionality, but the semantics of that functionality are left up to the tool. For instance, submit50 adds the notion of a submission to a push, whereas it is the lib50.push function that ultimately handles the workflow with git and GitHub. Or per another example, lib50 provides the functionality to parse and validate .cs50.yml configuration files, but each individual tool (check50, submit50 and lab50) specifies their own options and handles their own logic.

With the overarching design goal to make it easy to add to or to change implementation choices, lib50 abstracts away from implementation details for other CS50 tools. Concepts such as slugs, git, GitHub, and .cs50.yml live only in lib50. Tools such as check50 interact only with lib50’s API at a higher level of abstraction, such as lib50.push and lib50.config.Loader. The idea being, that there is now a single point of change. For instance, one could add support for another host, such as GitLab perhaps, to lib50.push and all of CS50’s tools could instantly make use of the new host.

Installation

First make sure you have Python 3.6 or higher installed. You can download Python here.

lib50 has a dependency on git, please make sure to install git if git is not already installed.

To install lib50 under Linux / OS X:

pip install lib50

Under Windows, please install the Linux subsystem. Then install lib50 within the subsystem.