I've hit a bit of a wall with the mkdocstring plugin as it does not seem to load modules as I would have expected.
My folder structure is as such:
docs/
api.md
src/
module/
somemodule.py
The api.md file looks like this:
# API Documentation
::: module.somemodule.MyClass
handler: python
The error I get is this:
% mkdocs build 1 ↵ ✹
INFO - Cleaning site directory
INFO - Building documentation to directory: /site
ERROR - mkdocstrings: No module named 'module'
ERROR - Error reading page 'api.md':
ERROR - Could not collect 'module.somemodule.MyClass'
What I have found in testing:
Is there some kind of config setting I need to set with the plugin in the mkdocs.yml to get it to recognize the module in the src folder? All the example I have come across seem to either be outdated or don't work.
Since your package lives under the src folder, you might need to configure the Python handler of mkdocstrings so that it can find it, see https://mkdocstrings.github.io/python/usage/#paths and https://mkdocstrings.github.io/python/usage/#finding-modules.
plugins:
- mkdocstrings:
handlers:
python:
paths: [src] # search packages in the src folder
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With