Add sqlite capabilities to wheke with sqlmodel
0

Configure Feed

Select the types of activity you want to include in your feed.

Start project

Humberto Rocha (Dec 26, 2025, 1:13 PM EST) f4813bf9

+218
+14
.gitignore
··· 1 + # Python-generated files 2 + __pycache__/ 3 + *.py[oc] 4 + build/ 5 + dist/ 6 + wheels/ 7 + *.egg-info 8 + 9 + # Virtual environments 10 + .venv 11 + 12 + # UV files 13 + uv.lock 14 + .python-version
+3
README.md
··· 1 + # Wheke Sqlite 2 + 3 + Add sqlite capabilities to wheke with sqlmodel
+121
pyproject.toml
··· 1 + [project] 2 + name = "wheke-sqlite" 3 + version = "0.0.1" 4 + description = "Add sqlite capabilities to wheke with sqlmodel" 5 + readme = "README.md" 6 + requires-python = ">=3.13" 7 + dependencies = [ 8 + "sqlmodel", 9 + "wheke", 10 + ] 11 + 12 + [dependency-groups] 13 + dev = [ 14 + "isort", 15 + "mypy", 16 + "pytest", 17 + "pytest-cov", 18 + "ruff", 19 + ] 20 + 21 + [tool.coverage.run] 22 + relative_files = true 23 + branch = true 24 + parallel = true 25 + omit = [] 26 + 27 + [tool.coverage.report] 28 + exclude_lines = [ 29 + "no cov", 30 + "if __name__ == .__main__.:", 31 + "if TYPE_CHECKING:", 32 + ] 33 + 34 + [tool.isort] 35 + profile = "black" 36 + skip = [ 37 + ".env", 38 + ".hatch", 39 + ".mypy_cache", 40 + ".venv", 41 + "__pycache__", 42 + "env", 43 + "venv", 44 + ] 45 + 46 + [tool.mypy] 47 + disallow_incomplete_defs = true 48 + check_untyped_defs = true 49 + warn_unused_ignores = true 50 + exclude = """ 51 + .env 52 + | .hatch 53 + | .mypy_cache 54 + | .venv 55 + | __pycache__ 56 + | env 57 + | venv 58 + """ 59 + 60 + [tool.ruff] 61 + exclude = [ 62 + ".env", 63 + ".hatch", 64 + ".mypy_cache", 65 + ".venv", 66 + "__pycache__", 67 + "env", 68 + "venv", 69 + ] 70 + 71 + [tool.ruff.lint] 72 + select = [ 73 + "A", 74 + "ARG", 75 + "B", 76 + "C", 77 + "DTZ", 78 + "E", 79 + "EM", 80 + "F", 81 + "FBT", 82 + "I", 83 + "ICN", 84 + "ISC", 85 + "N", 86 + "PLC", 87 + "PLE", 88 + "PLR", 89 + "PLW", 90 + "Q", 91 + "RUF", 92 + "S", 93 + "T", 94 + "TID", 95 + "UP", 96 + "W", 97 + "YTT", 98 + ] 99 + ignore = [ 100 + # Same line string implicit string concatenation 101 + "ISC001", 102 + # Allow non-abstract empty methods in abstract base classes 103 + "B027", 104 + # Ignore checks for possible passwords 105 + "S105", "S106", "S107", 106 + # Ignore complexity 107 + "C901", "PLR0911", "PLR0912", "PLR0913", "PLR0915", 108 + # Relative imports 109 + "TID252", 110 + ] 111 + unfixable = [ 112 + # Don't touch unused imports 113 + "F401", 114 + ] 115 + 116 + [tool.ruff.lint.isort] 117 + known-first-party = ["wheke_sqlite"] 118 + 119 + [tool.ruff.lint.per-file-ignores] 120 + # Tests can use magic values, assertions, and relative imports 121 + "tests/**/*" = ["PLR2004", "S101", "TID252"]
+8
src/wheke_sqlite/__init__.py
··· 1 + from ._service import DatabaseService, get_database_service 2 + from ._settings import DatabaseSettings 3 + 4 + __all__ = [ 5 + "DatabaseService", 6 + "DatabaseSettings", 7 + "get_database_service", 8 + ]
+19
src/wheke_sqlite/_cli.py
··· 1 + import typer 2 + from rich.console import Console 3 + from typer import Context 4 + from wheke import get_container 5 + 6 + from wheke_sqlite._service import get_database_service 7 + 8 + cli = typer.Typer(short_help="Database commands") 9 + console = Console() 10 + 11 + 12 + @cli.command() 13 + def create_db(ctx: Context) -> None: 14 + container = get_container(ctx) 15 + database_service = get_database_service(container) 16 + 17 + console.print("Creating sqlite database...") 18 + 19 + database_service.create_db()
+12
src/wheke_sqlite/_pod.py
··· 1 + from wheke import Pod, ServiceConfig 2 + 3 + from ._cli import cli 4 + from ._service import DatabaseService, database_service_factory 5 + 6 + core_pod = Pod( 7 + "database", 8 + services=[ 9 + ServiceConfig(DatabaseService, database_service_factory, as_value=True), 10 + ], 11 + cli=cli, 12 + )
+31
src/wheke_sqlite/_service.py
··· 1 + from sqlalchemy import Engine 2 + from sqlmodel import Session, SQLModel, create_engine 3 + from svcs import Container 4 + from wheke import WhekeSettings, get_service, get_settings 5 + 6 + from ._settings import DatabaseSettings 7 + 8 + 9 + class DatabaseService: 10 + settings: DatabaseSettings 11 + 12 + engine: Engine 13 + 14 + def __init__(self, *, database_settings: DatabaseSettings) -> None: 15 + self.engine = create_engine(database_settings.connection_string) 16 + 17 + @property 18 + def session(self) -> Session: 19 + return Session(self.engine) 20 + 21 + def create_db(self) -> None: 22 + SQLModel.metadata.create_all(self.engine) 23 + 24 + 25 + def database_service_factory(container: Container) -> DatabaseService: 26 + settings = get_settings(container, WhekeSettings).get_feature(DatabaseSettings) 27 + return DatabaseService(database_settings=settings) 28 + 29 + 30 + def get_database_service(container: Container) -> DatabaseService: 31 + return get_service(container, DatabaseService)
+9
src/wheke_sqlite/_settings.py
··· 1 + from typing import ClassVar 2 + 3 + from wheke import FeatureSettings 4 + 5 + 6 + class DatabaseSettings(FeatureSettings): 7 + __feature_name__: ClassVar[str] = "database" 8 + 9 + connection_string: str = "sqlite:///database.db"
src/wheke_sqlite/py.typed

This is a binary file and will not be displayed.

+1
tests/__init__.py
··· 1 +