kopia lustrzana https://github.com/simonw/datasette
click-default-group>=1.2.3 (#2173)
* click-default-group>=1.2.3 Now available as a wheel: - https://github.com/click-contrib/click-default-group/issues/21 * Fix for blacken-docspull/2166/head
rodzic
31d5c4ec05
commit
05707aa16b
|
@ -343,6 +343,7 @@ To define additional hooks, add a file to the plugin called ``datasette_your_plu
|
|||
|
||||
hookspec = HookspecMarker("datasette")
|
||||
|
||||
|
||||
@hookspec
|
||||
def name_of_your_hook_goes_here(datasette):
|
||||
"Description of your hook."
|
||||
|
@ -366,10 +367,13 @@ Within your plugin code you can trigger the hook using this pattern:
|
|||
|
||||
from datasette.plugins import pm
|
||||
|
||||
for plugin_return_value in pm.hook.name_of_your_hook_goes_here(
|
||||
for (
|
||||
plugin_return_value
|
||||
) in pm.hook.name_of_your_hook_goes_here(
|
||||
datasette=datasette
|
||||
):
|
||||
# Do something with plugin_return_value
|
||||
pass
|
||||
|
||||
Other plugins will then be able to register their own implementations of your hook using this syntax:
|
||||
|
||||
|
@ -377,6 +381,7 @@ Other plugins will then be able to register their own implementations of your ho
|
|||
|
||||
from datasette import hookimpl
|
||||
|
||||
|
||||
@hookimpl
|
||||
def name_of_your_hook_goes_here(datasette):
|
||||
return "Response from this plugin hook"
|
||||
|
|
2
setup.py
2
setup.py
|
@ -44,7 +44,7 @@ setup(
|
|||
install_requires=[
|
||||
"asgiref>=3.2.10",
|
||||
"click>=7.1.1",
|
||||
"click-default-group-wheel>=1.2.2",
|
||||
"click-default-group>=1.2.3",
|
||||
"Jinja2>=2.10.3",
|
||||
"hupper>=1.9",
|
||||
"httpx>=0.20",
|
||||
|
|
Ładowanie…
Reference in New Issue