sqlite-utils/sqlite_utils
Simon Willison 0bbc68089c
--functions can take filenames, can be used multiple times (#681)
Closes #659

The --functions option now accepts:
- File paths ending in .py (e.g., --functions my_funcs.py)
- Multiple invocations (e.g., --functions foo.py --functions 'def bar(): ...')
- Inline Python code (existing behavior)

Implementation follows the same pattern as llm's --functions flag
(simonw/llm@a880c123).

Changes:
- Added multiple=True to --functions Click option in query, bulk, and memory commands
- Modified _register_functions() to detect and read .py files
- Updated _maybe_register_functions() to iterate over multiple function sources
- Removed unused bytes/bytearray handling
- Added comprehensive tests for file paths and multiple invocations
- Updated documentation with examples

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Shorter help for --functions

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-23 21:46:51 -08:00
..
__init__.py prepare_connection plugin hook 2023-07-22 15:59:08 -07:00
__main__.py Support 'python -m sqlite_utils', closes #368 2022-01-08 18:33:22 -08:00
cli.py --functions can take filenames, can be used multiple times (#681) 2025-11-23 21:46:51 -08:00
db.py Use REAL not FLOAT as SQLite column type (#680) 2025-11-23 21:37:59 -08:00
hookspecs.py prepare_connection plugin hook 2023-07-22 15:59:08 -07:00
plugins.py More robust _called_from_test pattern 2023-07-22 16:21:27 -07:00
py.typed py.typed file so mypy picks up the types, closes #331 2021-11-14 15:21:04 -08:00
recipes.py Removed convert skip_false and --skip-false, closes #542 2025-11-23 15:40:28 -08:00
utils.py More consistent indentation 2024-01-14 09:27:58 -08:00