I am looking for a Python IDE which can generate the docstrings framework for me automatically.
For example:
def GetTextByCtrlName(self, _hwnd, _ctrName):
'''
#desc:
#param:
_hwnd
_ctrName
'''
Then I can just fill the corresponding content.
PyCharm has supported this since version 1.5.
First, configure the format you want the docstring to be generated. Hit CTRL+ALT+S (on Windows), select the format in Project Settings > Python Integrated Tools.
Your choices are plain, Epydoc or reStructuredText
Once that is configured, make sure your cursor is on the method name and press Alt+Enter.
You could use a tool like Sphinx. It's designed to specifically document python code, although it doesn't offer a friendly IDE integration.
Related
Goal: generate docstring in vscode for Python automatically and format the generated docstring to my liking.
Solution: I installed the autoDocstring extension.
Problem: I don't know how to get the generated docstring to be formatted the way I want it. In the description under the "Extension Settings" heading, it seems to suggest that you can change the default format with the "autoDocstring.docstringFormat" setting. My question is, how does one configure that setting? I've looked around and cannot find a solution.
You have to go to:
File > Preferences > Settings in Windows/Linux
Code > Preferences > Settings in Mac
Then choose at the right side of the open document if you want to change the configuration for all the user sessions or only this workspace.
The workspace case would be:
{
"autoDocstring.docstringFormat": "sphinx"
}
When moving the mouse around the option, a little pencil appears that shows all the accepted values for the option.
This answer is almost the same as PyCharm generates on vscode with this shortcut
ctrl+sfhit+2
{
"autoDocstring.docstringFormat": "sphinx"
}
I'm using PyCharm 3.4.1 and learning MongoDB from Mongo University. In the code, they have us using Python to create html pages using the MVC pattern with bottle.
When I add a file of type .tpl to the editor in PyCharm, there is no "intellisense" or support for the model in the code. Changing it to be in the list of html file types helps some, but no python support in the editor.
Is there a plugin or some other change i can make to support editing better? Seems someone else asked something similar earlier in the year at How to get tpl files highlighted in pycharm?
Bottle comes with a built-in template engine called SimpleTemplate which is not currently supported by PyCharm.
There is a relevant feature request: Bottle microframework support, but it doesn't explicitly state about .tpl syntax support.
I'd go and create a feature request in PyCharm's issue tracker asking about SimpleTemplate syntax support or, at least, vote up and comment in the existing issue.
For example, there is the similar feature-request for tornado template engine:
Add Tornado Template Support
It has currently 56 votes up which is probably increasing the possibility of seeing it happen.
As a workaround, you can configure .tpl file type under Settings -> File Types. It is possible to set highlighting rules there.
I'd like to be able to use Sphinx for the main project documentation, so the docstrings must be in reStructuredText, but I'd also like to generate HTML for reading the inline comments in the style of Pycco, which uses Markdown.
Is there a tool or combination of tools that will allow me to do convert only the docstrings from reStructuredText to Markdown?
The pyment tool can convert docstrings to different formats. You could start with that, and then write a subclass of DocToolsBase to format docstrings the way you like.
See this question What is the standard Python docstring format? for more about python docstring conventions and tooling.
A software called Pandoc may be the right tool. You can see the detail in the page through the hyperlink. I ever wanted to have try of it, but it needs Haskell runtime environment which is a little big, so I gave up.
I just switched from Eclipse/PyDev to PyCharm 3 CE. I can't get the live templates working any ways. Followed every documentation I can find online like this:
http://www.jetbrains.com/pycharm/webhelp/live-templates.html
And the builtin python template super(Generates a 'super' call) does not work either.
By "not working", I meant that when editing a python file in PyCharm and typing the abbreviation, the popup snippets list does not include the live templates, even though they are under the Python template group.
Am I missing something?
I am using PyCharm 3.1 Professional (evaluation version) and am having the same issue.
However, using Ctrl+J will bring up templates as will Code -> Insert Live Template. It is also possible to start typing a code snippet and then press Ctrl+J to see a filtered list of templates.
Don't forget to also select the "context"...
I am looking for a help viewer like Windows CHM that basically provides support for
adding content in HTML format
define Table of Contents
decent search
It should work on Windows, Mac and Linux. Bonus points for also having support for generating a "plain HTML/javascript" version that can be viewed in any browser (albeit without search support).
Language preference: Python
wxHtmlHelpController, which is part of wxWidgets, is a cross-platform viewer for HtmlHelp.
I'm not sure how easy it is to use it from a non-wxWidgets program, but I think it can be done.
wxHtmlHelpController doesn't support any scripting within pages, nor does it support css.