Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ repos:
entry: uv run ruff format --force-exclude --exit-non-zero-on-format
require_serial: true
language: unsupported
types: [python]
types_or: [python, markdown]

- id: local-ty
name: ty check
Expand Down
4 changes: 4 additions & 0 deletions docs/db-to-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,11 @@ For example, you could ask the database for the same hero with ID `2` with this
```Python
user_id = input("Type the user ID: ")

# fmt: off
session.exec(
select(Hero).where(Hero.id == user_id)
).all()
# fmt: on
```

If the user provides this ID:
Expand Down Expand Up @@ -231,9 +233,11 @@ results = database.execute(statement)
But if you use common Python classes and objects, your editor will be able to help you:

```Python
# fmt: off
database.execute(
select(Hero).where(Hero.secret_name == "Dive Wilson")
).all()
# fmt: on
```

![](img/db-to-code/autocompletion01.png){class="shadow"}
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/code-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ import project.app
Then Python will execute that module *inside* of that package, and because Python is executing it directly, the same trick with the **main block** that we have in `app.py` will still work:

```Python
if __name__ == '__main__':
if __name__ == "__main__":
main()
```

Expand Down
8 changes: 2 additions & 6 deletions docs/tutorial/fastapi/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ But if the client sent a JSON with:
Then the dictionary we would get in Python using `hero.model_dump(exclude_unset=True)` would be:

```Python
{
"name": "Deadpuddle"
}
{"name": "Deadpuddle"}
```

Then we use that to get the data that was actually sent by the client:
Expand Down Expand Up @@ -143,9 +141,7 @@ So, if the client wanted to intentionally remove the `age` of a hero, they could
And when getting the data with `hero.model_dump(exclude_unset=True)`, we would get:

```Python
{
"age": None
}
{"age": None}
```

So, we would use that value and update the `age` to `None` in the database, **just as the client intended**.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ tests = [
"psycopg[binary] >=3.2.10",
"pymysql[rsa] >=1.1.1",
"pytest >=7.0.1",
"ruff >=0.15.6",
"ruff >=0.16.0",
"ty>=0.0.25",
"typer >=0.26.1",
"typing-extensions >=4.15.0",
Expand Down
4 changes: 2 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading