Skip to content

Commit f06a8dd

Browse files
committed
style: fix ruff lint
1 parent a966955 commit f06a8dd

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

src/python_cli/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
from __future__ import annotations
44

55
import typer
6-
from rich.console import Console
76
from loguru import logger
7+
from rich.console import Console
88

9+
from python_cli.commands.hello import hello
910
from python_cli.config import get_settings
1011
from python_cli.errors import AppError
1112
from python_cli.logging import configure_logging
1213
from python_cli.version import __version__
13-
from python_cli.commands.hello import hello
1414

1515
app = typer.Typer(no_args_is_help=True, help="Generic Python CLI scaffold")
1616
console = Console()

src/python_cli/config.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
from __future__ import annotations
44

55
from pathlib import Path
6-
from typing import Optional
76

8-
from pydantic import Field, SecretStr
7+
from pydantic import Field
98
from pydantic_settings import BaseSettings, SettingsConfigDict
109

1110

12-
def _find_env_file() -> Optional[Path]:
11+
def _find_env_file() -> Path | None:
1312
cwd_env = Path.cwd() / ".env"
1413
if cwd_env.exists():
1514
return cwd_env
@@ -26,7 +25,7 @@ class Settings(BaseSettings):
2625

2726
app_env: str = Field(default="dev", validation_alias="APP_ENV")
2827
log_level: str = Field(default="INFO", validation_alias="LOG_LEVEL")
29-
data_dir: Optional[Path] = Field(default=None, validation_alias="DATA_DIR")
28+
data_dir: Path | None = Field(default=None, validation_alias="DATA_DIR")
3029

3130
model_config = SettingsConfigDict(
3231
env_file=str(_find_env_file()) if _find_env_file() else None,

src/python_cli/logging.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import sys
66
from pathlib import Path
7+
78
from loguru import logger
89

910

@@ -14,11 +15,16 @@ def configure_logging(level: str = "INFO") -> None:
1415
logs_dir = Path.home() / ".python-cli" / "logs"
1516
logs_dir.mkdir(parents=True, exist_ok=True)
1617

18+
console_format = (
19+
"<green>{time:HH:mm:ss}</green> | <level>{level: <8}</level> | "
20+
"<cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> | "
21+
"<level>{message}</level>"
22+
)
1723
logger.add(
1824
sys.stderr,
1925
level=level,
2026
colorize=True,
21-
format="<green>{time:HH:mm:ss}</green> | <level>{level: <8}</level> | <cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> | <level>{message}</level>",
27+
format=console_format,
2228
)
2329

2430
logger.add(

0 commit comments

Comments
 (0)