Skip to content
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

DeprecationWarning with latest Sphinx: no_docstring is deprecated. #1443

Closed
mdickinson opened this issue Mar 5, 2021 · 2 comments · Fixed by #1475
Closed

DeprecationWarning with latest Sphinx: no_docstring is deprecated. #1443

mdickinson opened this issue Mar 5, 2021 · 2 comments · Fixed by #1475
Labels
component: trait-documenter Issues related to the trait-documenter Sphinx extension type: cleanup

Comments

@mdickinson
Copy link
Member

When running the Traits test suite with the latest Sphinx (3.5.1) from PyPI, I see the following DeprecationWarning:

/Users/mdickinson/Enthought/ETS/traits/traits/util/trait_documenter.py:80: RemovedInSphinx50Warning: The 'no_docstring' argument to TraitDocumenter.add_content() is deprecated.
@mdickinson
Copy link
Member Author

Here's the relevant Sphinx PR: sphinx-doc/sphinx#8533

@mdickinson
Copy link
Member Author

The fix may actually be very simple. The warning is coming from this code:

def add_content(self, more_content, no_docstring=False):
""" Never try to get a docstring from the trait."""
ClassLevelDocumenter.add_content(self, more_content, no_docstring=True)

But I can't figure out why that override was necessary in the first place: if I simply remove that method, the documentation build seems to succeed in the normal way. My best guesses are (a) that the override was needed in some ancient version of Sphinx (this piece of the code is, after all, 9 years old), and/or (b) that Sphinx is or was attempting to look up the __doc__ attribute on CTrait objects. Up until recently, that __doc__ lookup would have returned None, potentially causing difficulties further down the line. But as of #1469, such a lookup would raise an AttributeError, and so would behave like any other Python object lacking a __doc__.

@itziakos Any insights? Do you remember what problem the add_content override was solving?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: trait-documenter Issues related to the trait-documenter Sphinx extension type: cleanup
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant