Skip to content

Commit 9abdfc5

Browse files
committed
chore: release
1 parent 27c3b3f commit 9abdfc5

19 files changed

Lines changed: 156 additions & 45 deletions

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
lint:
44
@echo "Running linters... 🔄"
5+
ruff check --fix
6+
ty check
57
pre-commit install
68
pre-commit run -a
7-
ty check
89
@echo "Linters completed. ✅"
910

1011
release:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ license = "MIT"
1616
name = "litestar-start"
1717
readme = "README.md"
1818
requires-python = ">=3.13"
19-
version = "0.1.0a8"
19+
version = "0.1.0a9"
2020

2121
[project.scripts]
2222
litestar-start = "src.cli:main"

src/Litestar/App/__main__.py.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
import uvicorn
44

5-
from app.config import settings
5+
from config import settings
66

77

88
def main() -> None:
99
"""Run the application."""
1010
uvicorn.run(
11-
"app.main:app",
11+
"app:app",
1212
host=settings.HOST,
1313
port=settings.PORT,
1414
reload=settings.DEBUG,
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
"""Litestar application factory."""
22

33
from litestar import Litestar, get
4+
from litestar.logging import LoggingConfig
45
from litestar.openapi import OpenAPIConfig
56
from litestar.openapi.plugins import ScalarRenderPlugin
6-
from app.config import settings
7+
from config import settings
78
{% if has_advanced_alchemy %}
89
from advanced_alchemy.exceptions import RepositoryError
9-
from app.config import alchemy
10-
from app.lib import exception_handler
10+
from config import alchemy
11+
from lib import exception_handler
1112
{% endif %}
1213

1314

@@ -25,13 +26,19 @@ async def health() -> dict[str, str]:
2526

2627
app = Litestar(
2728
route_handlers=[index, health],
29+
debug=settings.DEBUG,
2830
openapi_config=OpenAPIConfig(
2931
title=settings.APP_NAME,
3032
version="0.1.0",
3133
path="/api",
3234
render_plugins=[ScalarRenderPlugin()],
3335
),
34-
debug=settings.DEBUG,
36+
logging_config=LoggingConfig(
37+
disable_stack_trace={
38+
404,
39+
},
40+
log_exceptions="always",
41+
),
3542
{% if has_advanced_alchemy %}
3643
exception_handlers={
3744
Exception: exception_handler,

src/Litestar/App/config.py.jinja

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
from app.settings import get_settings
2-
3-
settings = get_settings()
4-
51
{% if has_advanced_alchemy %}
62
from advanced_alchemy.extensions.litestar import (
73
AsyncSessionConfig,
84
SQLAlchemyAsyncConfig,
95
SQLAlchemyPlugin,
106
)
7+
{% endif %}
8+
9+
from settings import get_settings
1110

12-
session_config = AsyncSessionConfig(expire_on_commit=False)
11+
settings = get_settings()
12+
13+
14+
{% if has_advanced_alchemy %}
1315
alchemy_config = SQLAlchemyAsyncConfig(
1416
connection_string=settings.DATABASE_URL,
1517
before_send_handler="autocommit",
16-
session_config=session_config,
18+
session_config=AsyncSessionConfig(expire_on_commit=False),
1719
create_all=True,
1820
)
1921
alchemy = SQLAlchemyPlugin(config=alchemy_config)
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
"""Application library utilities."""
22

33
{% if has_advanced_alchemy %}
4-
from app.lib.utils import exception_handler
4+
from lib.dependencies import provide_user_service
5+
from lib.services import UserService
6+
from lib.utils import exception_handler
7+
8+
__all__ = [
9+
"UserService",
10+
"provide_user_service",
11+
"exception_handler",
12+
]
513

6-
__all__ = ["exception_handler"]
714
{% else %}
815
__all__ = []
916
{% endif %}

src/Litestar/App/lib/utils.py.jinja

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ from litestar.status_codes import (
1717
)
1818

1919

20-
2120
class _HTTPConflictException(HTTPException):
2221
"""Request conflict with the current state of the target resource."""
2322

src/Litestar/App/settings.py.jinja

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ class Settings:
5454

5555
if env_file.is_file():
5656
from dotenv import load_dotenv
57+
from rich import get_console
5758

59+
console = get_console()
5860
console.print(
5961
f"[yellow]Loading environment configuration from {dotenv_filename}[/]",
6062
markup=True,
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
default_language_version:
2+
python: "3"
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v6.0.0
6+
hooks:
7+
- id: check-ast
8+
- id: check-case-conflict
9+
- id: check-merge-conflict
10+
- id: check-toml
11+
- id: debug-statements
12+
- id: end-of-file-fixer
13+
- id: mixed-line-ending
14+
- id: trailing-whitespace
15+
- repo: https://github.com/compilerla/conventional-pre-commit
16+
rev: v4.3.0
17+
hooks:
18+
- id: conventional-pre-commit
19+
stages: [commit-msg]
20+
- repo: https://github.com/charliermarsh/ruff-pre-commit
21+
rev: v0.14.10
22+
hooks:
23+
- id: ruff
24+
args: [--fix]
25+
- id: ruff-format
26+
- repo: https://github.com/codespell-project/codespell
27+
rev: v2.4.1
28+
hooks:
29+
- id: codespell
30+
exclude: "uv.lock"
31+
args: ["--ignore-words-list=ure"]
32+
additional_dependencies:
33+
- tomli
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

0 commit comments

Comments
 (0)