Announcing the PyCharm 4.0.6 release update

Today we’re glad to announce the immediate availability of the PyCharm 4.0.6 bug-fix update.

It’s already available for download from our website. It also will be available soon as a patch update from within the IDE (from PyCharm 4.x only).

As a recap, the most notable fixes in PyCharm 4.0.6 are: a fix for the Django ORM inspection problem, a fix for the ManyToManyField resolve bug, a fix for an incremental search bug, a fix for HTML indentation broken when using Jinja tags, a fix for the “Nothing to show” bug in Structure View for Jinja2 HTML files, and fixes for a couple of platform bugs.

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

As usual, 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 | 1 Comment

PyCharm 4.0.6 RC is available

Today we’ve published the PyCharm 4.0.6 RC bug-fix update.

This build has a few fixes that can be found in the release notes: a fix for the Django ORM inspection problem, a fix for the ManyToManyField resolve bug, a fix for an incremental search bug, a fix for HTML indentation broken when using Jinja tags, a fix for the “Nothing to show” bug in Structure View for Jinja2 HTML files, and fixes for a couple of platform bugs.

Download PyСharm 4.0.6 RC for your platform from the project EAP page and please report any bugs and feature request to our Issue Tracker. It also will be available shortly as a patch update from within the IDE. Make sure you’ve selected the Beta Releases channel in update settings.

Develop with Pleasure!
-PyCharm team

Posted in Early Access Preview | 11 Comments

Feature Spotlight: Python remote development with PyCharm

Happy Friday everyone,

In today’s blog post I’m going to cover some basic principles and features in PyCharm that make Python remote development easy as pie. To demonstrate them I’ll use a very simple flask web application from the official flask github repository. Enjoy the read!

Note: Remote development functionality is only available in PyCharm Professional Edition. For more details please see the editions comparison page

First I clone the official flask repository from https://github.com/mitsuhiko/flask. Then from the PyCharm’s Welcome screen I open the blueprintexample directory, which stores the source of the super simple flask application I’m going to use for the demo:

flask1

PyCharm opens the directory and creates a project based on it:

flask2

Now I’m going to set up the remote machine to start with the remote development. I use Vagrant which PyCharm offers great support for. In one of my previous blog posts I already covered Vagrant integration, so here are just the straight steps to provision and run a VM. I go to Tools | Vagrant | Init in Project Root and select the Ubuntu 14.04 image which was previously imported from the collection of vagrant boxes. This creates the Vagrantfile in the project root. Now, I’m going to edit this file to configure a private network and make my VM visible from my host machine:

flask3

Next, I run the VM with Tools | Vagrant | Up and PyCharm shows me that the VM is up and running:

flask4

We can open a local terminal inside PyCharm to test the VM:

flask5

Alright, the VM responses to ping. Now, I want to run my web application on the VM, so I need to copy my project sources to the remote host. This is easily done with the Deployment tool inside PyCharm.
I go to Tools | Deployment | Configuration and specify the connection details for my VM:

flask6

On the Mappings tab in the same window I specify the path mapping rule:

flask7

In my case I want my current local project directory blueprintexampe to be mapped to remote /home/vagrant/blueprintremote.
Now I can right-click my project in the project view and select Upload to:

flask9

And this will upload my project to the specified directory on the remote machine:

flask10

One of the handiest features is that you can set up automatic upload to the remote machine by simply clicking Tools | Deployment | Automatic Upload:

flask11

From this point on, all changes made locally will be uploaded to the remote machine automatically, so you don’t need to worry about having fresh sources on the remote host. Cool, isn’t it?

So now, I’m going to modify one of the files in my project, so the flask application will be visible remotely (adding host=’0.0.0.0’ as a parameter to the app.run() ), and PyCharm automatically uploads the changes to the remote machine:

flask12

Next, I specify the python interpreter to be used for my project. I go to File | Settings (Preferences for Mac OS) | Project | Project Interpreter. By default, PyCharm sets the local Python interpreter as a project interpreter, so I’ll change it to the remote one:

