Replies: 5 comments 6 replies
|
@pawamoy Thanks for notifying! Very clear on what is going to change. I've already got a PR prepared watermarkhu/mkdocstrings-matlab#45. |
3 replies
|
Wow, this is amazingly considerate. I would appreciate a PR on https://github.com/mkdocstrings/vba but I don't want to make my problems yours, so I'll see when I can get to it to do it myself. |
1 reply
|
Also tagging @terrelln for the zstd custom handler 🙂 |
0 replies
|
For reference:
|
0 replies
|
I think I'll do one more thing before releasing: I'll check if your |
2 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.
Uh oh!
There was an error while loading. Please reload this page.
@oprypin (crystal), @rudolfbyker (vba), @analog-cbarber (python-xref), @jmlopez-rod (m_cli), @drehstromer (twincat), @watermarkhu (matlab)...
Hi fellow handler maintainers! 🙂
I'm tagging you to let you know that the upcoming mkdocstrings version will deprecate a few things, and will (probably) require updates to your handlers.
Here is the planned changelog entry (click to unfold)
0.28.0 - 2025-01-12
Compare with 0.27.0
Breaking Changes
Although the following changes are "breaking" in terms of public API, we didn't find any public use of these classes and methods on GitHub.
mkdocstrings.extension.AutoDocProcessor.__init__(parser): Parameter was removedmkdocstrings.extension.AutoDocProcessor.__init__(md): Positional parameter was movedmkdocstrings.extension.AutoDocProcessor.__init__(config): Parameter was removedmkdocstrings.extension.AutoDocProcessor.__init__(handlers): Parameter kind was changed:positional or keyword->keyword-onlymkdocstrings.extension.AutoDocProcessor.__init__(autorefs): Parameter kind was changed:positional or keyword->keyword-onlymkdocstrings.extension.MkdocstringsExtension.__init__(config): Parameter was removedmkdocstrings.extension.MkdocstringsExtension.__init__(handlers): Positional parameter was movedmkdocstrings.extension.MkdocstringsExtension.__init__(autorefs): Positional parameter was movedmkdocstrings.handlers.base.Handlers.__init__(config): Parameter was removedmkdocstrings.handlers.base.Handlers.__init__(theme): Parameter was added as requiredmkdocstrings.handlers.base.Handlers.__init__(default): Parameter was added as requiredmkdocstrings.handlers.base.Handlers.__init__(inventory_project): Parameter was added as requiredmkdocstrings.handlers.base.Handlers.__init__(tool_config): Parameter was added as requiredSimilarly, the following parameters were renamed, but the methods are only called from our own code, using positional arguments.
mkdocstrings.handlers.base.BaseHandler.collect(config): Parameter was renamedoptionsmkdocstrings.handlers.base.BaseHandler.render(config): Parameter was renamedoptionsFinally, the following method was removed, but this is again taken into account in our own code:
mkdocstrings.handlers.base.BaseHandler.get_anchors: Public object was removedFor these reasons, and because we're still in v0, we do not bump to v1 yet. See following deprecations.
Deprecations
mkdocstrings 0.28 will start emitting these deprecations warnings:
Previously, the
get_handlerfunction would pass ahandler(name) argument to the handler constructor. This name must now be set on the handler's class directly.The
domainclass attribute on handlers is now mandatory and cannot be an empty string.This argument could previously be passed as a positional argument (from the
get_handlerfunction), and must now be passed as a keyword argument.Same as for
theme, but withcustom_templates.The
get_handlerfunction now receives amdxargument, which it must forward to the handler constructor and then to the base handler, either explicitly or through**kwargs:=== "Explicitly"
=== "Through
**kwargs"In the meantime we still retrieve this
mdxvalue at a different moment, by reading it from the MkDocs configuration.Same as for
mdx, but withmdx_config.Previously, mkdocstrings would pop the
importkey from a handler's configuration to download each item (URLs). Items could be strings, or dictionaries with aurlkey. Now mkdocstrings gives back control to handlers, which must store this inventory configuration within them, and expose it again through aget_inventory_urlsmethod. This method returns a list of tuples: an URL, and a dictionary of options that will be passed again to theirload_inventorymethod. Handlers have now full control over the "inventory" setting.Changing the name of the key (for example from
importtoinventories) involves a change in user configuration, and both keys will have to be supported by your handler for some time.This comes from mkdocstrings and mkdocs-autorefs, and will disappear with mkdocstrings v1.
Handlers must now store their own global options (in an instance attribute), and implement a
get_optionsmethod that receiveslocal_options(a dict) and returns combined options (dict or custom object). These combined options are then passed tocollectandrender, so that these methods can use them right away.Handlers can remove the
mdparameter from theirupdate_envmethod implementation, and useself.mdinstead, if they need it.Handlers don't have to call the parent
update_envmethod from their own implementation anymore, and can just drop the call.Previously, handlers would implement a
get_anchorsmethod that received a data object (typedCollectorItem) to return aliases for this object. This forced mkdocstrings to collect this object through the handler'scollectmethod, which then required some logic with "fallback config" as to prevent unwanted collection. mkdocstrings gives back control to handlers and now callsget_aliasesinstead, which accepts anidentifier(string) and lets the handler decide how to return aliases for this identifier. For example, it can replicate previous behavior by calling its owncollectmethod with its own "fallback config", or do something different (cache lookup, etc.).Most of these warnings will disappear with the next version of mkdocstrings-python.
Other Impactful Changes
The
config_file_pathargument is not passed toget_handlerfunctions anymore. If you used it to compute a "base directory", you can now use thetool_configargument instead, which is the configuration of the SSG tool in use (here MkDocs):Bug Fixes
Code Refactoring
get_anchorsmethod in favor ofget_aliasesmethod (7a668f0 by Timothée Mazzucotelli).These changes are already pushed to the main branch, so you can test them if you want.
I'm trying to untangle mkdocstrings, handlers and autorefs, as well as decoupling mkdocstrings from MkDocs (plus general improvements), hence all these refactors.
Nothing is set in stone, we can still revise things before I publish v0.28.
I can send PRs to your respective projects, let me know 🙂
The "buy-more-time" solution is to add an upper bound on mkdocstrings 0.28 in your dependencies specification.
That's it! I'll give you time to read this, happy to answer any question you might have 👍
All reactions