Package: beaver-build
Beaver is a minimal build system geared towards scientific programming and reproducibility. It uses thepython programming languageto express how transforms generate outputs from inputs. If you’re familiar with python, using Beaver couldn’t be easier, as we will demonstrate by example.# A simple example (saved as `beaver.py`) to generate `output.txt` with content `hello`.importbeaver_buildasbbtransform=bb.Shell(outputs="output.txt",inputs=None,cmd="echo hello > output.txt")Executing Beaver from the command line generates the desired output.$beaveroutput.txt🦫INFO:🟡artifacts[output.txt]arestale;scheduletransform🦫INFO:⚙️executeshellcommand`echohello>output.txt`🦫INFO:✅generatedartifacts[output.txt]$catoutput.txthelloThis seems like a convoluted way to writehellotooutput.txt. So what’s going on? The statementbb.Shell(...)defines aTransform <beaver_build.transforms.Transform>that generates theArtifact <beaver_build.artifacts.Artifact>output.txtby executing the shell commandecho hello > output.txt. Executingbeaver output.txtasks Beaver to generate the artifact–which it gladly does.Why should we care? Transforms can be chained by using the outputs of one as the inputs for another. Beaver ensures that all transforms are executed in the correct order and parallelizes steps where possible. These are of course the tasks of any build system, but Beaver’s unique selling points are (seeWhy not use …?for further details):users do not need to learn adomain-specific languagebut use flexible python syntax to create and chain transforms.new transforms can be implemented easily by inheriting fromTransform <beaver_build.transforms.Transform>and implementing theapply <beaver_build.transforms.Transform.apply>method.scheduling of operations is delegated to python’sasynciopackage which both minimizes the potential for bugs (compared with a custom implementation) and simplifies parallelization.defining artifacts and transforms as python objects allows for extensive introspection, such as visualization of the induceddirected acyclicbipartite graph.Other features include:incremental builds based on artifact digests–whether artifacts are files or not.Why not use …?antuses relatively verbose XML syntax and limited in its flexibility, e.g. transforms cannot be easily generated on the fly.bazelfocuses on speed and correctness–which it does extremely well. Bazel achieves these goals by“[taking] some power out of the hands of engineers”. This is a good compromise for production systems, but, for scientific applications, we want to retain a high degree of flexibility.makeis a trusted build tool, but Makefiles can quickly become complex andmodularizing is difficult.mavenis primarily Java focused and relies on conventions to generate artifacts. Well-established conventions are essential for software development, especially in large teams, but are often lacking in the context of investigating a new scientific problem.pydoituses standard python syntax to collect task metadata akin to test discovery inpytest. However,dodo.pyfiles are sometimes difficult to read because the code does not directly express the tasks to execute.snakemakeuses a non-standard python syntax, steepening the learning curve... toctree::
:hidden:

docs/interface