Is your feature request related to a problem? Please describe.
I'm working on a project that aggregates docs from multiple repos by copying their content to a tempdir, and I have to move some namespaces around to properly lay them out logically. I'll illustrate the problem below, but TLDR, because Griffe looks for the package in the relative path by default, that interfere with my definitions and causes it to find the wrong definitions (depending on my current directory).
Now, clarifying the situation:
One of the repos, prj_cli, have a module called prj_main.cli.common and a reference to it as ::: prj_main.cli.common. That was a choice of prj_cli team, because its a "shared" plugin in the project and when installed together that makes sense. That worked well while the docs were not aggregated.
But now, they are all built together, and there is indeed a prj_main repository which has its own stuff. When making the aggregated tmpdir, I'm providing a way to merge over these $TMP/prj_cli/prj_main/cli/common to the $TMP/prj_main/ directory, so the reference prj_main.cli.common makes sense. And finally, I'm adding the prj_main tmp source location to mkdocstrings paths.
That trick is working, unless my CWD is in the true prj_main repository (for example, working on the docs in there), because then Griffe find prj_main in the relative path (and not in /tmp/.../my_prj), which doesn't contain my_prj.cli.common.
Describe the solution you'd like
To have a try_relative_path option in mkdocstring python handler to be passed to griffe.
Describe alternatives you've considered
- Coordinate with
prj_cli team to do it differently.
- Suggest a change in Griffe so the relative_path is tried as a last resource.
Additional context
I'll happily open a PR.
Is your feature request related to a problem? Please describe.
I'm working on a project that aggregates docs from multiple repos by copying their content to a tempdir, and I have to move some namespaces around to properly lay them out logically. I'll illustrate the problem below, but TLDR, because Griffe looks for the package in the relative path by default, that interfere with my definitions and causes it to find the wrong definitions (depending on my current directory).
Now, clarifying the situation:
One of the repos,
prj_cli, have a module calledprj_main.cli.commonand a reference to it as::: prj_main.cli.common. That was a choice ofprj_cliteam, because its a "shared" plugin in the project and when installed together that makes sense. That worked well while the docs were not aggregated.But now, they are all built together, and there is indeed a
prj_mainrepository which has its own stuff. When making the aggregated tmpdir, I'm providing a way to merge over these$TMP/prj_cli/prj_main/cli/commonto the$TMP/prj_main/directory, so the referenceprj_main.cli.commonmakes sense. And finally, I'm adding theprj_maintmp source location to mkdocstringspaths.That trick is working, unless my CWD is in the true
prj_mainrepository (for example, working on the docs in there), because then Griffe findprj_mainin the relative path (and not in /tmp/.../my_prj), which doesn't containmy_prj.cli.common.Describe the solution you'd like
To have a
try_relative_pathoption in mkdocstring python handler to be passed to griffe.Describe alternatives you've considered
prj_cliteam to do it differently.Additional context
I'll happily open a PR.