What
A convenience wrapper over pixi to create and manage mojo projects loosely based on the cargo api. Intended for maximum flexibility.
Why
This was created as a way to quickly make mojo projects to try out different ideas. It cuts down on the boilerplate of creating new projects and having to add different channels / setup the pixi-build-mojo backend and add some default tasks that I tend to copy around. Everything is 100% compatible with pixi.
Longer term, instead of shelling out to pixi I’d like to use the pixi-libs directly, either through FFI with Mojo, or by converting hat to rust.
Usage:
# Create a new binary project
hat new --name mojo-grep --nightly
# Create a new lib project
hat new --lib --nightly --name amazing-lib
# Build project (defaults to release build)
hat build
# Build with debug and asserts on
hat build --debug
# Test your project
hat test
Benefits for new-to-mojo people:
- Running
hat newwill create the project structure, but also install the deps, so when they open their editor, the LSP is available right away. I’ve had too many people not realize they needed to install the pixi deps then open the editor. - They don’t need to go chase down what channels are needed.
- The project structure is pre-templated. This is not a huge deal, but for some it will remove decision paralysis of where to put things and lets them just start coding.
- Test dir is created by default, lowering the barrier to just adding any tests.
- Projects that are buildable with
pixi-build-mojobackend can be depended on by git-paths and don’t need to be published to conda. This dramatically lowers the barrier to entry for people to get useful libs started before they start jumping through the hoops to publish conda packages.