No project description provided
Project description
moso
moso provides a %%moso cell magic that lets you build up a Mojo
program across multiple notebook cells. All %%moso cells are
collected, compiled, and run together as a single Mojo script. The last
collected cell is wrapped in def main() raises:.
moso primarily supports SolveIt (from Answer.ai) because it allows the
tool to identify which cell is currently executing. In a standard
Jupyter Notebook environment, the magic simply collects all cells
containing %%moso.
Install
pip install -e .
Usage
SolveIt
from moso.core import *
setup_moso()
Jupyter Notebook
from moso.core import *
setup_moso(nb_path='path/to/your/notebook.ipynb')
Then write Mojo code in %%moso cells:
%%moso
def add(a: Int, b: Int) -> Int:
return a + b
%%moso
print(add(40, 2))
Remote execution
Pass an SSH host and command template if Mojo runs on another machine:
setup_moso(host="user@host", cmd="cd ~/mojo-gpu-puzzles && /root/.pixi/bin/pixi run mojo run {path}")
How it works
filter_moso
strips the %%moso lines, concatenates previous cells, and wraps the
current cell in a main() (or the last cell in standard Jupyter
Notebook).
setup_moso
registers the IPython cell magic and runs the generated source either
locally or over SSH.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file moso-0.0.1.tar.gz.
File metadata
- Download URL: moso-0.0.1.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21dccb3c4bff876715d6d1dce6a59d3e5df1eb1e11c24ad2d5559cdb9187a2f7
|
|
| MD5 |
fa9aa1a06148cdbc061f0c7b1fb5514a
|
|
| BLAKE2b-256 |
8ff8def48c6d272b55897207c8f3794a067e2ce97494320d269f42f5d53787f0
|
File details
Details for the file moso-0.0.1-py3-none-any.whl.
File metadata
- Download URL: moso-0.0.1-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2459c2ece7fa24484d22116987dabafa65c4e31d428bbfa056d2a25ae95115c8
|
|
| MD5 |
39925dd75916271b531e280899c2ec0f
|
|
| BLAKE2b-256 |
eabb125f55ca8898a259af67fb537d7596566f0aadf6ace644784efb7848e921
|