Files
Mathew Sir Guest the bestandClaude Opus 4.6 4d681a92ca docs: add Google-style docstrings and Sphinx autodoc setup
Add concise docstrings to all Python modules, classes, and public
functions. Configure Sphinx with napoleon extension for Google-style
docstring parsing and autodoc pages for each module.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-06 23:06:37 -06:00

28 lines
637 B
Python

"""SQLAlchemy engine and session factory setup."""
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from models import Base
DB_PATH = "sqlite:///wordsearch.db"
def get_engine(db_url=None):
"""Create a SQLAlchemy engine.
Args:
db_url: Database URL. Defaults to ``sqlite:///wordsearch.db``.
"""
return create_engine(db_url or DB_PATH)
def get_session_factory(engine):
"""Return a sessionmaker bound to the given engine."""
return sessionmaker(bind=engine)
def init_db(engine):
"""Create all tables defined in the ORM models."""
Base.metadata.create_all(engine)