mitmproxy/docs
ChrisJr404 0fb62c456c
docs: document addon live-reload + testing pattern (#8210)
* docs: document addon live-reload + testing pattern

Issue #6377 asked for addon development docs covering hot reload and
testing. mitmproxy already watches scripts loaded with -s for changes
and re-imports them on save (mitmproxy/addons/script.py: Script.watcher
and the unconditional Script(s, True) at line 218), but that behavior
was undocumented, and there was no canonical example of how to unit-test
a custom addon with mitmproxy.test.taddons / mitmproxy.test.tflow.

Add a "Developing Addons" section to docs/src/content/addons/overview.md
with two subsections:

- Live Reloading: explains the file-watcher behavior, including which
  errors leave the previous version unloaded and which don't.
- Testing Addons: a small example that unit-tests the Counter addon from
  anatomy.py using taddons.context() and tflow.tflow(), plus a pointer
  to tctx.cycle() and the existing test/mitmproxy/addons/ tests for
  patterns that need the full event sequence.

No code changes.

* reduce testing section

Testing helpers are currently a bit ugly and not part of the public API, so let's not put them front center in the docs.

---------

Co-authored-by: Chris (ChrisJr404) <11917633+ChrisJr404@users.noreply.github.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2026-05-11 14:18:51 +00:00
..
bucketassets
raw
scripts introduce new contentview API (#7623) 2025-04-21 14:56:58 +02:00
src docs: document addon live-reload + testing pattern (#8210) 2026-05-11 14:18:51 +00:00
.gitignore
build.py Use sys.executable instead of python3 in docs build script (#8183) 2026-04-19 14:50:02 +02:00
modd.conf
README.md Update README.md (#7594) 2025-03-09 11:02:09 +01:00
setup.sh
upload-archive.sh
upload-stable.sh

Mitmproxy Documentation

This directory houses the mitmproxy documentation available at https://docs.mitmproxy.org/.

Prerequisites

  1. Install hugo "extended".
  2. Windows users: Depending on your git settings, you may need to manually create a symlink from /docs/src/examples to /examples.

Editing docs locally

  1. Make sure the mitmproxy Python package is installed and the virtual python environment was activated. See CONTRIBUTING.md for details.
  2. Run ./docs/build.py to generate additional documentation source files.
  3. Now you can change your working directory to ./docs/src and run hugo server -D.