PyCharm 5.1 Beta is available

Today we announce the release of PyCharm 5.1 Beta, a feature-complete preview version of PyCharm 5.1.

Download PyCharm 5.1 Beta build 145.184.12 from the Early Access Preview page or as a patch-based update within the IDE (make sure to select the Beta releases or EAP channel in the update settings). After you take it for a spin, please give us your feedback.

Compared to the previous EAP build, this one includes a consolidation of fixes for various bugs and issues for recently added features, as well as a bunch of new features we hope you’ll enjoy:

Docker Compose support

Additionally to Docker container settings in run configurations (introduced in the previous EAP build), in PyCharm 5.1 Beta we introduce Docker Compose support. To get started with Docker Compose in PyCharm, make sure you’ve installed Docker Compose according to its official documentation. Then, check that the docker-compose executable is specified in PyCharm Settings | Build, Execution, Deployment | Docker:

docker1

Next, go to Settings | Project | Project Interpreter, click the gear icon to add a new remote interpreter. You’ll find the brand-new “Docker Compose” option there. All you need to do is just specify the Docker Compose configuration file (docker-compose.yml) and the service representing your project:

docker2At this stage you can also change the Docker engine settings and the Python interpreter path in the container for your service. After that, click OK and PyCharm will configure the required services and Python interpreter. From this point, autocompletion, code inspections, and checks as well as other features will be driven by the interpreter from the Docker container derived from the service description in docker-compose.yml.

Note: Currently there’s a limitation: Docker Compose files v2 are not supported. We’ll fix it before the official release of PyCharm 5.1.

Optional type hinting using run-time collected types

In one of our previous EAP builds we introduced Python 2 and Python 3 Compatible Type Hinting support:

annotate0

With this release we introduce the new experimental feature – generation of type annotations based on the run-time collected types. To use this feature, first enable run-time types collection: Go to Settings | Build, Execution, Deployment | Python Debugger. Enable “Collect run-time types information for code insight”. Next, run your application using the integrated PyCharm debugger. It will collect information about object types used in your code. After that, put the cursor to the function definition and hit Alt+Enter to get the list of the available code intentions:

annotate

Choose “Annotate types” and PyCharm will generate the type annotation based on the information on types it has collected during the debug session. This type information will be inserted in a format compatible with your project interpreter’s Python version:

annotate2

Python code compatibility inspection improvements

Writing Python 2 and Python 3 compatible code is extremely important. PyCharm helps to ensure your code is compatible with particular Python versions. Whenever your code makes use of the __future__ or six modules, PyCharm now offers to enable the “Code compatibility inspection”. If you turn on this inspection, PyCharm enables it for latest Python 2.7 and Python 3.5 by default. To modify the inspection options you can go to Settings | Editor | Inspections and find “Code compatibility inspection” in the list of Python inspections:

inspection

From this point PyCharm will check the code compatibility against two or more Python versions specified.

Improved attach to process

The debugger’s attach to process feature got a small but useful improvement. We slightly changed its UI and added the “Recent” section for recently attached processes. To attach the PyCharm’s debugger to an already-running python process, go to Run | Attach to Local Process:

attach

That’s all about new features in this build. You’re welcome to refer to the detailed release notes for more information on changes in PyCharm 5.1 Beta comparing to the previous EAP.

Here’s a recap of what’s new coming in PyCharm 5.1:

Python-related improvements:

  • Docker Compose support
  • Docker container settings in run configurations
  • Tox support
  • Improved support for Django forms
  • Stepping filters in debugger
  • Stepping over yield from and await
  • Debugger performance improvements
  • Python 2 and Python 3 Compatible Type Hinting
  • Optional type hinting using run-time collected types
  • Python code compatibility inspection improvements
  • Devpi and Optional PyPI repositories support
  • Postfix Code Completion
  • Folding for Python code blocks, collection literals, and multi-line comments
  • Improved attach to process
  • Improved rendering of Markdown, LaTeX, and HTML cells in IPython Notebook files

Platform enhancements:

  • Local Terminal Improvements
  • Support for RTL languages (Arabic and Hebrew).
  • Easier merging with Git and other VCS thanks to the added by-word difference highlighting.
  • Two new actions to help you work with Git branches, available via the Branches popup (VCS | Git | Branches): Checkout with Rebase and Rename.
  • Git worktree support and updated look and feel of Git Log.
  • Improved speed-search in the show usages popup (Ctrl(Cmd)+Alt+7).
  • and more…

Web development improvements:

  • Better coding assistance for JavaScript, ECMAScript and TypeScript
  • Unused imports warning and сode folding for ES6 imports
  • Remote run and debug for Node.js apps
  • Css custom properties
  • Code assistance in tsconfig.json, .babelrc and .eslintrc
  • Inline rename for TypeScript
  • Debugging JS async code
  • Improved support for React, Angular 1.5 and 2
  • npm support improvements and Webpack support
  • and more…

For more details about the upcoming features please see the announcements of the previous EAP builds.

Stay tuned for a PyCharm 5.1 release announcement, follow us on twitter, and develop with pleasure!

JetBrains PyCharm Team

About Dmitry Filippov

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

14 Responses to PyCharm 5.1 Beta is available

  1. Nikos says:

    > Optional type hinting using run-time collected types.

    So this means that in python 3.5 will use the pep 484 format? Can it insert them on Google/Numpy docstrings?

    • Dmitry Trofimov says:

      Hi, Nikos,
      while you can generate documentation string stub in Google/Numpy format in PyCharm it unfortunately doesnt add run-time type information to it.
      Please feel free to submit a feature request about that to our tracker: youtrack.jetbrains.com/issues/PY

  2. Czarek Tomczak says:

    Is it also possible to have type hinting for variables other than function arguments? For example:

    class Foo(object):
    bar = 10 # type: int
    def __init__(self):
    self.bar = “asd”

    It doesn’t show In Pycharm any warning that I’m assigning a value of wrong type. For function arguments it works fine.

  3. Czarek Tomczak says:

    How can I deal with long comment annotations? Pep 484 says [1] “The entire annotation must be one line.”. But when I do:

    def _merge_suites(self, suites1, suites2, suites3):
    # type: (unittest.TestSuite, unittest.TestSuite, unittest.TestSuite) -> unittest.TestSuite

    PyCharm shows warning:

    PEP 8: line too long

    [1] https://www.python.org/dev/peps/pep-0484/#suggested-syntax-for-python-2-7-and-straddling-code

    • Mikhail Golubev says:

      There is a proposal of syntax that allows to declare type for each individual parameter right after it on the same line with standard “# type:” comment and mention only return type in the function comment. It hasn’t become an official part of PEP 484 yet, but it’s going to be supported in PyCharm 2016.1, nonetheless.

      https://github.com/python/typing/issues/186

  4. Czarek Tomczak says:

    Here is a case that doesn’t show any warnings in Pycharm – defining invalid type hint:

    def run_testcase(self, testcase):
    # type: (str, int) -> None

    • Mikhail Golubev says:

      Yes, according to PEP 484 you shouldn’t mention type for the first parameter of methods (except @staticmethod’s), so we ignore the second type specified (int).
      I agree, more checks of correctness of these comments are yet to be done.

      I created the feature request in the tracker: https://youtrack.jetbrains.com/issue/PY-18815

  5. Gregory Matous says:

    Very good stuff in this release.. particularly the annotate types and the 2/3 compatibility checks..

  6. Kiran says:

    Awesome! I really, really love the automatic type hint creation. Now, what’s just missing to make it perfect: automatic import of the annotation types from the typing module for Python 3.5. Love the new features, thank you so much!

  7. Francis says:

    Finally docker-compose has been supported

  8. John says:

    Wow, I have been impressed by PyCharm in the past and thought I had seen it all, but generating type hints based off runtime analysis is just genius. Great work guys.

  9. Dan says:

    Please can you also support multiple compose files?

  10. Matěj Cepl says:

    Except that six support really doesn’t work right? (https://youtrack.jetbrains.com/issue/PY-14666 reproduceable with 2016.3)

Leave a Reply

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