sqlite-utils/sqlite_utils/hookspecs.py
Claude 83c50527aa
Add type hints to public APIs and configure mypy
- Improve mypy configuration with appropriate strictness settings
- Add comprehensive type hints to public API functions:
  - hookspecs.py: Type register_commands and prepare_connection hooks
  - plugins.py: Type get_plugins function and PluginManager
  - recipes.py: Type parsedate, parsedatetime, jsonsplit functions
  - utils.py: Type all public utility functions including rows_from_file,
    TypeTracker, ValueTracker, chunks, hash_record, flatten, etc.
  - db.py: Type Database, Queryable, Table, and View class methods
    including constructor, execute, query, table operations, etc.
- Exclude cli.py from strict checking (internal implementation detail)
- All public API modules now pass mypy type checking
2025-12-15 18:57:58 +00:00

18 lines
473 B
Python

import sqlite3
import click
from pluggy import HookimplMarker
from pluggy import HookspecMarker
hookspec = HookspecMarker("sqlite_utils")
hookimpl = HookimplMarker("sqlite_utils")
@hookspec
def register_commands(cli: click.Group) -> None:
"""Register additional CLI commands, e.g. 'sqlite-utils mycommand ...'"""
@hookspec
def prepare_connection(conn: sqlite3.Connection) -> None:
"""Modify SQLite connection in some way e.g. register custom SQL functions"""