Pyret is a programming language designed for computing education across many contexts, with a robust web-based runtime and programming environment to support broad access. Several curricula have been co-designed with Pyret at many levels.

Pyret in Action

This editor shows some sample programs from various curricula that you can try out directly on this page! For using Pyret with your students or on your own, check out Ways to Run Pyret.

Examples for:

Writing tests via examples (unit tests) is directly supported by the syntax and runtime of Pyret. No separate library or build file configuration needed, writing and running the tests come with writing and running a program.

Programs that create images give immediate visual feedback, and support learning outcomes around composition of values. Bootstrap:Algebra has lessons like Make a Flag and Hour of Code using these ideas.

Pyret's number system supports exact rational arithmetic for many operations. This avoids having floating point as a curricular dependency early on. When approximations become inevitable, they have an explicit representation: Roughnums.

Programs that create images give immediate visual feedback, and support learning outcomes around composition of values. Bootstrap:Algebra has lessons like Make a Flag and Hour of Code using these ideas.

Pyret reactors and images can be used to build physical simulations. These ideas are used in the Bootstrap:Physics curriculum, and they are supported by both language development and curricular research.

Writing tests via examples (unit tests) is directly supported by the syntax and runtime of Pyret. No separate library or build file configuration needed, writing and running the tests come with writing and running a program.

Pyret has algebraic data types and case matching in the style of most modern languages. Direct construction, along with built-in testing, make it straightforward to incrementally build up data structure definitions.

Programs that create images give immediate visual feedback, and support learning outcomes around composition of values. Bootstrap:Algebra has lessons like Make a Flag and Hour of Code using these ideas.

Writing tests via examples (unit tests) is directly supported by the syntax and runtime of Pyret. No separate library or build file configuration needed, writing and running the tests come with writing and running a program.

Pyret has algebraic data types and case matching in the style of most modern languages. Direct construction, along with built-in testing, make it straightforward to incrementally build up data structure definitions.

For K-12 Teachers

FILL all about bootstrap, one-click, web-based, CSP projects

For Undergraduate Instructors

FILL all about DCIC, one-click, no installation, pathway to Python, autograding, etc

For Developers

Visual Studio Code and Github

Pyret has a Visual Studio Code extension that opens files in the same visual editor as the examples above. It works in Github Codespaces, github.dev, and desktop Visual Studio Code.

Embedding Pyret

All the examples above embed an instace of Pyret through its embedding library. You can embed Pyret on your own websites and projects by installing that npm package, which has an API for controlling and listening to the embedded instance. You can embed from our copies of the compiler and runtime, or serve your own. No Pyret code runs on the server: it's strictly a bundle of client-side HTML, CSS, and JavaScript (we've done a little bit of engineering in this space to make this possible).

Command-line Pyret

Pyret runs from the command line via the pyret-npm package. Nearly all libraries (including images) run the same offline and in-browser. This can be especially important for grading student code submissions in an automated way. THIS DOCUMENT (fill) says more about it.

Programming Assignments and Starter Code

Pyret has specific libraries and features (FILL: url-file tutorial, Github example) for creating and deploying starter code for students seamlessly. We developed these features and workflows in our own courses, with our own TAs, and for our own curricula.