Feature Spotlight: Built-in local and remote SSH terminal in PyCharm

Happy Friday everyone!

Did you know that you can easily open a terminal to start a local or a remote session right inside PyCharm and perform all the usual tasks without ever needing to leave the IDE while developing?

To open the terminal, go to Tools | Open Terminal. As usual, you can assign a shortcut for this action for a quicker access. This will open the terminal inside PyCharm, so you can perform all the usual actions in it. For example, you can start some console application:


You can also open new terminal tabs, close and rename existing ones, and easily navigate between them.

To access any remote host, you can simply go to Tools | Start SSH session…

Note that the “start SSH session…” action is available only in PyCharm Professional Edition, while the terminal itself is available in both Professional and Community editions.

It will show you the list of already configured ssh connections. You can just choose the existing connection or create a new one:


When connected to a remote host, a new ssh tab appears in the terminal. For example, here I opened a file for editing with Vim on a remote host inside PyCharm:


To learn more about the SSH terminal and its advanced settings and additional features, please read this tutorial.

If you’re using Pycharm Community edition, you can access the remote host anyway – manually from the terminal, without the “start SSH session” action:


See you next week!

Posted in Cool Feature | 2 Comments

Feature Spotlight: Tracking code changes with Local History

Happy Friday!

Today I’d like to highlight the one of the top features that saves you from unexpected changes in your code and keeps things on track – Local History. This feature exists in PyCharm for a long while, but it’s worth to talk about it once again!

Note: Local History is available in both PyCharm Professional Edition and PyCharm Community Edition.

Local history is the way for PyCharm to track all your local personal changes to your project files. It simply expands the VCS functionality for you locally. When developing, there are constant small changes in the code. I bet you’ve had occasions when you needed the information about code changes, but the version control systems couldn’t help you because they track and compare differences only between committed versions – you just can’t commit so often to have a track of all your small changes. Some local changes between commits are unnoticed for VCS and this is where Local History comes to the rescue!

So let me show you how it works:

When editing, you can open local history by simply right-clicking on any file, and go to Local History | Show history:


This will show you the changes of your file, including commits, external changes, some major refactorings that happened, and just other basic changes. And then once you’re on one of these changes it shows you the diff of the file:


You can scroll down and revert any of the changes that you want by clicking the icons to insert the old code or remove code, or by simply reverting the entire file by right-clicking and selecting Revert or Create Patch:


You can also select a block of text and only show the changes for that selection. So select a code snippet and click Show history for selection:


You can also select an entire directory or your entire project – do “show history” on a directory or project and it’ll show you the list of files that have changed in your local history. And then once you find a file that you want you can double click on it to bring the diff for that file in that copy of the history:


You can also invoke local history from the keyboard by using Alt + Backquote and going down to Local history | Show history. That’s just a different way to invoke it.

Last but not least, at any time you can do Local history | Put label, give the label a name and now have a custom label which is stored in local history and lets you view your file’s state at the time you added the label:


As you can see Local History is just the PyCharm’s way of tracking your personal changes. That isn’t something that is shared across your project. It just tracks local changes to files, keeping everything in its history: external changes, commits, regular edits, etc.

I know quite a few times when it actually saved developers from a system crash consequences or helped when VCS just wasn’t enough. Sometimes you could really use that extra hand from your IDE.

So in case you’ve lost some files or made some unexpected changes in your code – everything is still in the PyCharm memory. Check it out!

See you next week!

Posted in Cool Feature | Leave a comment

Feature Spotlight: Behavior-Driven Development in PyCharm

Happy Friday!

Today I’d like to shed some light on another brand-new functionality upcoming for PyCharm 4 – Behavior-Driven Development (BDD) Support. You can already check it out in the PyCharm 4 Public Preview builds available on the EAP page.

Note: The BDD support is available only in the PyCharm Professional Edition, not in the Community Edition.

