Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/workflows/test_cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,22 @@ jobs:
uv add pytest pytest-asyncio
uv pip install marimo*whl

- name: Check notebook quality with marimo check
- name: Check example quality with marimo check
shell: bash
run: |
echo "Checking examples directory..."
uv run marimo check --ignore-scripts --strict examples/**.py

- name: Check tutorial quality with marimo check
shell: bash
run: |
echo "Checking tutorials..."
uv run marimo check --ignore-scripts --fix \
marimo/_tutorials/**.py >> /dev/null \
|| echo "Errors expected"
# Fail if there's a git diff
if [[ -n "$(git status --porcelain marimo/_tutorials)" ]]; then
echo "marimo check found issues in tutorials."
git --no-pager diff marimo/_tutorials
exit 1
fi
6 changes: 3 additions & 3 deletions development_docs/adding_lint_rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ if __name__ == "__main__":

#### b) Add snapshot test

Add to `tests/_lint/test_runtime_errors_snapshot.py`:
Add to `tests/_lint/test_snapshot.py`:

```python
def test_your_rule_snapshot():
Expand Down Expand Up @@ -280,7 +280,7 @@ uv run hatch run test:test tests/_lint
uv run hatch run test:test tests/_lint/test_your_rule.py

# Update snapshots if needed
uv run hatch run test:test tests/_lint/test_runtime_errors_snapshot.py --snapshot-update
uv run hatch run test:test tests/_lint/test_snapshots.py --snapshot-update
```

## Rule Implementation Guidelines
Expand Down Expand Up @@ -359,7 +359,7 @@ tests/_lint/
├── snapshots/ # Expected outputs
│ └── your_rule_name_errors.txt
├── test_your_rule.py # Unit tests
└── test_runtime_errors_snapshot.py # Snapshot tests
└── test_snapshots.py # Snapshot tests
```

## Documentation Requirements
Expand Down
1 change: 1 addition & 0 deletions docs/guides/lint_rules/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ These are style and formatting issues.
| [MF004](rules/empty_cells.md) | empty-cells | Empty cells that can be safely removed. | ⚠️ |
| [MF005](rules/sql_parse_error.md) | sql-parse-error | SQL parsing errors during dependency analysis | ❌ |
| [MF006](rules/misc_log_capture.md) | misc-log-capture | Miscellaneous log messages during processing | ❌ |
| [MF007](rules/markdown_dedent.md) | markdown-dedent | Markdown cells in `mo.md()` should be dedented. | 🛠️ |

## Legend

Expand Down
48 changes: 48 additions & 0 deletions docs/guides/lint_rules/rules/markdown_dedent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# MF007: markdown-dedent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder if the rule should be markdown-indentation since it captures more than dedent. but if this is internal, we can change the name whenever


✨ **Formatting** 🛠️ Fixable

MF007: Markdown strings in `mo.md()` should be dedented.

## What it does

Checks cells containing `mo.md()` calls to see if the markdown string
content has unnecessary leading whitespace that should be removed.

## Why is this bad?

Indented markdown strings:
- Are harder to read when viewing the source code
- Produce larger diffs when making changes
- Don't match the standard marimo formatting style
- Can be confusing when the indentation doesn't reflect the markdown structure

## Examples

**Problematic:**
```python
mo.md(
r"""
# Title

Some content here.
"""
)
```

**Solution:**
```python
mo.md(r"""
# Title

Some content here.
""")
```

**Note:** This fix is automatically applied with `marimo check --fix`.

## References

- [Understanding Errors](https://docs.marimo.io/guides/understanding_errors/)
- [Best Practices](https://docs.marimo.io/guides/best_practices/)

12 changes: 6 additions & 6 deletions examples/ai/chat/anthropic_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import marimo

__generated_with = "0.15.5"
__generated_with = "0.17.2"
app = marimo.App(width="medium")


Expand All @@ -20,13 +20,11 @@ def _():

@app.cell
def _(mo):
mo.md(
r"""
mo.md(r"""
# Using Anthropic

This example shows how to use [`mo.ui.chat`](https://docs.marimo.io/api/inputs/chat.html#marimo.ui.chat) to make a chatbot backed by Anthropic.
"""
)
""")
return


Expand Down Expand Up @@ -76,7 +74,9 @@ def _(key, mo):

@app.cell
def _(mo):
mo.md("""Access the chatbot's historical messages with [`chatbot.value`](https://docs.marimo.io/api/inputs/chat.html#accessing-chat-history).""")
mo.md(
"""Access the chatbot's historical messages with [`chatbot.value`](https://docs.marimo.io/api/inputs/chat.html#accessing-chat-history)."""
)
return


Expand Down
14 changes: 5 additions & 9 deletions examples/ai/chat/bedrock_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import marimo

__generated_with = "0.15.5"
__generated_with = "0.17.2"
app = marimo.App(width="medium")


Expand All @@ -21,17 +21,15 @@ def _():

@app.cell(hide_code=True)
def _(mo):
mo.md(
r"""
mo.md(r"""
# AWS Bedrock Chat Example

This example demonstrates using AWS Bedrock with marimo's chat interface.

AWS Bedrock provides access to foundation models from leading AI companies like Anthropic, Meta, and others.

⚠️ **Note:** You'll need an AWS account with access to the AWS Bedrock service and the specific model you want to use.
"""
)
""")
return


Expand Down Expand Up @@ -227,8 +225,7 @@ def create_chat(config_form):

@app.cell
def _(mo):
mo.md(
r"""
mo.md(r"""
## Notes on AWS Bedrock Usage

1. **Model Access**: You need to request access to the specific models you want to use in the AWS Bedrock console.
Expand All @@ -243,8 +240,7 @@ def _(mo):
- That your AWS credentials are configured correctly
- That you have requested model access in the AWS Bedrock console
- That you're using a region where the selected model is available
"""
)
""")
return


Expand Down
18 changes: 8 additions & 10 deletions examples/ai/chat/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import marimo

__generated_with = "0.15.5"
__generated_with = "0.17.2"
app = marimo.App(width="medium")


Expand All @@ -19,15 +19,13 @@ def _():

@app.cell(hide_code=True)
def _(mo):
mo.md(
"""
# Custom chatbot

This example shows how to make a custom chatbot: just supply a function that takes two arguments,
`messages` and `config`, and returns the chatbot's response. This response can be any object; it
doesn't have to be a string!
"""
)
mo.md("""
# Custom chatbot

This example shows how to make a custom chatbot: just supply a function that takes two arguments,
`messages` and `config`, and returns the chatbot's response. This response can be any object; it
doesn't have to be a string!
""")
return


Expand Down
14 changes: 6 additions & 8 deletions examples/ai/chat/dagger_code_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import marimo

__generated_with = "0.15.5"
__generated_with = "0.17.2"
app = marimo.App(width="medium")


Expand All @@ -25,15 +25,13 @@ def _():

@app.cell(hide_code=True)
def _(mo):
mo.md(
"""
# Chatbot code-interpreter with [Dagger](https://dagger.io/)
mo.md("""
# Chatbot code-interpreter with [Dagger](https://dagger.io/)

This example shows how to create a code-interpreter that executes code using [Dagger](https://dagger.io/) so the code is run in an isolated container.
This example shows how to create a code-interpreter that executes code using [Dagger](https://dagger.io/) so the code is run in an isolated container.

This example requires Docker running on your computer.
"""
)
This example requires Docker running on your computer.
""")
return


Expand Down
16 changes: 8 additions & 8 deletions examples/ai/chat/deepseek_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import marimo

__generated_with = "0.15.5"
__generated_with = "0.17.2"
app = marimo.App(width="medium")


Expand All @@ -20,13 +20,11 @@ def _():

@app.cell(hide_code=True)
def _(mo):
mo.md(
r"""
# Using DeepSeek
mo.md(r"""
# Using DeepSeek

This example shows how to use [`mo.ui.chat`](https://docs.marimo.io/api/inputs/chat/?h=mo.ui.chat) to make a chatbot backed by [Deepseek](https://deepseek.com/).
"""
)
This example shows how to use [`mo.ui.chat`](https://docs.marimo.io/api/inputs/chat/?h=mo.ui.chat) to make a chatbot backed by [Deepseek](https://deepseek.com/).
""")
return


Expand Down Expand Up @@ -88,7 +86,9 @@ def _(key, mo):

@app.cell(hide_code=True)
def _(mo):
mo.md("""Access the chatbot's historical messages with [`chatbot.value`](https://docs.marimo.io/api/inputs/chat.html#accessing-chat-history).""")
mo.md(
"""Access the chatbot's historical messages with [`chatbot.value`](https://docs.marimo.io/api/inputs/chat.html#accessing-chat-history)."""
)
return


Expand Down
16 changes: 8 additions & 8 deletions examples/ai/chat/gemini.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import marimo

__generated_with = "0.15.5"
__generated_with = "0.17.2"
app = marimo.App(width="medium")


Expand All @@ -19,13 +19,11 @@ def _():

@app.cell
def _(mo):
mo.md(
r"""
# Using Gemini
mo.md(r"""
# Using Gemini

This example shows how to use [`mo.ui.chat`](https://docs.marimo.io/api/inputs/chat.html#marimo.ui.chat) to make a chatbot backed by Gemini.
"""
)
This example shows how to use [`mo.ui.chat`](https://docs.marimo.io/api/inputs/chat.html#marimo.ui.chat) to make a chatbot backed by Gemini.
""")
return


Expand Down Expand Up @@ -70,7 +68,9 @@ def _(key, mo):

@app.cell(hide_code=True)
def _(mo):
mo.md("""Access the chatbot's historical messages with [`chatbot.value`](https://docs.marimo.io/api/inputs/chat.html#accessing-chat-history).""")
mo.md(
"""Access the chatbot's historical messages with [`chatbot.value`](https://docs.marimo.io/api/inputs/chat.html#accessing-chat-history)."""
)
return


Expand Down
16 changes: 8 additions & 8 deletions examples/ai/chat/groq_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import marimo

__generated_with = "0.15.5"
__generated_with = "0.17.2"
app = marimo.App(width="medium")


Expand All @@ -20,13 +20,11 @@ def _():

@app.cell(hide_code=True)
def _(mo):
mo.md(
r"""
# Using Groq
mo.md(r"""
# Using Groq

This example shows how to use [`mo.ui.chat`](https://docs.marimo.io/api/inputs/chat.html#marimo.ui.chat) to make a chatbot backed by [Groq](https://groq.com/).
"""
)
This example shows how to use [`mo.ui.chat`](https://docs.marimo.io/api/inputs/chat.html#marimo.ui.chat) to make a chatbot backed by [Groq](https://groq.com/).
""")
return


Expand Down Expand Up @@ -88,7 +86,9 @@ def _(key, mo):

@app.cell(hide_code=True)
def _(mo):
mo.md("""Access the chatbot's historical messages with [`chatbot.value`](https://docs.marimo.io/api/inputs/chat.html#accessing-chat-history).""")
mo.md(
"""Access the chatbot's historical messages with [`chatbot.value`](https://docs.marimo.io/api/inputs/chat.html#accessing-chat-history)."""
)
return


Expand Down
Loading
Loading