flask13

As I’ve already created a deployment configuration, PyCharm offers to export Python interpreter settings from the existing deployment configuration:

flask14

But I can also specify the remote interpreter manually, using SSH credentials or a Vagrant configuration. Here I’ll do it manually:

flask15

After I specify the new remote python interpreter, PyCharm starts indexing and finds that the flask package is not installed on the project interpreter:

flask16

I can fix this easily with Alt + Enter on the unresolved reference error highlighted with red:

flask17

Alright. Now everything is ok, so we can finally specify Run/Debug configuration and launch our application. Let’s go to Run | Edit Configurations and add a new Python run/debug configuration:

flask18

In the Run/Debug configuration dialog, I specify the name for my new configuration and the script to be executed on the remote host. PyCharm sets the project interpreter (remote in this case) by default for this new run configuration, and finally I need to specify path mappings for this particular run configuration:

flask19

It seems we’re all set. I click the Run button:

flask20

PyCharm shows that the application is up and running on port 5000 on the VM.
I open the browser to check that the application is really working:

flask21

From this point on, we can work with this project like with a normal local project. PyCharm takes care of uploading any changes to the remote machine and keeps the VM up and running.

With the same Run/Debug configuration, we can do a simple remote debug session putting a few breakpoints right in the editor:

flask22

Click the debug button or go to Run | Debug:

flask23

That’s it! Hopefully you’ll appreciate this remote development functionality in PyCharm that makes Python remote development a breeze.

If you’re still craving for more details on PyCharm remote development capabilities, as well as other remote development features, please see the online help.

Talk to you next week,
Dmitry

Posted in Cool Feature | 19 Comments

Feature Spotlight: VCS integration in PyCharm

Happy Friday everyone,

Today we’ll take a look at some of the basic VCS features in PyCharm that can help manage different version control systems.

You may already know that PyCharm has seamless integration with major version controls like Git, GitHub, Subversion, Mercurial, Perforce (available only in PyCharm Professional Edition), and CVS. Even though all these version controls have different models and command sets, PyCharm makes life a lot easier by advocating a VCS-agnostic approach for managing them wherever possible.

So here we go:

Checking out a project from a VCS

To import a project from a version control system, click the Check out from Version Control button on the Welcome screen, or use the same VCS command from the main menu:

vcs1

Version Control settings

A project’s version control settings are accessed via Settings → Version Control. You can associate any of the project folders with a repository root. These associations can be removed at any time, or you can even opt to disable the version control integration entirely:

vcs2

PyCharm can handle multiple VCS repositories assigned to different folders of the project hierarchy, and perform all VCS operations on them in uniform manner.

Changes tool window and changelists

After version control is enabled for a project, you can see and manage your local changes via the Changes tool window. To quickly access the tool window, press Alt + 9 (Cmd-9 on a Mac):

vcs3

All changes are organized into changelists that can be created, removed, and made active.

Quick list of VCS operations

When you need to perform a VCS operation on a currently selected file, directory, or even on the entire project, bring up the VCS operations quick-list via Alt+Back Quote (Ctrl-V on a Mac):

vcs4

Show History

The history of changes is available for a set of files or directories via the VCS operations quick-list, or in the main menu VCS →<version control name> → Show History, or in the context menu → Show History:

vcs5

To see all changes for a specific code snippet, use the Show History for Selection action.

Annotations

Annotations are available from the quick-list, the main menu or the context menu. They allow you to see who changed a certain line of code and when:

vcs6

When you click the annotation, you will see the detailed information about the corresponding commit.

Useful shortcuts

  • Commit current changelist Ctrl+K (Cmd-K on a Mac)
  • Update the project Ctrl+T (Cmd-T on a Mac)
  • Mark selected files and folders as added Ctrl+Alt+A (Alt-Cmd-A on a Mac)
  • Mark selected files and folders as changed (checked out) via Ctrl+Alt+E (Alt-Cmd-E on a Mac)
  • Show diff (available in the Changes tool window) via Ctrl+D (Cmd-D on a Mac)
  • Move changes to another change list (available in the Changes tool window) via F6
  • Push commits to remote repositories via Ctrl+Shift+K (Cmd-Shift-K on a Mac)

Commit options

When committing changes, PyCharm lets you perform a variety of operations:

  • change the file set to commit to,
  • join the changes with the previous commit by using the Amend commit option,
  • reformat the changed code,
  • optimize imports,
  • ensure that there are no inspection warnings,
  • update the copyright information,
  • or even upload the changes to a remote FTP server.

vcs7

Ignored files

To configure the ignored files, go to Settings → Version Control, or use the corresponding button in the Changes tool window:

vcs8

The actual list of ignored files can be displayed in the Changes tool window next to the changelists by clicking the corresponding button.

Branches

With PyCharm you can easily create, switch, merge, compare and delete branches (available for Git and Mercurial only). To see a list of existing branches or create a new one, use either the Branches from the main or context menu, or the VCS operations quick-list, or the widget on the right-hand side of the status bar:

vcs10

For multiple repositories, PyCharm performs all VCS operations on all branches simultaneously, so you don’t need to switch between them manually.

Shelves, stashes, and patches

Shelves and Stashes help you when you need to put away some local changes without committing them to repository, then switch to the repository version of the files, and then come back to your changes later. The difference between them is that Shelves are handled by PyCharm itself and are stored in the local file system, while Stashes are kept in a VCS repository.

Patches allow you to save a set of changes to a file that can be transferred via email or file sharing and then applied to the code. They are helpful when you’re working remotely without having a constant connection to your VCS repository and still need to contribute:

vcs11

Log

To see the entire list of commits in a repository, sorted and filtered by branch, user, date, folder, or even a phrase in description, use the Log tab in the Changes tool window. This is the easiest way to find a particular commit, or to just browse through the history:

vcs12

In this blog post we touched just a tip of the VCS integration iceberg. Go ahead and try this functionality in action! Here’s a tutorial that can walk you through the VCS integration features and provide additional information. And if after that you’re still craving yet more details, please see our online help.

That’s it for today. See you next week!
-Dmitry

Posted in Cool Feature | 1 Comment

Best Interactive Programming Course Contest 2015 is over!

pycharm_contest_banner

On March 5th the Best Interactive Programming Course contest organized by JetBrains came to a close. Based around the theme of PROGRAMMING EDUCATION WITH PYTHON, this contest was a great chance for teachers and instructors all around the globe to show their experience and skills as they vowed to create a programming course that thousands of learners would use inside PyCharm Educational Edition.

We hope it was a great experience for everyone who attempted to create a course using PyCharm Educational Edition. The courses this contest has produced will surely be helpful for thousands of students around the globe.

The Results

All submitted courses have been scored on:

  • The overall idea (engaging topic, originality/uniqueness)
  • Seamless experience going through the course
  • Course length and structure
  • Usage of PyCharm Edu functionality
  • Course content quality

And the winners are:
1st place: John Zurawski, “Logging in Python”
This course provides an introduction to the standard Python logging module. It includes basic and advanced examples that can help you debug your Python software. Best practices are demonstrated to help you get the most out of Python logging. This course was tested using Python 2.7 and Python 3.4.

2nd place: Lisa C, “Introduction to Classic Ciphers”
Python implementations of classic text ciphers. Appropriate for python beginners who have had some practice with manipulating strings and lists, writing ‘for’ loops, and organizing code into functions.

3rd place: Tal Einat, “Python Unit-Testing”
An introductory interactive course about unit testing in Python.

The jury also selected “Introduction to Classic Ciphers” as the Best Course Idea.

Thanks to everyone who entered in the contest and congratulations to the winners!

The winning courses will soon be available in PyCharm Educational Edition along with the default “Introduction to Python” course. To check them out, go to File | New Project | Educational and click the refresh button.

This has been an amazing experience for the PyCharm team. Thanks a lot for all your entries and keep the love flowing!

What’s up next?

Currently we’re working on the next version of PyCharm Educational Edition. It’s going to be more polished, the new features will be introduced and of course with this new release we’ll address different usability and some common problems that both students and educators have experienced with the first version!

Stay tuned for further news, subscribe to both PyCharm and PyCharm Educational Edition twitters, report any problems you find to our public issue tracker.

Develop and learn with pleasure!
PyCharm team

Posted in Conferences & Events, Contest | 1 Comment

Announcing the PyCharm 4.0.5 release update

Today we’re glad to announce the immediate availability of the PyCharm 4.0.5 update.

It’s already available for download from our website. It also will be available soon as a patch update from within the IDE (from PyCharm 4.x only).

As a recap, this minor bug update delivers a critical fix for broken code insight for PyPy, an important fix for debugging multi-process Pyramid and Google App Engine projects, a few important fixes for Django 1.7 support, a couple of fixes for unresolved NumPy functions and a fix for deprecation warning when using Behave.

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

As usual, 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.

So what’s coming up next? We’re still working on the next release of PyCharm 4.1. The first PyCharm 4.1 Early Access Preview build is going to be revealed soon, so stay tuned.

Develop with Pleasure!
-PyCharm team

Posted in Release Announcements | 9 Comments

Feature Spotlight: Reformatting Python code with Pycharm’s intentions

Happy Friday everyone!

Did you have a chance to read one of my previous posts on how PyCharm helps you write clean and maintainable Python code? As a quick recap: Pycharm highlights code style violations with both PEP8 and custom inspections, and it also allows you to apply automatic quick-fixes to keep your code in consistent format.
Today I’m going to cover another feature that you may find handy for writing professional and quality code. It’s called Code intentions.

The main difference between PyCharm’s code inspections and intentions is that while inspections provide quick-fixes for code that has potential problems, intentions help you apply automatic changes to code that is most likely correct.

Here’s how it works:

When editing absolutely correct code, the yellow bulb sometimes appears in the editor:

intentions_a

That signals that the automatic action is available to be applied in place. To get a list of intentions applicable to the code at the caret, just press Alt + Enter:

intentions2

In this particular situation PyCharm offers to convert the lambda to a normal function. Just hit Enter and it will do the job for you:

intentions3

It also highlights the new function name and when you change it, it automatically changes the function call:

intentions4

There is a huge number of different code intentions available for Python and all other supported languages including JavaScript, SQL, CSS, and other. You can see them all as well as enable or disable some of them in Settings (Preferences for Mac OS) | Editor | Intentions:

intentions5

Another way to get to the intentions settings or simply disable the unwanted intention is to hit right arrow on the intention in the editor:

intentions6

I bet you’ll like this feature if you haven’t tried it before.

Have a great weekend and see you next week!

-Dmitry

Posted in Cool Feature | 3 Comments

PyCharm 4.0.5 RC2 is available

Having announced the PyCharm 4.0.5 RC build a week ago, today we’ve published the PyCharm 4.0.5 RC2 build 139.1525, which is already available for download and evaluation from the EAP page.

This build has only two new fixes that can be found in the release notes: a fix for deprecation warning when using Behave and an important fix for debugging multi-process Pyramid and Google App Engine projects.

We encourage you to download PyСharm 4.0.5 RC2 build 139.1525 for your platform and test the latest fixes. Please report any bugs and feature request to our Issue Tracker. It also will be available shortly as a patch update from within the IDE.

Develop with pleasure!
-PyCharm Team

Posted in Early Access Preview | 1 Comment

PyCharm 4.0.5 RC is available

We are happy to announce the availability of PyCharm 4.0.5 Release Candidate. Since the previous bug-fix update in early January we’ve gathered a lot of fixes for different PyCharm’s subsystems. Actually we’re almost ready to release them to you as PyCharm 4.0.5, but before we do that, we’d like to make sure that this build doesn’t hide any surprises. That’s why we’re releasing PyCharm 4.0.5 RC today.

