Skip to content

Commit

Permalink
docs: extra hooks functions and utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
regisb committed Jan 23, 2024
1 parent 7fdc8fc commit a04d57f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
23 changes: 20 additions & 3 deletions docs/reference/api/hooks/index.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
.. _hooks_api:

==========
Hook types
==========
=========
Hooks API
=========

Types
=====

This is the Python documentation of the two types of hooks (actions and filters) as well as the contexts system which is used to instrument them. Understanding how Tutor hooks work is useful to create plugins that modify the behaviour of Tutor. However, plugin developers should almost certainly not import these hook types directly. Instead, use the reference :ref:`hooks catalog <hooks_catalog>`.

Expand All @@ -12,3 +15,17 @@ This is the Python documentation of the two types of hooks (actions and filters)
actions
filters
contexts

Utilities
=========

Functions
---------

.. autofunction:: tutor.core.hooks::clear_all

Priorities
----------

.. automodule:: tutor.core.hooks.priorities
:members: HIGH, DEFAULT, LOW
4 changes: 4 additions & 0 deletions tutor/core/hooks/priorities.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@

from typing_extensions import Protocol

#: High priority callbacks are triggered first.
HIGH = 5
#: By default, all callbacks have the same priority and are processed in the order they
#: were added.
DEFAULT = 10
#: Low-priority callbacks are called last. Add callbacks with this priority to override previous callbacks. To add callbacks with even lower priority, use ``LOW + somevalue`` (though such behaviour is not encouraged).
LOW = 50


Expand Down

0 comments on commit a04d57f

Please sign in to comment.