mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-12 03:24:23 +02:00
- Add type: ignore for monkey-patching Database.__init__ in conftest - Fix CLI test to pass string "2" instead of integer to Click invoke - Add type: ignore for optional sqlean import - Fix add_geometry_column test to use "XY" instead of integer 2 - Add type: ignore for click.Context as context manager - Add type: ignore for enable_fts test that intentionally omits argument - Add type: ignore for sys._called_from_test dynamic attribute - Fix rows_from_file test type error for intentional wrong argument - Handle None from pm.get_hookcallers in plugins.py 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
27 lines
811 B
Python
27 lines
811 B
Python
import pluggy
|
|
import sys
|
|
from . import hookspecs
|
|
|
|
pm = pluggy.PluginManager("sqlite_utils")
|
|
pm.add_hookspecs(hookspecs)
|
|
|
|
if not getattr(sys, "_called_from_test", False):
|
|
# Only load plugins if not running tests
|
|
pm.load_setuptools_entrypoints("sqlite_utils")
|
|
|
|
|
|
def get_plugins():
|
|
plugins = []
|
|
plugin_to_distinfo = dict(pm.list_plugin_distinfo())
|
|
for plugin in pm.get_plugins():
|
|
hookcallers = pm.get_hookcallers(plugin) or []
|
|
plugin_info = {
|
|
"name": plugin.__name__,
|
|
"hooks": [h.name for h in hookcallers],
|
|
}
|
|
distinfo = plugin_to_distinfo.get(plugin)
|
|
if distinfo:
|
|
plugin_info["version"] = distinfo.version
|
|
plugin_info["name"] = distinfo.project_name
|
|
plugins.append(plugin_info)
|
|
return plugins
|