# Simplifying & documenting the Tutor Hooks API

**URL:** <https://discuss.openedx.org/t/simplifying-documenting-the-tutor-hooks-api/9258>\
**Category:** Dev Experience\
**Tags:** tutor, tutor-plugin\
**Created:** [January 31, 2023, 6:23pm UTC](https://discuss.openedx.org/t/simplifying-documenting-the-tutor-hooks-api/9258 "2023-01-31T18:23:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kmccormick](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/kmccormick/32/8982_2.png) [@kmccormick](https://discuss.openedx.org/u/kmccormick)\
**Post date:** [January 31, 2023, 6:23pm UTC](https://discuss.openedx.org/t/simplifying-documenting-the-tutor-hooks-api/9258/1 "2023-01-31T18:23:43Z")

</div>

Hey all, @regis recently merged some simplifications and documentation improvements to the hooks-based V1 Plugin API. The goal is to make the API more approachable and less ambiguous. We have removed or renamed parts of the API that were particularly susceptible to typos or type-unsafety.

### API changes

_These changes are live on the nightly and master branches of Tutor. They will be part of the next Tutor release in a few days._

The modules `tutor.hooks.actions`, `tutor.hooks.filters`, and `tutor.hooks.contexts` are no longer part of the API. This change should not affect most developers, who only use the `Actions` and `Filters` classes (notice the plural) from `tutor.hooks`. If it does affect you, though, then you can upgrade easily:

- Instead of `tutor.hooks.actions.get("some:action")`, use `tutor.hooks.Actions.SOME_ACTION`.
- Instead of `tutor.hooks.filters.get("some:filter")`, use `tutor.hooks.Filters.SOME_FILTER`.
- Instead of `tutor.hooks.actions.add("some:action")`, use `tutor.hooks.Actions.SOME_ACTION.add()`. The same applies to the `do` method.
- Instead of `tutor.hooks.filters.add("some:filter")`, use `tutor.hooks.Filters.SOME_FILTER.add()`. The same applies to the `add_item`, `add_items`, `apply`, and `iterate` methods.
- Instead of `tutor.hooks.contexts.enter`, use `tutor.core.hooks.contexts.enter`.

### Doc improvements

We’ve added a new landing page for Plugins and reorganized all hooks-related content under Reference.

In a few days, the changes will be visible on the [official docs site](https://docs.tutor.overhang.io/plugins/index.html#). If you want to see them now, you can:

- Check out Tutor’s `master` or `nightly` branch and git pull
- `pip install -r requirements/docs.txt`
- `make docs`
- Go to `file:///<path/to/tutor>/docs/_build/html/index.html` in your browser

---

<div class="post-metadata">

**Author:** ![regis](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/regis/32/2640_2.png) [@regis](https://discuss.openedx.org/u/regis)\
**Post date:** [February 1, 2023, 8:56am UTC](https://discuss.openedx.org/t/simplifying-documenting-the-tutor-hooks-api/9258/2 "2023-02-01T08:56:24Z")

</div>

Thanks for this write-up Kyle!

> [@kmccormick](#):
>
> _For plugins targeting the master branch of Tutor, they will be part of the **Palm** release in June._

Actually, the change will be part of Olive starting from the next Tutor release, which should happen in a few days. The change was merged into the master branch 🙂 This means that the changes will be visible in the docs very soon.

---

<div class="post-metadata">

**Author:** ![kmccormick](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/kmccormick/32/8982_2.png) [@kmccormick](https://discuss.openedx.org/u/kmccormick)\
**Post date:** [February 1, 2023, 6:29pm UTC](https://discuss.openedx.org/t/simplifying-documenting-the-tutor-hooks-api/9258/3 "2023-02-01T18:29:38Z")

</div>

> [@regis](#):
>
> Actually, the change will be part of Olive starting from the next Tutor release, which should happen in a few days. The change was merged into the master branch 🙂 This means that the changes will be visible in the docs very soon.

Whoops, you’re totally right! I corrected my post.

---

<div class="post-metadata">

**Author:** ![ABC](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/abc/32/4946_2.png) [@ABC](https://discuss.openedx.org/u/ABC)\
**Post date:** [May 8, 2024, 7:31pm UTC](https://discuss.openedx.org/t/simplifying-documenting-the-tutor-hooks-api/9258/4 "2024-05-08T19:31:41Z")

</div>

Is it documented anywhere yet what the translation is from “I want to change an entry in `cms/envs/common.py`” (e.g. [this](https://github.com/openedx/edx-platform/blob/9ca7c9a0b21b0fcf61405f7137e535230c1c988f/cms/envs/common.py#L1886)) to what the corresponding tutor made up string like “common-env-features” or “openedx-lms-common-settings” or “openedx-cms-common-settings” or “mfe-lms-common-settings” is?

I am _starting to infer_ that the “openedx-lms-common-settings” == “lms/envs/common.py” and “openedx-cms-common-settings” == “cms/envs/common.py”, but it’d be great if things were documented, rather than folks like me having to continuously guess and search the forums. It doesn’t help us to know the API if we can’t figure out the magic strings.