Installers for PyCharm 4.0.5 RC (build 139.1485) can be found on Early Access Preview page.

The complete list of changes is in the PyCharm 4.0.5 RC release notes. The most notable among them are: a critical fix for broken code insight for PyPy, a couple of fixes for unresolved NumPy functions, and a few important fixes for Django 1.7 support.

Patch updates from the previous versions should be available soon. Just make sure you’ve enabled the “Early Access Preview” update channel in your update settings. In case you want to keep your current PyCharm installation untouched but still want to try the new RC version, please don’t use the patch update – install the new version alongside from scratch instead.

We hope there’ll be no major bugs in this build and we’ll be able to give it a green light as PyCharm 4.0.5 within the next week.

As always, please report any problem you found to our public issue tracker. By doing so you help us make PyCharm better.

Follow us on twitter to receive our latest news.

Develop with Pleasure!
-PyCharm team

Posted in Early Access Preview | 4 Comments

Feature Spotlight: Find Usages & Locate Duplicates in Python Code

Happy Friday everyone,

In the last week’s blog post I covered different refactoring capabilities of PyCharm. Today I’ll continue highlighting different handy features and show you some more tools that help you keep your code under full control.

One of the features that every developer uses on the daily basis is Find/Replace. It’s supported in every code editor, and PyCharm is no exception: Ctrl+F/Ctrl+R. Besides, PyCharm supports a number of subsidiary functions, such as Find Next/Previous Occurrence, Find/Replace in Path, Select all Occurrences, etc. They all are available under the Edit | Find menu item:

find1

While some of these features are pretty common, others really stand apart thanks to PyCharm outstanding code intelligence. Find usages is one of such noticeably smart features that deserves a closer look.

1. Find usages
Just press Alt + F7 on any symbol at the caret ( no matter if the symbol is a class, method, field, parameter, or another statement) and get a list of references grouped by type of usage, module and file. This feature is really fast and gets you first results almost instantly. More results appear as the IDE finds them:

find2

By default the results should be grouped by usage type, if not you can enable this by pressing Ctrl(Cmd for Mac) + Alt + T or by clicking the corresponding button on the sidebar:

find3

2. Settings
If you want to set custom options for the Find Usages algorithm, you can use Shift + Alt + Ctrl + 7 (Shift + Alt + Cmd + 7 for Mac):

find4

3. Quickpopup
To see the results quickly in place, simply press Alt + Ctrl + 7 (Alt + Cmd + 7 for Mac):

find5
4. Highlight overridden methods
Another useful aspect of highlighting usages in PyCharm is that you can easily find the methods that are overridden for a particular class. Just put the caret at the statement and press Shift + Ctrl + F7 (Shift + Cmd + F7 for Mac). If there are multiple classes, you will be asked whose methods to highlight:

find6
5. Highlight usages in File
Sometimes its useful to quickly see all usages of the variable or method within a file right in the editor. Highlight usages in File (Ctrl + Shift + F7) works perfect in this case:

find7

Locate Duplicates

It’s not a secret that one of the most annoying problem of every project is duplicated code. Obviously any developer tries to get rid of such redundancies. Thanks to PyCharm code intelligence, Locate duplicates tool allows you to examine your code and find different code duplicates. This tool works for different languages and is highly configurable.
To use this tool go to Code | Locate Duplicates. It will ask you for an analysis scope specification:

duplicates1

then you can specify some other options before give it a go:

duplicates2

You can set supported languages that will be analysed within your scope as well as other configurable options for fine tuning the analysis.

On the last step after clicking OK, it will show you the list of code duplicates found, as well as the tool to review these duplicates and navigate between them:

duplicates3

After finding duplicates you might want to use one of the refactoring features described in my previous blog post in order to get rid of them.

I hope I’ve been helpful and shed some light on these advanced PyCharm search features.

Have a great weekend and see you next week!
-Dmitry

Posted in Cool Feature | 4 Comments