BDD is a very popular and really effective software development approach nowadays. I’m not going to cover the ideas and principles behind it in this blog post, however I would like to encourage everyone to try it, since it really drives your development in more stable and accountable way. Sure, BDD works mostly for companies that require some collaboration between non-programmers management and development teams. However the same approach can be used in smaller teams that want to benefit from the advanced test-driven development concept.

In the Python world there are two most popular tools for behavior-driven development – Behave and Lettuce. PyCharm 4 supports both of them, recognizing feature files and providing syntax highlighting, auto-completion, as well as navigation from specific feature statements to their definitions. On-the-fly error highlighting, automatic quick fixes and other helpful PyCharm features are also available and can be used in a unified fashion.

Let me show you how it works in 10 simple steps:

1. To start with BDD development and in order to get the full support from PyCharm, you first need to define a preferred tool for BDD (Behave or Lettuce) in your project settings:


2. You can create your own feature files within your project – just press Alt+Insert while in the project view window or in the editor and select “Gherkin feature file”. It will create a feature file where you can define your own features, scenarios, etc. PyCharm recognizes feature files format and provides syntax highlighting accordingly:


3. Since there is no step definitions at the moment, PyCharm highlights these steps in a feature file accordingly. Press Alt+Enter to get a quick fix on a step:


4. Follow the dialog and create your step definitions:


5. You can install behave or lettuce right from the editor. Just press Alt+Enter on unresolved reference to get the quick-fix suggestion to install the BDD tool:


6. Look how intelligently PyCharm keeps your code in a consistent state when working on step definitions. Use Alt+Enter to get a quick-fix action:


7. In feature files, with Ctrl+Click you can navigate from a Scenario description to the actual step definition:


Note: Step definitions may contain wildcards as shown in the step #6 – matched steps are highlighted with blue in feature files.

8. PyCharm also gives you a handy assistance on automatic run configurations for BDD projects. In the feature file, right-click and choose the “create” option, to create an automatic run configuration for behave/lettuce projects:


9. In the run configurations you can specify the scenarios to run, parameters to pass and many other options:


10. Now you’re all set to run your project with a newly created run configuration. Press Shift+F10 and inspect the results:


That was simple, wasn’t it?
Hope you’ll enjoy the BDD support in PyCharm and give this approach a try in your projects!

See you next week!

Posted in Cool Feature | 13 Comments

First PyCharm 4 Preview Build Now Available

It’s an exciting day for us at JetBrains PyCharm, as the first PyCharm 4 public
preview build 138.2401 is finally available for download! Head on over to the PyCharm Early Access Preview (EAP) page and have a look at the download section where you can get it for your platform right now.

As usual the PyCharm 4 preview build is available in two editions – free/open source PyCharm Community Edition and full-fledged PyCharm Professional Edition. While both of them are available for download and use at no charge, PyCharm Professional Edition has a 30-day evaluation period, which means PyCharm 3.4 Professional Edition EAP build 138.2401 comes with a 30-day time-limited license as well.

Note: The PyCharm 4 EAP build is not in the final product release stage and might contain severe bugs, so it’s supposed to be installed along with your current PyCharm installation for evaluation and checking out new features. No patch update for this EAP build will be available from within the IDE.

The PyCharm 4 preview build introduces a lot of new features, bug fixes and improvements, including a number of recently added PyCharm’s unique features as well as some features and improvements from Web and IntelliJ platform sides.

The most notable PyCharm’s unique features in this preview build are:

Behaviour-driven development (BDD) assistance

Behaviour-driven development has never been so easy and natural. With PyCharm 4 EAP we introduce the special BDD assistance giving you the full control of your textual requirements, graphical representation of the test results, and extensive and intelligent assistance on each step of the overall BDD process:


PyCharm 4 EAP now fully supports the two most popular Python tools for BDD: behave and lettuce.
PyCharm recognizes feature files, provides syntax highlighting, auto-completion, as well as navigation from specific feature statements to their definitions and back – all in a unified fashion.
Thanks to its high intelligence, PyCharm has a deep understanding of the definition steps: it shows errors and suggests automatic quick fixes, saving your time and increasing overall performance:


