Skip to content

[low quality ai submission] docs: add directory plugin discovery example - #786

Closed
starx710 wants to merge 1 commit into
pytest-dev:mainfrom
starx710:docs/directory-plugin-example-258
Closed

starx710 wants to merge 1 commit into
pytest-dev:mainfrom
starx710:docs/directory-plugin-example-258

Conversation

@starx710

Copy link
Copy Markdown

The introductory examples show a single-module host and entry-point plugins, but do not show how a host can discover plugin files in a directory. Add a runnable greetings example between the complete example and the real-world references, with separate host, hookspecs and plugin modules.

The host uses pkgutil.iter_modules() and importlib.import_module(), sorts module names before registration, and skips subpackages. The documentation explains that discovery belongs to the host, how registration order relates to ordinary hook call order, and when entry-point loading is appropriate. Adding another plugin file requires no host changes. Pluggy's implementation and public APIs are unchanged.

Refs #258. This addresses the directory-discovery example requested in the issue; broader documentation restructuring is outside this change.

Validation on Windows / CPython 3.12.13:

  • Full suite: 221 passed, including two new subprocess tests exercising the documented command, output order, discovery of an added plugin and skipping subpackages.
  • All configured pre-commit hooks pass.
  • Strict Sphinx HTML build passes with -W and the Towncrier draft enabled (Sphinx 7.4.7); no warnings are suppressed for this change.

OpenAI Codex assisted with implementation and local validation. No independent human review is claimed.

@RonnyPfannschmidt RonnyPfannschmidt changed the title docs: add directory plugin discovery example [low quality ai submission] docs: add directory plugin discovery example Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants