Working with TODO in PyCharm

This post originally written for PhpStorm by Maarten Balliauw, our Jetbrains Technical Evangelist, highlights simple yet handy “TODO” feature available in our Python IDE as well:

When working on a project, it’s often desirable to create a list of tasks for yourself or your team mates. While usually these tasks are described in an issue tracker like YouTrack, some tasks are either too small or too code-specific to describe in an issue tracker. In such case, adding TODO comments in source code makes sense.

Many developers already use comments in their code to describe these small tasks, typically using a statement like the following:

PyCharm recognizes these comments and will automatically display them in the TODO tool Window (Alt+6 or View | Tool Windows | TODO):

From the TODO tool window, we can select a TODO comment and navigate to it by double-clicking it or using the Jump to Source context menu (F4).

There are a lot more features in PyCharm around TODO comments. Check our tutorials page for advanced topics like todo pattern recognition, live templates and todo filtering.

As always, we appreciate your feedback in the comments below or in our forum!

Note: This functionality is available in IntelliJ Idea, PyCharm, WebStorm, PhpStorm, RubyMine, and AppCode.

Develop with pleasure!
– PyCharm Team

About Dmitry Filippov

Product Marketing Manager at JetBrains
This entry was posted in Cool Feature. Bookmark the permalink.

24 Responses to Working with TODO in PyCharm

  1. Bob Stein says:

    If you are confounded as I was by “Found 0 TODO items in 0 files” take note of the tabs immediately above that message in the TODO view window. It probably highlights the most recent commit. Click instead on the Project tab or the Current File tab to get your TODO list.

  2. Varun Vats says:

    TODO comments inside docstrings aren’t picked up though.

  3. Varun Vats says:

    I know that TODOs are generally used and recognized only inside comments, but if say you want to remind yourself to add doctests and do something like the following, they won’t be recognized:

  4. Jason Wolosonovich says:

    recognizing multi-line TODO statements would be nice as well (without having to enter TODO again). I guess they’re not *really* necessary, however, I get pretty wordy with my TODO comments so that I can return (months) later and remember exactly what I wanted to add/change. Great feature overall though! Would be nice to recognize TODO inside of block comments (I know, submit a feature request). Loving PyCharm overall though, especially coming from Canopy. Once I got it dialed in, I haven’t given Canopy a second thought.

  5. Michel says:

    Add me for multi-line TODOs.

  6. Jonathan Sachs says:

    Yet another +1 for multi-line TODOs. Actually I found this page by looking for a way to use this not-yet-available feature.

    I wouldn’t favor Farouk Khawaja’s syntax, which blurs the distinction between a TODO comment and an ordinary one. I don’t have a firm preference, but I’d consider something like this:

    # TODO I need to remember…
    # ++ to see if anyone…
    # This is an ordinary comment that just happens to follow a TODO, but is not part of it.

  7. Vivek Subramanian says:

    Please incorporate multi-line TODO statements into the editor.

  8. Raul Valenzuela says:

    +1 for multi-line TODO campaign

  9. Ram R says:

    + 1 for multiline TODO

  10. jhesed says:

    +1 for multi-line TODO

  11. Mohamed Haseeb says:

    +1 for multiline TODO

Leave a Reply

Your email address will not be published. Required fields are marked *