Working with TODO in PyCharm

Dmitry Filippov

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

Comments below can no longer be edited.

24 Responses to Working with TODO in PyCharm

  1. Bob Stein says:

    May 6, 2015

    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:

    May 22, 2015

    TODO comments inside docstrings aren’t picked up though.

  3. Varun Vats says:

    May 22, 2015

    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:

    def method_abc():
        """
        Method description.
    
        Examples
        ------------
        TODO: Add examples
        """
        pass
    
  4. Jason Wolosonovich says:

    August 21, 2015

    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.

    • Arijeet Mukherjee says:

      November 1, 2015

      +1 for multiline TODOs. I tend to put down exact requirements into Todos. Would be a nice feature.

    • Gary Robinson says:

      January 11, 2016

      +1. I often wish I could extend a TODO to more than one line.

    • Brodie Kurczynski says:

      February 5, 2016

      +1 for multi-line TODO. Trying to change the regex pattern for this, but it won’t match newlines.

    • Jonathan Owens says:

      February 15, 2016

      +1 for multiline TODOs, as well. Would make it a lot easier to have longer TODOs and wold look more aesthetically pleasing in the editor.

    • Farouk Khawaja says:

      February 19, 2016

      +1 for multi-line TODO statements.
      Ideally they’d look like this.

      # TODO: I need to remember to come back to this question next week
      # to see if anyone from JetBrains has responded.

    • Or Duan says:

      October 24, 2016

      +1 for multiline todo!

      • Azat Ibrakov says:

        December 24, 2016

        +1 I miss it so much

    • Dmitry says:

      May 27, 2018

      +10

    • Miguel says:

      April 18, 2019

      This is possible. Just like this:
      #TODO: finish step 1
      # finish step 2
      # finish step 3

      just put a ‘# ‘ on the following line, it must start with # ad be followed by a space, and then it will be added into the TODO items list as a subset of the original TODO.

      -MS

  5. Michel says:

    August 21, 2016

    Add me for multi-line TODOs.

  6. Jonathan Sachs says:

    September 2, 2016

    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.

    • Jonathan Sachs says:

      September 2, 2016

      Another, more Pythonic approach:

      # TODO I need to remember… \
      # to see if anyone…
      # This is an ordinary comment that…

    • Joe Flack says:

      August 29, 2017

      +1 for multi-line TODOs

  7. Vivek Subramanian says:

    March 21, 2017

    Please incorporate multi-line TODO statements into the editor.

  8. Raul Valenzuela says:

    April 5, 2017

    +1 for multi-line TODO campaign

  9. Ram R says:

    May 5, 2017

    + 1 for multiline TODO

  10. jhesed says:

    September 5, 2017

    +1 for multi-line TODO

  11. Mohamed Haseeb says:

    September 5, 2017

    +1 for multiline TODO

  12. Rasheed Abdul-Aziz says:

    May 10, 2018

    I’ve wanted Multi-line todos since 2010 😀
    https://youtrack.jetbrains.com/issue/IDEA-62161

Subscribe

Subscribe for updates