Skip to content
entangledPublic

Repository files navigation

Brei.rs

Brei is a small workflow system: a replacement for GNU Make, for systems that don't have it. This is the Rust version of Brei, which was written in Python. It reads the same workflows, with a few differences.

The documentation is at entangled.github.io/brei.rs. Brei.rs is a literate program, so this is also the source code.

[[task]]
description = "Greet the Globe"
stdout = "hello.txt"
script = "echo 'Hello, World!'"
  • No new syntax: workflows are TOML, YAML or JSON files.
  • Tasks run lazily and in parallel.
  • Templates, variables, includes and configurable runners.
  • A single executable, with no dependencies.

Brei was developed as part of the Entangled project, for small automations in literate programming, like generating figures. For anything bigger, use a more established tool.

Installing

Brei is a single binary, with nothing else to install. On Linux it is linked statically, so it runs on any distribution.

Install the latest release with:

# Linux, macOS
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/entangled/brei.rs/releases/latest/download/brei-installer.sh | sh
# Windows
powershell -ExecutionPolicy Bypass -c "irm https://github.com/entangled/brei.rs/releases/latest/download/brei-installer.ps1 | iex"

These put brei in ~/.local/bin (or $XDG_BIN_HOME, if you set it), and add that to your PATH if needed. To put it somewhere else, download the archive for your platform from the releases page, and copy brei (or brei.exe) to any directory on your PATH.

With Rust, you can also build it from source:

cargo install brei

Usage

Brei reads brei.toml, brei.yaml, brei.yml, or the [tool.brei] section of pyproject.toml, whichever it finds first. Use -i to read another file.

brei all                         # build the task named `all`
brei -i examples/rot13.toml all  # read the workflow from another file
brei -j 4 -k all                 # four jobs at a time, keep going after a failure
brei --list-runners

A task runs when one of its targets is missing, older than one of its dependencies, or made by a different version of its script. Brei keeps that history in .brei_history.

Development

Brei.rs is a literate program: the source is the book in docs/src/, and the Rust files in src/ are generated from it with Entangled. While Entangled is watching, you can edit either the Markdown or the Rust files, and the changes go both ways:

uv run entangled watch
  • Tests: cargo test. Some tests compare with Python Brei, and need python and git.
  • Book: mdbook build docs (or mdbook serve docs). It builds brei, and runs the examples marked eval to show their output.
  • Coverage: brei coverage, with Brei's own workflow in brei.toml. It needs jq and rustup component add llvm-tools, and puts the HTML report in the book.

License

Apache License 2.0, see LICENSE.

Use of generative AI

Significant parts of this port were done by Claude Opus 5.5, a large language model by Anthropic, under the direction of the author. See the statement in the book for details.

Releases

Packages

Contributors

Languages