PyCharm and PyDev debuggers are merged

As you probably know, previously PyCharm has been using special fork of the PyDev debugger with some PyCharm specific changes and our own unique features like GEvent debugging and breakpoints at Django templates. We’re very proud that the PyCharm team is an active member of the Python community, with many team members deeply involved in different open-source projects development. So recently we decided to make one more contribution to open-sourced software and merged our debugger code with that from the original PyDev repository. Now the work on the debugger continues from both sides (PyCharm and PyDev) in a single place. The merged source code now lives here: https://github.com/fabioz/PyDev.Debugger Pull requests are greatly appreciated!

Referring objects view in PyCharm debugger

When debugging your project you can open the referring objects view for a desired object during runtime. To do so, in the debug mode right-click the object in the “Variables” window then click “Show Referring Objects”:


Jinja2 templates debugging

Now the PyCharm debugger works with Jinja2 templates. You can set breakpoints right in the editor, stop on them and perform other debugging actions the same way as in the already supported Django templates debugging mode:


To learn more about the new BDD or debugger functionality, stay tuned for further blog posts, announcements, and tutorials.

Improved Python/Django console tool window

PyCharm automatically detects which type of the console should be run depending on your project type and context. The console can be launched via the tools window menu as shown on the picture below or using the “Ctrl+ E” shortcut:


Still, there is one more cool Python console feature that was included in this build:

showconsoleNow you can leave the console opened after a project run or a debug session, saving its context. In order to enable this functionality, you just need to mark the “Show command line afterwards” option in the project run/debug configurations:


Method Call hierarchy

Thanks to the PyCharm’s fantastic static code analysis capabilities, PyCharm intelligently analyses the code and builds a call hierarchy trees for method calls in different scopes:


New project creation wizard

The project creation wizard has changed a bit and now it has 2 steps:
On the first step you have to choose the project type. On the second step PyCharm shows you only relevant settings for the selected project type:


Unittest sub-tests support

