Skip to content

Commit ccc76a7

Browse files
committed
🎨 Enable Ruff formatting for Python in Markdown
1 parent b15210b commit ccc76a7

9 files changed

Lines changed: 13 additions & 9 deletions

File tree

‎.pre-commit-config.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ repos:
3232
entry: uv run ruff format --force-exclude --exit-non-zero-on-format
3333
require_serial: true
3434
language: unsupported
35-
types: [python]
35+
types_or: [python, markdown]
3636

3737
- id: local-mypy
3838
name: mypy check

‎docs/reference/parameters.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import typer
88

99
app = typer.Typer()
1010

11+
1112
@app.command()
1213
def register(
1314
user: Annotated[str, typer.Argument()],
@@ -18,6 +19,7 @@ def register(
1819
print(f"--age is {age}")
1920
print(f"--score is {score}")
2021

22+
2123
if __name__ == "__main__":
2224
app()
2325
```

‎docs/tutorial/commands/name.md‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ By default, the command names are generated from the function name.
55
So, if your function is something like:
66

77
```Python
8-
def create(username: str):
9-
...
8+
def create(username: str): ...
109
```
1110

1211
Then the command name will be `create`.
@@ -50,7 +49,6 @@ Note that any underscores in the function name will be replaced with dashes.
5049
So if your function is something like:
5150

5251
```Python
53-
def create_user(username: str):
54-
...
52+
def create_user(username: str): ...
5553
```
5654
Then the command name will be `create-user`.

‎docs/tutorial/index.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ In short (very short), you can declare a function with parameters like:
1717
```Python
1818
from typing import Optional
1919

20+
2021
def type_example(name: str, formal: bool = False, intro: Optional[str] = None):
2122
pass
2223
```

‎docs/tutorial/package.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ The `app` in `"rick_portal_gun.main:app"` is the thing to import from the module
200200

201201
```Python
202202
from rick_portal_gun.main import app
203+
203204
app()
204205
```
205206

@@ -422,6 +423,7 @@ Then in that file you can execute your **Typer** program:
422423

423424
```Python
424425
from .main import app
426+
425427
app()
426428
```
427429

‎docs/tutorial/parameter-types/file.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The difference is that these types will give you a Python [file-like object](htt
1515
A "file-like object" is the same type of object returned by `open()` as in:
1616

1717
```Python
18-
with open('file.txt') as f:
18+
with open("file.txt") as f:
1919
# Here f is the file-like object
2020
read_data = f.read()
2121
print(read_data)

‎docs/tutorial/progressbar.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ def iterate_user_ids():
189189
for i in range(100):
190190
yield i
191191

192+
192193
for i in iterate_user_ids():
193194
print(i)
194195
```

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ tests = [
8484
"pytest-sugar >=1.0.0",
8585
"pytest-xdist >=3.6.1",
8686
"rich >=12.3.0",
87-
"ruff >=0.15.0",
87+
"ruff >=0.16.0",
8888
"shellingham >=1.3.0",
8989
]
9090

‎uv.lock‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)