-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document replacement for sphinx.util.import_object #13083
Comments
If there is no alternative, maybe |
#12762 moved |
Within Sphinx, I initially deprecated the function as I am slowly trying to reduce the surface of our "public API", as ill-defined as that is currently, and the implementation of For me, "importing a dotted name" is sufficiently generic that I don't think Sphinx should be in the business of providing a utility function for it. However, given we have up until now (and will until at least Sphinx 10), I am open to un-deprecating it (but perhaps discouraging its use?). To your other points:
A |
I've run into this, namely that |
The replacement note is misleading. It’s not a full replacement, but only a starting point to build upon. AFAICS the list is autogenerated and does not allow for additional context information. In that case (and if there’s no undeprecation) it may be better to not state a replacement at all. |
Describe the bug
According to https://www.sphinx-doc.org/en/master/extdev/deprecated.html,
sphinx.util.import_object
is deprecated andimportlib.import_module
is suggested as alternative.However,
sphinx.util.import_object
, does much more:sphinx/sphinx/util/_importer.py
Lines 9 to 27 in 116a430
Am I supposed to copy all that code into my extension?
Or is there another (shorter) replacement?
Either way, this information should be added to the docs.
How to Reproduce
Use
sphinx.util.import_object()
. This will give a warning:Look for
CHANGES
-> not foundtry CHANGES.rst -> the relevant content isn't there
try doc/changes/8.1.rst ->
importlib.import_module
is suggesteduse
importlib.import_module
-> doesn't work, because it provides only a small part of original functionalityEnvironment Information
Sphinx extensions
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: