PyCharm and reStructuredText (Sphinx) documentation popups
Asked Answered
A

1

3

Let's imagine, I want to see a docstring popup for one simple method in PyCharm 4.5 Community Edition (tried also in 5.0).

I wrote down these docstrings in both epytext syntax (Epydoc generator is unsupported since 2008 and works only for Python2) and reStructuredText syntax (which is used by Sphinx - actively supported generator, used for offical python docs)

The epytext one works in PyCharm documentation popups perfectly

PyCharm works with epytext Screenshot

But the reStructuredText one doesn't show any parameters at all!

PyCharm fails with reStructuredText Screenshot

Trying to handle this with PyCharm settings, reading the PyCharm helps, searching through the PyCharm bugtracker and using Google couldn't help me to find the reason why these docstring popups in PyCharm don't work correctly with community-recommended docstring markup language.

Is this because of low demand of the feature? Perhaps, is there some useful alternatives to view the modern documentation markup inside PyCharm or even another IDE? I also need to be able to generate HTML pretty formatted docpages.

I've found another topic here, related to the same issue, but it is still unanswered since previous year. So, I'm guessing what's wrong with my desires to view modern documentation inside modern IDE.

Here are my code examples

def find_links(self, issue, link_type):
    """

    Find all issues linked with C{issue} with C{link_type}.

    @param issue: Issue key
    @type issue: str
    @param link_type: Accepts either Type Name (like 'Child') or Link Description (like 'child of')
    @type link_type: str
    @return: Keys of found issues
    @rtype: list

    """
    result_keys = []
    link_list = self.get_link_list(issue)
    for link in link_list:
        ... # omitted
    return result_keys

def test_sphinx_docs_method(self, issue, link_type):
    """

    Find all issues linked with *issue* with *link_type*.

    :param issue: Issue key
    :type issue: str
    :param link_type: Accepts either Type Name (like 'Child') or Link Description (like 'child of')
    :type link_type: str
    :return: Keys of found issues
    :rtype: list

    """
    result_keys = []
    link_list = self.get_link_list(issue)
    for link in link_list:
        ... # omitted
    return result_keys
Antefix answered 30/8, 2016 at 19:6 Comment(0)
O
1

I do not know if this feature present only in recent PyCharm versions so what version do you have? In my PyCharm CE 2016.2.2 it looks like on the screenshot.

enter image description here

Check Preferences > Editor > General > Code Completion, to be sure option "Autopop documentation" is enabled.

Good luck!

Olympe answered 2/9, 2016 at 5:31 Comment(1)
Thank you very much! Strange, but if download even a 2016.1 version from the pycharm site currently this feature works, and that one which my colleague has installed several months ago it won't! IDK exact reasons, probably there comes a recent patch for all thses version (I tested 5.0.2 and 5.0.5 and the latest one works with this feature too!)Antefix

© 2022 - 2024 — McMap. All rights reserved.