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.
  • 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!

-Dmitry

Posted in Cool Feature | 3 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.

PyCharm_team

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.

dangerous

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:

codestylehighlight

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:

reformatfile

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

codestylesetings

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.:

inspections

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:

scopes

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:

inspections_reports

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.

pep8

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:

compatibility

Quick-fixes

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.

quickfixes

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 | 23 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

Announcing The PyCharm 3.4 Release

We’re happy to announce the immediate availability of PyCharm 3.4, the new major release of our intelligent IDE for Python and Web development. As before, PyCharm 3.4 is available as a full-fledged Professional Edition for Python and Web development or the free and open-source Community Edition for pure Python development and education.

Download PyCharm 3.4 for your platform today!

Despite the minor version number, PyCharm 3.4 is a true major release. We’re staying up to speed with the cutting-edge technologies from the Python world, in particular the latest versions of Python 3.4, Django 1.7 and others, which you’ve come to expect.

With v3.4 we introduce improved functionality, better performance, and many handy new must-have features that we hope will make you even more productive!

Here are the most notable highlights of the release:

- New Python interpreters management with a new UI
- New refined support for remote interpreters
- Django 1.7 support
- New live templates for Python
- Multiple carets and selections
- Vagrant support improvements
- New automatic quick-fixes
- Full debug support in the interactive Python console
- Debugging for Stackless Python
- Advanced built-in AngularJS support
- IdeaVim plugin updated with new enhancements
- New ‘Github’ color scheme for the PyCharm editor
- And many other valuable improvements across the IDE

Please see what’s new in PyCharm 3.4 for more details, and download the IDE for your platform.

PyCharm 3.4 Professional Edition is a free update for everyone who purchased their license after May 29, 2013. As usual, a 30-day trial is available if you want to try PyCharm as your new Python/Django IDE.

Develop with pleasure!
JetBrains PyCharm Team

Posted in Release Announcements | 28 Comments

The Second Release Candidate for PyCharm 3.4 is now available

We are now approaching the final steps towards the PyCharm 3.4 release which is planned to be released in short. So today we’re happy to announce the availability of the second release candidate for PyCharm 3.4.

Generally speaking, feedback on the previous PyCharm 3.4 RC has been positive and we believe this second release candidate will be even better. That’s why we invite you all to try it out. Please take it for a spin and give us feedback. The PyCharm 3.4 RC2 build 135.973  is available for download from the Early Access Preview page.

The last few days since the announcement of PyCharm 3.4 RC, we’ve been only fixing bugs. So no any new functionality in this build. The complete list of bug fixes can be found in the Release Notes.

We hope that there will be no major bugs, but anyway, should you encounter any problems, please report them to our public tracker.

A patch update from the previous RC and EAP builds should be available soon.

Stay tuned, follow us on twitter and develop with pleasure!

-PyCharm team

Posted in Early Access Preview | 3 Comments

Announcing the PyCharm 3.4 Release Candidate

We’re pleased to announce the availability of the PyCharm 3.4 Release Candidate.

This pre-release build 135.938 is available under the Early Access Program. That means a 30-day evaluation license agreement is already included with the Professional Edition of the PyCharm 3.4 RC.

The Community Edition build of the PyCharm 3.4 Release Candidate is also available. This edition is completely free and doesn’t have any timed license limitations.

Please take it for a spin and give us your feedback. The PyCharm 3.4 RC build is available for download from the Early Access Preview page.

PyCharm 3.4 Release Candidate mostly includes a consolidation of fixes for bugs and performance issues comparing to previous EAP builds. For the detailed list of notable changes and improvements, please check the Release Notes.

The most notable new feature in this build is the “Github” color scheme for the PyCharm editor:

githubcolor

This color scheme is inspired by the Github’s code viewer default color scheme. To enable this scheme in PyCharm, please go to Settings | Editor | Colors & Fonts and choose the “Github” color scheme. As for any other editor’s scheme, you can easily tweak it to better serve your preferences. Follow the What my PyCharm looks like, or choosing Look and Feel tutorial to learn how to completely customize your PyCharm’s appearance.

We hope that there will be no major bugs, however, should you encounter any problems, please report them to our public tracker.

A patch update from previous EAP builds should be available in short.

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

-PyCharm team

Posted in Cool Feature, Early Access Preview | 5 Comments

Announcing the PyCharm 3.4 EAP build 135.889

