diff --git a/.github/workflows/ci-notebooks.yml b/.github/workflows/ci-notebooks.yml index 879e9e0ad5..1386ac9da5 100644 --- a/.github/workflows/ci-notebooks.yml +++ b/.github/workflows/ci-notebooks.yml @@ -34,3 +34,6 @@ jobs: run: | # mlir_interoperation.ipynb is dependent on MLIR, and is tested in the MLIR-enabled workflow. pytest -W error --nbval -vv docs --ignore=docs/mlir_interoperation.ipynb + - name: Test marimo notebooks + run: | + make tests-marimo diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8f593cbf8c..72ba463eef 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,4 +19,4 @@ repos: rev: 24.2.0 hooks: - id: black - exclude: "/(__pycache__|.asv|venv|build|tests/filecheck)/|versioneer.py$|xdsl/_version.py$" + exclude: "/(__pycache__|.asv|venv|build|tests/filecheck)/|versioneer.py$|xdsl/_version.py$|docs/marimo" diff --git a/Makefile b/Makefile index 4bc2b26b01..d368a94ea8 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ TESTS_COVERAGE_FILE = ${COVERAGE_FILE}.tests .ONESHELL: # these targets don't produce files: -.PHONY: ${VENV_DIR}/ venv clean filecheck pytest pytest-nb tests-toy tests rerun-notebooks precommit-install precommit black pyright +.PHONY: ${VENV_DIR}/ venv clean filecheck pytest pytest-nb tests-toy tests rerun-notebooks precommit-install precommit black pyright tests-marimo .PHONY: coverage coverage-tests coverage-filecheck-tests coverage-report-html coverage-report-md # set up the venv with all dependencies for development @@ -51,8 +51,15 @@ pytest-toy: tests-toy: filecheck-toy pytest-toy +tests-marimo: + @for file in docs/marimo/*.py; do \ + echo "Running $$file"; \ + python3 "$$file" || exit 1; \ + done + @echo "All marimo tests passed successfully." + # run all tests -tests: pytest tests-toy filecheck pytest-nb pyright +tests: pytest tests-toy filecheck pytest-nb tests-marimo pyright @echo All tests done. # re-generate the output from all jupyter notebooks in the docs directory diff --git a/docs/marimo/IR_Chapter_1_Attributes.py b/docs/marimo/IR_Chapter_1_Attributes.py new file mode 100644 index 0000000000..38b88036be --- /dev/null +++ b/docs/marimo/IR_Chapter_1_Attributes.py @@ -0,0 +1,27 @@ +import marimo + +__generated_with = "0.6.10" +app = marimo.App() + + +@app.cell +def __(): + import marimo as mo + return mo, + + +@app.cell +def __(mo): + from xdsl.dialects.builtin import IntAttr + + mo.md(f""" + # IR Chapter 1: Attributes + + In xDSL, Attributes carry information known at compile time. + For example, `{IntAttr.__name__}` is an attribute representing an integer. + """) + return IntAttr, + + +if __name__ == "__main__": + app.run() diff --git a/pyproject.toml b/pyproject.toml index 1fd8f26318..ca6b57c4b1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,7 @@ dev = [ "nbval<0.12", "filecheck<0.0.25", "lit<19.0.0", + "marimo==0.6.10", "pre-commit==3.7.1", "ruff==0.4.10", "asv<0.7", @@ -81,6 +82,7 @@ typeCheckingMode = "strict" "xdsl/interpreters/onnx.py", ] "ignore" = [ + "docs/marimo", "tests/filecheck/frontend/dialects/builtin.py", "tests/filecheck/frontend/dialects/invalid.py", "tests/filecheck/frontend/dialects/arith.py", @@ -136,6 +138,7 @@ exclude = """ /(__pycache__|.asv|venv|build|tests/filecheck)/ |versioneer.py$ |xdsl/_version.py$ +|docs/marimo """ [tool.pytest.ini_options]