Skip to content

Commit a8b33dc

Browse files
committed
chore: improvements
1 parent ce45831 commit a8b33dc

14 files changed

Lines changed: 57 additions & 48 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ license = "MIT"
1919
name = "litestar-start"
2020
readme = "README.md"
2121
requires-python = ">=3.10"
22-
version = "0.1.0a3"
22+
version = "0.1.0a4"
2323

2424
[project.scripts]
2525
litestar-start = "litestar_start.cli:main"
@@ -42,7 +42,7 @@ include = ["/src", "/templates"]
4242

4343
[tool.ruff]
4444
line-length = 120
45-
lint.ignore = ["CPY001", "D100"]
45+
lint.ignore = ["CPY001", "D100", "PLR0911"]
4646

4747
[dependency-groups]
4848
dev = ["pre-commit>=4.5.1"]

src/litestar_start/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
from litestar_start.generators.project import ProjectOrchestrator
66
from litestar_start.generators.registry import GeneratorRegistry
77

8-
__version__ = "0.1.0a3"
9-
108
__all__ = [
119
"GeneratorRegistry",
1210
"ProjectConfig",

src/litestar_start/backends/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ def _apply_plugins(self, backend_dir: Path, context: GeneratorContext) -> None:
7171
"""
7272
# Plugin application will be implemented when plugins are created
7373

74-
def _copy_template_files(self, backend_dir: Path, context: GeneratorContext) -> None:
74+
@staticmethod
75+
def _copy_template_files(backend_dir: Path, context: GeneratorContext) -> None:
7576
"""Copy template files to backend directory.
7677
7778
Args:

src/litestar_start/backends/litestar/generator.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ def get_dependencies(self) -> list[str]:
4141
4242
"""
4343
return [
44-
"litestar>=2.5.0",
45-
"uvicorn[standard]>=0.27.0",
46-
"python-dotenv>=1.0.0",
47-
"msgspec>=0.20.0",
44+
"litestar[standard]>=2.19.0",
45+
"python-dotenv>=1.2.1",
4846
]
4947

5048
def _generate_pyproject(self, backend_dir: Path, context: GeneratorContext) -> None:
@@ -64,7 +62,7 @@ def _generate_pyproject(self, backend_dir: Path, context: GeneratorContext) -> N
6462
write_file(backend_dir / "pyproject.toml", content)
6563

6664
# Create .python-version for uv
67-
write_file(backend_dir / ".python-version", "3.12\n")
65+
write_file(backend_dir / ".python-version", "3.13\n")
6866

6967
# Create .gitignore
7068
gitignore_content = self.template_loader.render("litestar:gitignore.jinja", {})
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
"""Litestar application package."""

src/litestar_start/backends/litestar/templates/app/config.py.jinja

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
"""Application configuration."""
2-
31
import msgspec
42

53

@@ -12,7 +10,7 @@ class Settings(msgspec.Struct):
1210
DEBUG: bool = True
1311

1412
# CORS
15-
ALLOWED_ORIGINS: list[str] = ["http://localhost:3000", "http://localhost:5173"]
13+
ALLOWED_ORIGINS: list[str] = msgspec.field(default_factory=lambda: ["*"])
1614

1715
# Database
1816
DATABASE_URL: str = "sqlite:///./app.db"
Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
1-
"""Litestar application entry point."""
2-
31
{% block imports %}
42
from litestar import Litestar, get
53
from litestar.config.cors import CORSConfig
6-
from litestar.contrib.pydantic import PydanticPlugin
74

85
from app.config import settings
96
from app.controllers.base import base_controller
107
{% endblock %}
118

129
{% block routes %}
1310

14-
@get("/")
15-
async def root() -> dict[str, str]:
16-
"""Root endpoint."""
17-
return {"message": "Welcome to {{ project_name }}!"}
18-
19-
2011
@get("/health")
2112
async def health() -> dict[str, str]:
2213
"""Health check endpoint."""
@@ -30,9 +21,8 @@ async def health() -> dict[str, str]:
3021
{% block app_config %}
3122

3223
app = Litestar(
33-
route_handlers=[root, health, base_controller],
24+
route_handlers=[health, base_controller],
3425
cors_config=CORSConfig(allow_origins=settings.ALLOWED_ORIGINS),
35-
plugins=[PydanticPlugin()],
3626
debug=settings.DEBUG,
3727
)
3828
{% endblock %}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
"""API controllers package."""
1+
from app.controllers.base import BaseController
2+
3+
__all__ = ["BaseController"]
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
"""Base API controller."""
2-
31
from litestar import Controller, get
42

53

@@ -11,7 +9,4 @@ class BaseController(Controller):
119
@get("/status")
1210
async def get_status(self) -> dict[str, str]:
1311
"""Get API status."""
14-
return {"status": "ok", "version": "1.0.0"}
15-
16-
17-
base_controller = BaseController
12+
return {"status": "ok"}

src/litestar_start/backends/litestar/templates/pyproject.toml.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "{{ project_slug }}"
33
version = "0.1.0"
44
description = "{{ description }}"
5-
requires-python = ">=3.12"
5+
requires-python = ">=3.13"
66
dependencies = [
77
{% for dep in dependencies | sort %}
88
"{{ dep }}",
@@ -20,7 +20,7 @@ packages = ["app"]
2020
line-length = 120
2121

2222
[tool.ruff.lint]
23-
select = ["E", "F", "I"]
23+
select = ["ALL"]
2424
ignore = []
2525

2626
[tool.pytest.ini_options]

0 commit comments

Comments
 (0)