mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
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-docs
This commit is contained in:
parent
31d5c4ec05
commit
05707aa16b
2 changed files with 7 additions and 2 deletions
|
|
@ -343,6 +343,7 @@ To define additional hooks, add a file to the plugin called ``datasette_your_plu
|
||||||
|
|
||||||
hookspec = HookspecMarker("datasette")
|
hookspec = HookspecMarker("datasette")
|
||||||
|
|
||||||
|
|
||||||
@hookspec
|
@hookspec
|
||||||
def name_of_your_hook_goes_here(datasette):
|
def name_of_your_hook_goes_here(datasette):
|
||||||
"Description of your hook."
|
"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
|
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
|
datasette=datasette
|
||||||
):
|
):
|
||||||
# Do something with plugin_return_value
|
# Do something with plugin_return_value
|
||||||
|
pass
|
||||||
|
|
||||||
Other plugins will then be able to register their own implementations of your hook using this syntax:
|
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
|
from datasette import hookimpl
|
||||||
|
|
||||||
|
|
||||||
@hookimpl
|
@hookimpl
|
||||||
def name_of_your_hook_goes_here(datasette):
|
def name_of_your_hook_goes_here(datasette):
|
||||||
return "Response from this plugin hook"
|
return "Response from this plugin hook"
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -44,7 +44,7 @@ setup(
|
||||||
install_requires=[
|
install_requires=[
|
||||||
"asgiref>=3.2.10",
|
"asgiref>=3.2.10",
|
||||||
"click>=7.1.1",
|
"click>=7.1.1",
|
||||||
"click-default-group-wheel>=1.2.2",
|
"click-default-group>=1.2.3",
|
||||||
"Jinja2>=2.10.3",
|
"Jinja2>=2.10.3",
|
||||||
"hupper>=1.9",
|
"hupper>=1.9",
|
||||||
"httpx>=0.20",
|
"httpx>=0.20",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue