Is it possible to get the public API (as defined by what is documented)? #745
Unanswered
patrick-kidger
asked this question in
Q&A
Replies: 1 comment 6 replies
-
Thanks for explaining the use-case :) mkdocstrings generates an |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
Given some documentation:
I'd like to be able to collect up the public API -- as defined by what is documented -- to obtain
["somelib.Foo", "somelib.Foo.f", "somelib.Foo.g", "somelib.bar", "somelib.sublib.baz"]
.Does mkdocstrings offer a clean way to do this?
Current best workaround
Right now I have a custom mkdocs plugin that runs
mkdocstrings.AutoDocProcessor.regex
over all file contents duringmkdocs.BasePlugin.on_files
. This collects up all::: foo
, but does not collectmembers
, or handle anyfilters
.If I have to then I'll jam together a standalone reimplementation of mkdocstring's filtering and blockparsing logic -- but I'm hoping there's a better way than that!
Why I want this
Knowing the public API -- as defined by the documentation -- is useful to canonicalise the base classes shown with
show_bases: true
, or the type annotations for function parameters. (Which can be done by feeding this public API into a Griffe extension.)For context I take the approach that the public API is what is defined in the documentation, and that it is not something which can be determined from the code. This is because we have the case that (and it is anyway pretty common) that the same object is publicly available under both
somelib.oldlib.Foo
andsomelib.newlib.Foo
for backward compatibility purposes.Beta Was this translation helpful? Give feedback.
All reactions