Can I prefer my own code when there are duplicated module names? #248
-
First, I'm a big fan of this plugin, thank you to the author and contributors. Here's my question: when searching for a module, if there are multiple modules on the path with the same name, can I configure the plugin to prefer my source code over modules installed in site-packages? I've got a project set up as follows:
I'm trying to collect documentation from my tests root. tests.md looks like this:
I believe mkdocs.yml is correctly configured: plugins:
- mkdocstrings:
handlers:
python:
paths: [.] When I render these docs, other python source is correctly collected/rendered, but "tests" is not.
From manually looking at this path, it seems like this originates from one of my 3rd party dependencies, a bibtex parser package. I'm hoping there is an easy way to configure the plugin to prioritize my modules. (edit) I've also tried setting "paths" to Thanks in advance for any help! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hi @jwarwick-delfi thank you for the kind words! ❤️ From looking at your config it should pick up the Do you have a public repository I can try things on? |
Beta Was this translation helpful? Give feedback.
-
Confirmed, your update works for me - thank you so much, especially for the quick response and turnaround! |
Beta Was this translation helpful? Give feedback.
Thanks! Found the issue. We build the list of search paths by concatenating the user provided paths to
sys.path
. But when inserting in the final list, we check if the path is not already present, and in this case, it's already present, but in last position. In the end site-packages had precedence over the current folder. Will push a fix to mkdocstrings-python right now 🙂