Python 3.4 support is even more polished with the PyCharm`s test runner now recognizing the subTest() context manager for unittest.

As usual, PyCharm 4 will have all features of the upcoming WebStorm 9 release. WebStorm 9 preview builds are already available (read more in WebStorm blog), so here is just a short summary of what’s new available in the PyCharm 4 preview build 138.2401 from the Web side:

- Updated Live Edit feature that can now automatically update your Node.js app on any changes
- Spy-js for Node.js applications
- PhoneGap/Cordova integration
- Postfix templates for JavaScript
- Improved Editorconfig plugin
- Gulp integration
- Improved Polymer support
- Support for the latest Sass 3.4

These new features are available for installation from JetBrains plugin repository.

Apart from additional features and improvements from the Web side, PyCharm 4 gets a lot of improvements from the underlying IntelliJ Platform. The most noteworthy changes are:

  • Redesigned Settings(Preferences in OS X) dialog: settings dialog gets a cleaner interface, a more straightforward layout and a rearranged settings tree (some of the settings have been merged, and others reordered based on their frequency of use):


  • The Open action from the Welcome screen now opens single files. That means you can now edit files regardless of the projects and their configurations.

Other improvements from the IntelliJ Platform include:
- Backspace smart indent makes the Backspace key aware of your code formatting settings, so it doesn’t break your code when removing indents before caret.
- The new Code cleanup action (available via Analyze → Code Cleanup or as an option in the VCS commit dialog) applies quick-fixes in batch mode to selected files.
- The improved Find in path action
- Copy/paste selected code as HTML/RTF is now available without additional plugins.
- Better IDE startup time.
- Mercurial support improvements
- Reset Current Branch to Here action now available from the Git Log

Download PyCharm 4 preview build 138.2401 for your platform right from the project EAP page and please report any bugs and feature request to our Issue Tracker.

Develop with pleasure!
-PyCharm team

Posted in Cool Feature, Early Access Preview | 32 Comments

Feature Spotlight: Deployment with PyCharm

Happy Friday, everyone!

I’d like to highlight a very handy feature of PyCharm called Deployment support in our spotlight this week:


When developing some Python or Web applications, chances are at one point we will be deploying them. During development we may want to deploy our application to a testing/staging server, to a VM or a Vagrant box. And once release day is there we want to make sure our carefully crafted code makes it to production.

PyCharm shines here again, as it supports code deployment to remote hosts. Read the Deployment in PyCharm tutorial to learn how to easily set up mappings, browse files on a remote machine, upload and synchronize your code, compare local and remote versions of your files and configure automatic synchronization.

See you next week!

Posted in Cool Feature | 2 Comments

Feature Spotlight: Multiple Selections in PyCharm

Today I’d like to highlight one of the most top voted features that appeared in PyCharm 3.4 some time ago – Multiple Selections. Since then a lot of people have been using it and enjoying the increased productivity while editing.

With this feature you can:

  • Set multiple cursors in the editor area: Alt + Mouse Click (Option + Mouse Click for Mac OS X). Note that on some systems you also have to use Shift with the shortcuts mentioned.
  • Select/unselect the next occurrence: Alt + J / Shift + Alt + J (Ctrl + G / Shift + Ctrl +G for Mac OS X)
  • Select all occurrences: Shift + Ctrl + Alt + J (Ctrl + Cmd + G for Mac OS X)
  • Clone caret above/below (the shortcuts are not mapped yet)
  • Remove all selections: Esc

You can redefine these shortcuts in Settings -> Keymap -> Editor Actions if necessary.

Multiple selections work nicely together with other PyCharm features like Code completion, Select word at caret, Join lines, Copy/paste, and the others. This feature also works with all languages supported by PyCharm such as Python, HTML, JavaScript, CSS and more.

Here’s a short demo on how Multiple Cursors work in PyCharm:

Hope you’ll enjoy this handy feature!


Posted in Cool Feature | 6 Comments

Meet the PyCharm Team in Berlin, Germany at EuroPython 2014

europythonJuly 21 – 27, the JetBrains PyCharm Team will be in Berlin, Germany for EuroPython 2014. The conference will be held in the Berlin Congress Center which is found in the immediate vicinity of the Fernsehturm at Alexanderplatz, right in the centre of Berlin.

The EuroPython conference is the second largest global conference for the popular programming language Python, after the PyCon US conference in North America. It is aimed at everyone in the Python community, of all skill levels, both professional programmers and those who just started learning this fantastic language. There will be more than 120 talks in five different tracks, including one by JetBrains:

Python Debugger Uncovered – Thursday, July 24 at 11:45
by Dmitry Trofimov

This talk will explain how to implement a debugger for Python. We’ll start with setting a simple trace function, then look how it is implemented in modern IDEs like PyCharm and Pydev. Then we go further in the details and uncover the tricks used to implement some cool features like exception handling and multiprocess debugging.

The show represents a great opportunity to meet three members of the PyCharm Team, learn about the latest release, our current developments or just say hi. We invite you to stop by with your questions and chat about your experiences with PyCharm and other JetBrains products. We will be raffling some PyCharm licenses so be sure to register and grab some of our cool giveaways.


We look forward to meeting you there! For more information on the EuroPython 2014 conference, please visit the official website.

Develop with pleasure!
PyCharm team

Posted in Conferences & Events | Leave a comment

Write Clean, Professional, Maintainable, Quality Code in Python

Bad code can work. But if it’s buggy, messy and difficult to maintain, it can eventually break a project, a development team or even an entire company. The necessity to write clean, professional and maintainable code is obvious and is getting more important nowadays as projects grow, more people become involved in development, and more projects go open source.

In today’s world projects are huge, with dozens and hundreds of people working on the same code base. Early detection of possible problems in code plays a huge role in helping developers write clean, professional, high-quality code that will be understood by others. Luckily, there are a number of tools that allow Python developers to analyse their code against errors and possible perils. These include pyflakes, pylint, pep8, and others. The problem, however, is that many developers use them after the code is already written, just to check what can be improved. A much more sound approach is, as with Continuous Integration, to find problems early and write clean code from the very beginning. This is where IDEs come in with their code intelligence.

What distinguishes a good IDE from good text editors? By definition, an IDE tightly integrates a range of development tools tuned to work with each other seamlessly. Unlike text editors, even superior ones like Vim or Sublime Text, a good IDE intimately understands your code and its flows. While some IDE functionality can be enjoyed in a text editor by installing third-party plugins, these plugins are not guaranteed to work smoothly as they don’t interact with each other. They do their highly-tailored job, but without communicating with other subsystems. An IDE with its core collects data from different subsystems, effectively transfers this data to other subsystems and reuses it whenever is possible. Consequently, it provides code intelligence with refactoring abilities, code navigation, automatic code fixes, testing assistance, smart code autocompletion and ultimately suggestions to keep your code maintainable and of a good quality.

PyCharm is one of the most intelligent Python development products on the market today. It has a lot of specially selected tools, tuned and tested to work with each other: an advanced editor derived from IntelliJ Platform, a debugger with the ability to collect runtime type statistics, many unique code inspections which work on the fly, and lots more. Any PyCharm user can benefit from using it for their development.

The ultimate goal of any development tool is not only to speed up your development, but more importantly, to keep your code under control, in a consistent state. This is applicable to any project, but is most valuable when you have a team or simply some large project that must stay maintainable. Or when you have coding standards to adhere to. Or when you just want to get unified and standardized code as output that you want to share with others.

A key benefit you get from PyCharm is being able to write clean, professional and maintainable code from the early development stages. It proactively monitors your code state as you type, checking it against numerous inspections for code style violations rules and sophisticated traps that are not obvious but potentially can break your application. As a result, you can prevent possible problems, rather than having to troubleshoot them later. You start to form a development practice where you get instant feedback right as you’re coding. This saves time on bug-fixing and, in the end, allows your team to develop cohesive software more rapidly.


Let me highlight some of the features in PyCharm that can help you consistently hold your code to a high quality standard.

Code Style violations

The very first feature I need to describe is basic code style checking. Python is very sensitive to code formatting by its nature. The very basic requirement to keep your code in a consistent state is to preserve the same formatting style across all over your project. PyCharm has a special subsystem that controls code style and inspects different code style violations. It watches for code formatting rules like tabs and indents, spaces, wrapping and braces, blank lines etc. If there are any code style violations, PyCharm will highlight them in the code:


PyCharm has special automatic quick-fixes for errors that it finds, so in this case you can quickly apply the “Reformat file” fix and PyCharm will make the file conforming to project code style settings:


These code style settings are highly customizable, and you can set your own code style scheme for each desired language, per project:


You can also save your settings and apply them to other projects or share with your peers.

Simple formatting is not enough! Here come customizable inspections

PyCharm has a huge number of code inspections for various projects, languages and frameworks. Those inspections checks your code against different errors. PyCharm finds different types of errors such as unresolved references, unused variables and imports, deprecated functions, classes and modules, PEP8, package requirements, and many many others. You can review the list of available inspections in Settings | Inspections. The checklist is comparable to pylint functionality, and you’ll notice it’s very comprehensive. Pylint is still the definitive tool for Python code analysis, but PyCharm’s advantage is that it checks your code on the fly. PyCharm has many settings to control those inspections: enable and disable, set the severity of inspections, edit the behavior of alerts, etc.:


You can also create and share customized inspections profiles. That is very helpful when you want to apply the same set of checks against different projects, or if you want your entire team to develop in the same style.

Manageable code inspections scopes

PyCharm provides flexibility for managing code quality with inspections scopes. Inspection scopes settings let you set and manage different rules for individual project parts:


Code analysis reports

With PyCharm, you can check your code against different inspection profiles, both standard and customized, and get a detailed report for further investigations. Lots of actions can be performed with code analysis reports as well:


You can export the results to HTML or XML for further investigation. In that way PyCharm works similar to pylint.

PEP 8 integration

Among a number of different inspections, PyCharm supports the PEP 8 standard by integration of the official pep8.py tool. This tool is being run in the background and you get an instant results with the highlights of PEP 8 violations in the code editor. Like with other inspections, you can change the severity of PEP 8, edit highlighting and other settings.


Python code compatibility checks

Living in a world with two contending versions of Python 2 and 3, it’s very important to check your code for compatibility against different versions of Python. PyCharm has a special inspection that helps you do that:



OK, so PyCharm finds errors and warnings. What else? PyCharm doesn’t just alert you to potential problems, but helps you with suggestions to fix them in-place. When a problem is found at the line your caret is on, you’ll notice a red or yellow bulb next to it. Choose from the list of ways to fix the problem and apply the suggested fix in one click / keypress.


As you can see, PyCharm has a powerful and highly customizable toolset for code quality assurance. It checks your code on the fly and helps you eliminate problems early.

This article only scratched the surface of what PyCharm can really do. There are a lot more features in PyCharm that assist you with code quality for your projects. For more details on features mentioned in this article and to learn additional handy features like code auto-generation, type hinting and more, please consult the tutorial Code Quality Assistance Tips and Tricks, or How to make your code look pretty? available in our tutorial space among other useful tutorials about PyCharm.

All the described functionality is available in PyCharm Community Edition, which is free and open source! Feel free to use it to improve your code quality and speed up the development process for your professionally developed projects!

Develop with Pleasure!

Posted in Cool Feature, Tutorial | 25 Comments

Announcing PyCharm 3.4.1

We’re eager to announce that we’ve just made available a fresh PyCharm 3.4.1 update for both the free Community Edition and the full-blown Professional Edition!

Thanks everyone for giving us a lot of helpful feedback and reporting problems to our public tracker. So as a recap, some notable highlights of this release include: a fix for unexpected hangs and freezes of the IDE, a Python debugger console fix, a fix for running a Django server on a remote host and fixes for Django and Jinja template tags.

For further details on the bug fixes and changes, please consult the Release Notes.

PyCharm 3.4.1 installation sources can be found on PyCharm Download page. You can also use the patch-based upgrade to upgrade from previous PyCharm versions without a full reinstallation.

As always, please report any problem you found in the issue tracker.

If you would like to discuss your experiences with PyCharm, we look forward to your feedback on our public PyCharm forum and twitter.

Develop with Pleasure!
-PyCharm team

Posted in Release Announcements | 13 Comments

The PyCharm 3.4.1 Release Candidate is now available

PyCharm 3.4 – the brand-new major release of our intelligent Python IDE – has been released just a bit more than a week ago and now we’re almost ready to release the minor 3.4.1 bug-fix update. Today we’ve published the PyCharm 3.4.1 RC build 135.1049, which is already available for download and evaluation from the EAP page.

The full list of fixes and improvements for this build can be found in the release notes. The most notable among them are: a fix for unexpected hangs and freezes of the IDE, a Python debugger console fix, a fix for running a Django server on a remote host and fixes for Django and Jinja template tags.

The build is available for download, and you can also use the patch-based upgrade to upgrade from within the IDE (from PyCharm 3.4 only) without a full reinstallation.

If no problems will occur with this build in the coming days, we’ll release PyCharm 3.4.1 on this week. Anyway, if you encounter problems, please file them to our public tracker.

Develop with Pleasure!
-PyCharm team

Posted in Early Access Preview | Leave a comment