mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-24 01:44:31 +02:00
- 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
18 lines
473 B
Python
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"""
|