Having announced the first Early Access Preview build of PyCharm 3.4 almost a month ago, today we’re eager to let you know that the new PyCharm 3.4 EAP build 135.889 is ready for your evaluation. Please download it for your platform from our EAP page.
Just as always, this EAP build can be used for 30 days since its release date and does not require any license.

Since the announcement of the first 3.4 EAP build a lot of bugs have been fixed and several new features have appeared as well.

The most notable new features concern the PyCharm’s debugger:

- Full Debug Support in Interactive Python Console
The interactive Python console in PyCharm can be connected to the full debug infrastructure within one click. Learn more how to attach the debugger to Python console in this short video:

- With this new build, PyCharm now supports debugging for Stackless Python

- The debugger now works correctly with Google App Engine projects

The complete list of new features and bug fixes can be found in Release Notes.

A patch update from the previous EAP build should be available in short.

Please report any bugs and feature requests to our Issue Tracker and give us your feedback in our forum.

Enjoy productive development with PyCharm and develop with pleasure!

-PyCharm Team

Posted in Early Access Preview | 4 Comments

The PyCharm 3.4 Early Access Program has begun

animation

The JetBrains PyCharm team is pleased to announce the start of the Early Access Program (EAP) for PyCharm 3.4 and is ready to introduce the brand-new build 135.763 for your evaluation. It’s already here, available for download from the Early Access Preview page. As any new PyCharm 3.x release (starting from PyCharm 3.0), the PyCharm 3.4 EAP 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 135.763 comes with a 30-day time-limited license as well.

The PyCharm 3.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.

We’d like to encourage you to try this brand-new preview build and give us your valuable feedback in our public issue tracker. This will help us make the final release of PyCharm 3.4 more stable and less buggy.

PyCharm 3.4 EAP build 135.763 includes a lot of new features, bug fixes, and improvements in different subsystems. It also delivers a lot of unique PyCharm-specific features. Meanwhile, PyCharm users also have access to a number of recently announced features and benefits from other JetBrains products like WebStorm 8 and IntelliJ IDEA 13.1. For example, advanced built-in AngularJS support and Sublime Text style multiple selection:

out0033

So here are the PyCharm-specific features:

  •  New Python interpreters management process with new UI:

new_proj_interpr

Now you can choose existing, add a new local or remote python interpreter and even create virtualenv right on the project creation stage without any need to sneak into the PyCharm settings.

  • New live templates for Python which are now suggested in code completion:

templates

templates2

  • Improved Vagrant support: Now PyCharm offers to start vagrant instance when remote interpreter is currently not available. It also better handles unique remote interpreters on diverse vagrant boxes
  • Additional automatic quick fixes for various code inspections
  • Improved navigation: Now ‘Navigate | Class‘ or ‘Navigate | Symbol’ allows navigating to Python modules (*.py files) and packages (‘__init__.py’ files)
  • Pull members up/down refactorings improved
  • Template roots now can be marked right from the project structure view
  • A lot of performance improvements in Python code analysis

PyCharm 3.4 EAP also incorporates all new WebStorm 8 features (read more on the What’s new in WebStorm 8 page), so from the WebStorm side we are ready to deliver:

  •  Advanced built-in AngularJS support

AngularJS-large.png

  • Spy-js JavaScript tracing tool integration
  • New Live console in JavaScript and Node.js debugger that allows you to enter commands and code
  • Grunt integration
  • Bower integration: search through Bower registry, manage components in the IDE
  • RequireJS aliases support
  • CucumberJS support
  • Full support for Sass 3.3 and Less 1.6
  • Improvements in support for TypeScript 1.0 and more

And finally, the IntelliJ platform brings us many features including:

  • Live templates are now suggested in code completion
  • Version control improvements
  • Multiple Selection (one of the most requested features in PyCharm)

With Multiple Selection, we can now put a cursor in multiple locations in a file and write code simultaneously in these positions. Press and hold “Alt” on the keyboard and use the mouse to select the locations of the cursors:

animation_web

Download PyCharm 3.4 EAP build 135.763 for your platform from the project EAP page and please report any bugs and feature request to our Issue Tracker.

Remember to install the .zip & .tar.gz versions into a completely empty folder. Do not just unpack over your previous version!

Develop with pleasure!
-PyCharm team

Posted in Cool Feature, Early Access Preview | 35 Comments