Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

chore: ruff format (#1116)

Myles Scolnick9a7d5b0a9bc5
diff --git a/marimo/_ast/cell.py b/marimo/_ast/cell.py
index c6252e457a..1695dc010b 100644
--- a/marimo/_ast/cell.py
+++ b/marimo/_ast/cell.py
@@ -286,23 +286,28 @@ class Cell:
app = marimo.App()
+
@app.cell
def __():
import marimo as mo
+
return (mo,)
+
@app.cell
def __():
x = 0
y = 1
return (x, y)
+
@app.cell
def add(mo, x, y):
z = x + y
mo.md(f"The value of z is {z}")
return (z,)
+
if __name__ == "__main__":
app.run()
```
diff --git a/marimo/_messaging/cell_output.py b/marimo/_messaging/cell_output.py
index b1a9017e51..d690d41e55 100644
--- a/marimo/_messaging/cell_output.py
+++ b/marimo/_messaging/cell_output.py
@@ -1,7 +1,5 @@
# Copyright 2024 Marimo. All rights reserved.
-"""Specification of a cell's visual output
-"""
-
+"""Specification of a cell's visual output"""
from __future__ import annotations
diff --git a/marimo/_messaging/completion_option.py b/marimo/_messaging/completion_option.py
index 22cc7c0e57..f47562d44f 100644
--- a/marimo/_messaging/completion_option.py
+++ b/marimo/_messaging/completion_option.py
@@ -1,7 +1,5 @@
# Copyright 2024 Marimo. All rights reserved.
-"""Specification of a code completion result
-"""
-
+"""Specification of a code completion result"""
from __future__ import annotations
diff --git a/marimo/_output/formatters/structures.py b/marimo/_output/formatters/structures.py
index 5d18e7356a..37991ee48c 100644
--- a/marimo/_output/formatters/structures.py
+++ b/marimo/_output/formatters/structures.py
@@ -21,7 +21,7 @@ def _leaf_formatter(value: object) -> str:
def format_structure(
- t: Union[tuple[Any, ...], list[Any], dict[str, Any]]
+ t: Union[tuple[Any, ...], list[Any], dict[str, Any]],
) -> Union[tuple[Any, ...], list[Any], dict[str, Any]]:
"""Format the leaves of a structure.
@@ -42,7 +42,7 @@ class StructuresFormatter(FormatterFactory):
@formatting.formatter(tuple)
@formatting.formatter(dict)
def _format_structure(
- t: Union[tuple[Any, ...], list[Any], dict[str, Any]]
+ t: Union[tuple[Any, ...], list[Any], dict[str, Any]],
) -> tuple[KnownMimeType, str]:
try:
formatted_structure = format_structure(t)
diff --git a/marimo/_output/formatting.py b/marimo/_output/formatting.py
index b9316f358e..21efdf6824 100644
--- a/marimo/_output/formatting.py
+++ b/marimo/_output/formatting.py
@@ -53,7 +53,7 @@ def formatter(t: Type[Any]) -> Callable[[Formatter[T]], Formatter[T]]:
```
@formatter(Foo)
def show_foo(foo: Foo) -> tuple[str, str]:
- return ("text/html", f"<p>{foo.data}</p>")
+ return ("text/html", f"<p>{foo.data}</p>")
```
"""
diff --git a/marimo/_output/hypertext.py b/marimo/_output/hypertext.py
index 02a38252e8..56840a0c96 100644
--- a/marimo/_output/hypertext.py
+++ b/marimo/_output/hypertext.py
@@ -26,7 +26,7 @@ class Html(MIME):
strings. For example:
```python3
- hello_world = Html('<h2>Hello, World</h2>')
+ hello_world = Html("<h2>Hello, World</h2>")
Html(
f'''
<h1>Hello, Universe!</h1>
@@ -244,7 +244,7 @@ class Html(MIME):
**Example.**
```python
- mo.md("...").style({'max-height': '300px', 'overflow': 'auto'})
+ mo.md("...").style({"max-height": "300px", "overflow": "auto"})
```
**Args.**
diff --git a/marimo/_output/md.py b/marimo/_output/md.py
index 0f7c0b20b5..b64de49ab2 100644
--- a/marimo/_output/md.py
+++ b/marimo/_output/md.py
@@ -95,6 +95,7 @@ def md(text: str) -> Html:
```python3
import matplotlib.pyplot as plt
+
plt.plot([1, 2])
axis = plt.gca()
md(f"Here's a plot: {mo.as_html(axis)}")
diff --git a/marimo/_output/mpl.py b/marimo/_output/mpl.py
index 65f2bcdace..bb140252c9 100644
--- a/marimo/_output/mpl.py
+++ b/marimo/_output/mpl.py
@@ -9,6 +9,7 @@ and
https://stackoverflow.com/questions/58153024/matplotlib-how-to-create-original-backend
"""
+
from __future__ import annotations
import base64
diff --git a/marimo/_output/utils.py b/marimo/_output/utils.py
index 405b148d2e..e592b3c301 100644
--- a/marimo/_output/utils.py
+++ b/marimo/_output/utils.py
@@ -16,7 +16,7 @@ def flatten_string(text: str) -> str:
def create_style(
- pairs: dict[str, Union[str, int, float, None]]
+ pairs: dict[str, Union[str, int, float, None]],
) -> Optional[str]:
if not pairs:
return None
diff --git a/marimo/_plugins/core/media.py b/marimo/_plugins/core/media.py
index 40448e9a43..26e8acb0ab 100644
--- a/marimo/_plugins/core/media.py
+++ b/marimo/_plugins/core/media.py
@@ -6,7 +6,7 @@ from typing import Optional, Union
def guess_mime_type(
- src: Union[str, bytes, io.BytesIO, io.BufferedReader, None]
+ src: Union[str, bytes, io.BytesIO, io.BufferedReader, None],
) -> Optional[str]:
"""Guess the MIME type of a file."""
if src is None:
diff --git a/marimo/_plugins/stateless/accordion.py b/marimo/_plugins/stateless/accordion.py
index a663752125..1daa159180 100644
--- a/marimo/_plugins/stateless/accordion.py
+++ b/marimo/_plugins/stateless/accordion.py
@@ -19,17 +19,15 @@ def accordion(
**Example.**
```python3
- mo.accordion({
- "Tip": "Use accordions to let users reveal and hide content."
- })
+ mo.accordion(
+ {"Tip": "Use accordions to let users reveal and hide content."}
+ )
```
Accordion content can be lazily loaded:
```python3
- mo.accordion({
- "View total": expensive_item
- }, lazy=True)
+ mo.accordion({"View total": expensive_item}, lazy=True)
```
where `expensive_item` is the item to render, or a callable that
diff --git a/marimo/_plugins/stateless/flex.py b/marimo/_plugins/stateless/flex.py
index b8d0ff283a..adb85372e3 100644
--- a/marimo/_plugins/stateless/flex.py
+++ b/marimo/_plugins/stateless/flex.py
@@ -84,10 +84,12 @@ def vstack(
```python3
# Build a grid.
- mo.vstack([
- mo.hstack([mo.md("..."), mo.ui.text_area()]),
- mo.hstack([mo.ui.checkbox(), mo.ui.text(), mo.ui.date()])
- ])
+ mo.vstack(
+ [
+ mo.hstack([mo.md("..."), mo.ui.text_area()]),
+ mo.hstack([mo.ui.checkbox(), mo.ui.text(), mo.ui.date()]),
+ ]
+ )
```
**Args.**
@@ -135,10 +137,12 @@ def hstack(
```python3
# Build a grid.
- mo.hstack([
- mo.vstack([mo.md("..."), mo.ui.text_area()]),
- mo.vstack([mo.ui.checkbox(), mo.ui.text(), mo.ui.date()])
- ])
+ mo.hstack(
+ [
+ mo.vstack([mo.md("..."), mo.ui.text_area()]),
+ mo.vstack([mo.ui.checkbox(), mo.ui.text(), mo.ui.date()]),
+ ]
+ )
```
**Args.**
diff --git a/marimo/_plugins/stateless/lazy.py b/marimo/_plugins/stateless/lazy.py
index 28abff3275..b9daee24c6 100644
--- a/marimo/_plugins/stateless/lazy.py
+++ b/marimo/_plugins/stateless/lazy.py
@@ -33,18 +33,15 @@ class lazy(UIElement[None, None]):
Create a lazy-loaded tab:
```python
- tabs = mo.ui.tabs({
- "Overview": tab1,
- "Charts": mo.lazy(expensive_component)
- })
+ tabs = mo.ui.tabs(
+ {"Overview": tab1, "Charts": mo.lazy(expensive_component)}
+ )
```
Create a lazy-loaded accordion:
```python
- accordion = mo.ui.accordion({
- "Charts": mo.lazy(expensive_component)
- })
+ accordion = mo.ui.accordion({"Charts": mo.lazy(expensive_component)})
```
**Initialization Args.**
diff --git a/marimo/_plugins/stateless/mpl/__init__.py b/marimo/_plugins/stateless/mpl/__init__.py
index 38bd67ac73..890bdc61d5 100644
--- a/marimo/_plugins/stateless/mpl/__init__.py
+++ b/marimo/_plugins/stateless/mpl/__init__.py
@@ -1,7 +1,6 @@
# Copyright 2024 Marimo. All rights reserved.
"""Utilities for working with matplotlib."""
-
__all__ = [
"interactive",
]
diff --git a/marimo/_plugins/stateless/status/__init__.py b/marimo/_plugins/stateless/status/__init__.py
index 9ecb866632..a23b0a39f0 100644
--- a/marimo/_plugins/stateless/status/__init__.py
+++ b/marimo/_plugins/stateless/status/__init__.py
@@ -1,7 +1,6 @@
# Copyright 2024 Marimo. All rights reserved.
"""Create loading indicators."""
-
__all__ = ["progress_bar", "spinner"]
from marimo._plugins.stateless.status._progress import progress_bar, spinner
diff --git a/marimo/_plugins/stateless/status/_progress.py b/marimo/_plugins/stateless/status/_progress.py
index fd98cfe3ed..0a0197782e 100644
--- a/marimo/_plugins/stateless/status/_progress.py
+++ b/marimo/_plugins/stateless/status/_progress.py
@@ -64,7 +64,6 @@ class _Progress(Html):
# Increment by 10 and update title and subtitle
progress.update(10, title="Loading", subtitle="Still going...")
-
```
**Args.**
diff --git a/marimo/_plugins/stateless/style.py b/marimo/_plugins/stateless/style.py
index de435f3684..7629bcb58a 100644
--- a/marimo/_plugins/stateless/style.py
+++ b/marimo/_plugins/stateless/style.py
@@ -16,7 +16,7 @@ def style(item: object, styles: dict[str, Any]) -> Html:
**Example.**
```python
- mo.style(item, styles={'max-height': '300px', 'overflow': 'auto'})
+ mo.style(item, styles={"max-height": "300px", "overflow": "auto"})
```
**Args.**
diff --git a/marimo/_plugins/stateless/tree.py b/marimo/_plugins/stateless/tree.py
index c10d924ea3..b5a540d962 100644
--- a/marimo/_plugins/stateless/tree.py
+++ b/marimo/_plugins/stateless/tree.py
@@ -20,13 +20,7 @@ def tree(
**Example.**
```python3
- mo.tree([
- "entry",
- "another entry",
- {
- "key": [0, 1, 2]
- }
- ], label="A tree.")
+ mo.tree(["entry", "another entry", {"key": [0, 1, 2]}], label="A tree.")
```
**Args.**
diff --git a/marimo/_plugins/ui/_core/ui_element.py b/marimo/_plugins/ui/_core/ui_element.py
index 21c884b5a8..d9ca85dbba 100644
--- a/marimo/_plugins/ui/_core/ui_element.py
+++ b/marimo/_plugins/ui/_core/ui_element.py
@@ -315,8 +315,9 @@ class UIElement(Html, Generic[S, T], metaclass=abc.ABCMeta):
`UIElements`:
```python
- form = mo.ui.md(
- '''
+ form = (
+ mo.ui.md(
+ '''
**Enter your prompt.**
{prompt}
@@ -325,10 +326,13 @@ class UIElement(Html, Generic[S, T], metaclass=abc.ABCMeta):
{seed}
'''
- ).batch(
- prompt=mo.ui.text_area(),
- seed=mo.ui.number(),
- ).form()
+ )
+ .batch(
+ prompt=mo.ui.text_area(),
+ seed=mo.ui.number(),
+ )
+ .form()
+ )
```
**Args.**
diff --git a/marimo/_plugins/ui/_impl/altair_chart.py b/marimo/_plugins/ui/_impl/altair_chart.py
index 364807f31e..735bb60042 100644
--- a/marimo/_plugins/ui/_impl/altair_chart.py
+++ b/marimo/_plugins/ui/_impl/altair_chart.py
@@ -145,10 +145,14 @@ class altair_chart(UIElement[ChartSelection, "pd.DataFrame"]):
import marimo as mo
from vega_datasets import data
- chart = alt.Chart(data.cars()).mark_point().encode(
- x='Horsepower',
- y='Miles_per_Gallon',
- color='Origin',
+ chart = (
+ alt.Chart(data.cars())
+ .mark_point()
+ .encode(
+ x="Horsepower",
+ y="Miles_per_Gallon",
+ color="Origin",
+ )
)
chart = mo.ui.altair_chart(chart)
diff --git a/marimo/_plugins/ui/_impl/dictionary.py b/marimo/_plugins/ui/_impl/dictionary.py
index 6a7b6c025e..1152f96b54 100644
--- a/marimo/_plugins/ui/_impl/dictionary.py
+++ b/marimo/_plugins/ui/_impl/dictionary.py
@@ -39,11 +39,13 @@ class dictionary(_batch_base):
A heterogeneous collection of UI elements:
```python
- d = mo.ui.dictionary({
+ d = mo.ui.dictionary(
+ {
"slider": mo.ui.slider(1, 10),
"text": mo.ui.text(),
- "date": mo.ui.date()
- })
+ "date": mo.ui.date(),
+ }
+ )
```
Get the values of the `slider`, `text`, and `date` elements via
diff --git a/marimo/_plugins/ui/_impl/input.py b/marimo/_plugins/ui/_impl/input.py
index f6e84e3397..835b5ada00 100644
--- a/marimo/_plugins/ui/_impl/input.py
+++ b/marimo/_plugins/ui/_impl/input.py
@@ -260,17 +260,15 @@ class radio(UIElement[Optional[str], Any]):
```python
radiogroup = mo.ui.radio(
- options=['a', 'b', 'c'],
- value='a',
- label='choose one'
+ options=["a", "b", "c"], value="a", label="choose one"
)
```
```python
radiogroup = mo.ui.radio(
- options={'one': 1, 'two': 2, 'three': 3},
- value='one',
- label='pick a number'
+ options={"one": 1, "two": 2, "three": 3},
+ value="one",
+ label="pick a number",
)
```
@@ -510,17 +508,15 @@ class dropdown(UIElement[List[str], Any]):
```python
dropdown = mo.ui.dropdown(
- options=['a', 'b', 'c'],
- value='a',
- label='choose one'
+ options=["a", "b", "c"], value="a", label="choose one"
)
```
```python
dropdown = mo.ui.dropdown(
- options={'one': 1, 'two': 2, 'three': 3},
- value='one',
- label='pick a number'
+ options={"one": 1, "two": 2, "three": 3},
+ value="one",
+ label="pick a number",
)
```
@@ -612,8 +608,7 @@ class multiselect(UIElement[List[str], List[object]]):
```python
multiselect = mo.ui.multiselect(
- options=['a', 'b', 'c'],
- label='choose some options'
+ options=["a", "b", "c"], label="choose some options"
)
```
@@ -692,15 +687,13 @@ class button(UIElement[Any, Any]):
```python
# a counter implementation
counter_button = mo.ui.button(
- value=0,
- on_click=lambda value: value + 1,
- label='increment'
+ value=0, on_click=lambda value: value + 1, label="increment"
)
# adding intent
delete_button = mo.ui.button(
- label='Do not click',
- kind='danger',
+ label="Do not click",
+ kind="danger",
)
```
@@ -816,8 +809,7 @@ class file(UIElement[List[Tuple[str, str]], Sequence[FileUploadResults]]):
Uploading multiple files, accepting only .png and .jpg extensions:
```python
- f = mo.ui.file(
- filetypes=[".png", ".jpg"], multiple=True)
+ f = mo.ui.file(filetypes=[".png", ".jpg"], multiple=True)
# access an uploaded file's name
f.value[index].name
@@ -1046,16 +1038,20 @@ class form(UIElement[Optional[JSONTypeBound], Optional[T]]):
```python
# Create a form with multiple elements
- form = mo.md('''
+ form = (
+ mo.md('''
**Your form.**
{name}
{date}
- ''').batch(
- name=mo.ui.text(label='name'),
- date=mo.ui.date(label='date'),
- ).form(show_clear_button=True, bordered=False)
+ ''')
+ .batch(
+ name=mo.ui.text(label="name"),
+ date=mo.ui.date(label="date"),
+ )
+ .form(show_clear_button=True, bordered=False)
+ )
```
```python
diff --git a/marimo/_plugins/ui/_impl/plotly.py b/marimo/_plugins/ui/_impl/plotly.py
index 754d2289ce..e2c944437a 100644
--- a/marimo/_plugins/ui/_impl/plotly.py
+++ b/marimo/_plugins/ui/_impl/plotly.py
@@ -53,10 +53,7 @@ class plotly(UIElement[PlotlySelection, List[Dict[str, Any]]]):
from vega_datasets import data
_plot = px.scatter(
- data.cars(),
- x="Horsepower",
- y="Miles_per_Gallon",
- color="Origin"
+ data.cars(), x="Horsepower", y="Miles_per_Gallon", color="Origin"
)
plot = mo.ui.plotly(_plot)
diff --git a/marimo/_plugins/ui/_impl/table.py b/marimo/_plugins/ui/_impl/table.py
index d994b51bf7..13d9a197b9 100644
--- a/marimo/_plugins/ui/_impl/table.py
+++ b/marimo/_plugins/ui/_impl/table.py
@@ -61,11 +61,11 @@ class table(
```python
table = mo.ui.table(
- data=[
- {'first_name': 'Michael', 'last_name': 'Scott'},
- {'first_name': 'Dwight', 'last_name': 'Schrute'}
- ],
- label='Users'
+ data=[
+ {"first_name": "Michael", "last_name": "Scott"},
+ {"first_name": "Dwight", "last_name": "Schrute"},
+ ],
+ label="Users",
)
```
@@ -87,7 +87,7 @@ class table(
data=df,
# use pagination when your table has many rows
pagination=True,
- label='Dataframe'
+ label="Dataframe",
)
```
diff --git a/marimo/_plugins/ui/_impl/tabs.py b/marimo/_plugins/ui/_impl/tabs.py
index 6992d4f922..0eff6f7208 100644
--- a/marimo/_plugins/ui/_impl/tabs.py
+++ b/marimo/_plugins/ui/_impl/tabs.py
@@ -36,19 +36,17 @@ class tabs(UIElement[str, str]):
Control which tab is selected:
```python
- tabs = mo.ui.tabs({
- "Heading 1": tab1,
- "Heading 2": tab2
- }, value="Heading 2")
+ tabs = mo.ui.tabs(
+ {"Heading 1": tab1, "Heading 2": tab2}, value="Heading 2"
+ )
```
Tab content can be lazily loaded:
```python
- tabs = mo.ui.tabs({
- "Heading 1": tab1,
- "Heading 2": expensive_component
- }, lazy=True)
+ tabs = mo.ui.tabs(
+ {"Heading 1": tab1, "Heading 2": expensive_component}, lazy=True
+ )
```
**Attributes.**
diff --git a/marimo/_runtime/autoreload.py b/marimo/_runtime/autoreload.py
index 2e3f627c54..4133b76980 100644
--- a/marimo/_runtime/autoreload.py
+++ b/marimo/_runtime/autoreload.py
@@ -6,6 +6,7 @@ of reloaded objects with their code.
Based on the autoreload extension from the IPython project (BSD-3 Clause).
"""
+
from __future__ import annotations
import gc
diff --git a/marimo/_runtime/capture.py b/marimo/_runtime/capture.py
index c0635a221f..a47e6a73bb 100644
--- a/marimo/_runtime/capture.py
+++ b/marimo/_runtime/capture.py
@@ -19,7 +19,7 @@ def capture_stdout() -> Iterator[io.StringIO]:
```python
with mo.capture_stdout() as buffer:
- print("Hello!")
+ print("Hello!")
output = buffer.getvalue()
```
"""
@@ -37,7 +37,7 @@ def capture_stderr() -> Iterator[io.StringIO]:
```python
with mo.capture_stderr() as buffer:
- sys.stderr.write("Hello!")
+ sys.stderr.write("Hello!")
output = buffer.getvalue()
```
"""
diff --git a/marimo/_runtime/context.py b/marimo/_runtime/context.py
index 26131b6f8a..454d0201cd 100644
--- a/marimo/_runtime/context.py
+++ b/marimo/_runtime/context.py
@@ -4,7 +4,6 @@
Each client gets its own context.
"""
-
from __future__ import annotations
import threading
diff --git a/marimo/_runtime/functions.py b/marimo/_runtime/functions.py
index b880f5db71..0b523b05a6 100644
--- a/marimo/_runtime/functions.py
+++ b/marimo/_runtime/functions.py
@@ -1,6 +1,6 @@
# Copyright 2024 Marimo. All rights reserved.
-"""Functions associated with a graph.
-"""
+"""Functions associated with a graph."""
+
from __future__ import annotations
import dataclasses
diff --git a/marimo/_runtime/output/__init__.py b/marimo/_runtime/output/__init__.py
index ebc6fa6bfe..969121d9ac 100644
--- a/marimo/_runtime/output/__init__.py
+++ b/marimo/_runtime/output/__init__.py
@@ -1,7 +1,6 @@
# Copyright 2024 Marimo. All rights reserved.
"""Write to a cell's output area."""
-
__all__ = [
"append",
"clear",
diff --git a/marimo/_runtime/packages/package_manager.py b/marimo/_runtime/packages/package_manager.py
index 56e78e701a..800dfe9a44 100644
--- a/marimo/_runtime/packages/package_manager.py
+++ b/marimo/_runtime/packages/package_manager.py
@@ -49,8 +49,7 @@ class CanonicalizingPackageManager(PackageManager):
self._repo_name_to_module_name: dict[str, str] | None = None
@abc.abstractmethod
- def _construct_module_name_mapping(self) -> dict[str, str]:
- ...
+ def _construct_module_name_mapping(self) -> dict[str, str]: ...
def _initialize_mappings(self) -> None:
if self._module_name_to_repo_name is None:
diff --git a/marimo/_server/asgi.py b/marimo/_server/asgi.py
index d366361430..bea3148a43 100644
--- a/marimo/_server/asgi.py
+++ b/marimo/_server/asgi.py
@@ -34,6 +34,7 @@ def create_asgi_app(
```python
import uvicorn
+
builder = (
create_asgi_app()
.with_app(path="/app", root="app.py")
@@ -65,11 +66,13 @@ def create_asgi_app(
# Add middlewares
app.add_middleware(my_middlewares.auth_middleware)
+
# Add routes
@app.get("/login")
async def root():
pass
+
# Add the marimo app
app.mount("/", builder.build())
diff --git a/marimo/_server/sessions.py b/marimo/_server/sessions.py
index f06abf935d..71c3335392 100644
--- a/marimo/_server/sessions.py
+++ b/marimo/_server/sessions.py
@@ -11,6 +11,7 @@ session is closed as soon as its websocket connection is severed. In edit mode,
in which we have at most one connected client, a session may be kept around
even if its socket is closed.
"""
+
from __future__ import annotations
import multiprocessing as mp
diff --git a/marimo/_utils/flatten.py b/marimo/_utils/flatten.py
index e8534589dc..8d4dfc006c 100644
--- a/marimo/_utils/flatten.py
+++ b/marimo/_utils/flatten.py
@@ -8,6 +8,7 @@ TODO(akshayka): if this becomes a bottleneck, use a library like dm-tree
(this implementation will be slow large structures); as of writing,
installation of dm-tree on macOS is buggy
"""
+
from __future__ import annotations
import itertools
diff --git a/marimo/_utils/log_formatter.py b/marimo/_utils/log_formatter.py
index 24f1998e17..f931b2e7f2 100644
--- a/marimo/_utils/log_formatter.py
+++ b/marimo/_utils/log_formatter.py
@@ -97,7 +97,8 @@ class LogFormatter(logging.Formatter):
# bytes to unicode strings for easier use with the
# logging module.
self._colors[levelno] = str(
- curses.tparm(fg_color, code), "ascii" # type: ignore[attr-defined,unused-ignore] # noqa: E501
+ curses.tparm(fg_color, code),
+ "ascii", # type: ignore[attr-defined,unused-ignore] # noqa: E501
)
normal = curses.tigetstr("sgr0") # type: ignore[attr-defined,unused-ignore] # noqa: E501
if normal is not None:
diff --git a/marimo/_utils/parse_dataclass.py b/marimo/_utils/parse_dataclass.py
index 9002013c17..361426add8 100644
--- a/marimo/_utils/parse_dataclass.py
+++ b/marimo/_utils/parse_dataclass.py
@@ -45,7 +45,9 @@ def _build_value(value: Any, cls: Type[T]) -> T:
if len(arg_types) == 2 and isinstance(arg_types[1], type(Ellipsis)):
return origin_cls(_build_value(v, arg_types[0]) for v in value) # type: ignore # noqa: E501
else:
- return origin_cls(_build_value(v, t) for v, t in zip(value, arg_types)) # type: ignore # noqa: E501
+ return origin_cls( # type: ignore # noqa: E501
+ _build_value(v, t) for v, t in zip(value, arg_types)
+ )
elif origin_cls == dict:
key_type, value_type = get_args(cls)
return origin_cls( # type: ignore[no-any-return]
diff --git a/marimo/_utils/url.py b/marimo/_utils/url.py
index b9ed13bc10..5c01c90875 100644
--- a/marimo/_utils/url.py
+++ b/marimo/_utils/url.py
@@ -3,6 +3,7 @@
Don't want to include the entire package as a dependency.
"""
+
from __future__ import annotations
import re
diff --git a/pyproject.toml b/pyproject.toml
index 848eb6385c..eec8689fa6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -198,7 +198,6 @@ extend-select = [
"I001",
# Enable entire ruff rule section
"ASYNC", # subset of flake8-async rules
- "ISC", # Checks for implicit literal string concatenation (auto-fixable)
"TCH", # Rules around TYPE_CHECKING blocks
"G", # flake8-logging-format rules
"LOG", # flake8-logging rules, most of them autofixable
@@ -251,21 +250,6 @@ banned-module-level-imports = ["numpy", "pandas"]
mark-parentheses = false
fixture-parentheses = false
-[tool.black]
-line-length = 79
-extend-exclude = """
-(
- ^/examples/*
- | ^/tests/_ast/codegen_data/*
- | ^/tests/_ast/cell_data/*
- | ^/tests/_cli/ipynb_data/*
- | ^/tests/_runtime/runtime_data/*
- | ^/marimo/_tutorials/*
- | ^/marimo/_snippets/data/*
- | ^/marimo/_smoke_tests/*
-)
-"""
-
[tool.mypy]
strict = true
exclude = [
diff --git a/scripts/pyfix.sh b/scripts/pyfix.sh
index af8b9c8b6c..20d0317a82 100755
--- a/scripts/pyfix.sh
+++ b/scripts/pyfix.sh
@@ -5,7 +5,6 @@ echo "[fix: copyright]"
echo "[fix: ruff]"
ruff check marimo/ --fix
ruff check tests/ --fix
-echo "[fix: black]"
-black marimo/
-black tests/
+ruff format marimo/
+ruff format tests/
./scripts/pycheck.sh
diff --git a/tests/_ast/test_app.py b/tests/_ast/test_app.py
index 4972ea1268..618830f829 100644
--- a/tests/_ast/test_app.py
+++ b/tests/_ast/test_app.py
@@ -342,8 +342,7 @@ class TestApp:
@app.cell
def __() -> tuple[Any]:
- def foo():
- ...
+ def foo(): ...
return (foo,)
diff --git a/tests/_ast/test_cell.py b/tests/_ast/test_cell.py
index f926fa8110..6774501f45 100644
--- a/tests/_ast/test_cell.py
+++ b/tests/_ast/test_cell.py
@@ -48,8 +48,7 @@ class TestCellRun:
@staticmethod
def test_unknown_ref_raises() -> None:
- def f() -> None:
- ...
+ def f() -> None: ...
app = App()
cell = app.cell(f)
diff --git a/tests/_cli/test_cli.py b/tests/_cli/test_cli.py
index ac3abaf407..453b81e41c 100644
--- a/tests/_cli/test_cli.py
+++ b/tests/_cli/test_cli.py
@@ -4,6 +4,7 @@ Crude CLI tests
Requires frontend to be built
"""
+
import contextlib
import os
import signal
diff --git a/tests/_output/test_md.py b/tests/_output/test_md.py
index 461da3e890..21407ea565 100644
--- a/tests/_output/test_md.py
+++ b/tests/_output/test_md.py
@@ -25,7 +25,9 @@ def test_md_code_blocks() -> None:
def test_md_latex() -> None:
# Test LaTeX conversion
latex_input = "Here is an equation: ||(E=mc^2||)"
- expected_output = '<span class="paragraph">Here is an equation: ||(E=mc^2||)</span>' # noqa: E501
+ expected_output = (
+ '<span class="paragraph">Here is an equation: ||(E=mc^2||)</span>' # noqa: E501
+ )
assert _md(latex_input, apply_markdown_class=False).text == expected_output
diff --git a/tests/_utils/test_parse_dataclass.py b/tests/_utils/test_parse_dataclass.py
index 8558c554be..af70ecebb5 100644
--- a/tests/_utils/test_parse_dataclass.py
+++ b/tests/_utils/test_parse_dataclass.py
@@ -226,8 +226,7 @@ class TestParseRaw:
def test_build_empty_dataclass() -> None:
@dataclass
- class Empty:
- ...
+ class Empty: ...
parsed = build_dataclass({}, Empty)
assert parsed == Empty()