PyCharm

PyCharm is an excellent IDE for the Python language.

../_images/PyCharmSplash.jpg

Overview

Python being a dynamic language, using an IDE is a really good idea. This will help you find errors at development time rather that at runtime. There are various IDE for pythons around (see python IDE comparison).

If you are going to write non trival python programs for some time, then we recommend using PyCharm. It will save you time. PyCharm is usually faster, simpler and more powerful than PyDev, the python environment on eclipse. If you are really a huge fan of eclipse, you might prefer PyDev indeed.

Installation

There are two versions:

  • An open source version which is quite complete and very useful.
  • A commercial version which has support for django, databases, etc.

Attention

If you are student you can very easily get PyCharm for students. You just need to register with the email of your university. It’s really easy and quite fast.

  • download PyCharm page and then download the appropriate version (e.g. Windows community edition (web), Windows commercial edition (web)).

  • install the version downloaded in a directory like %SCRIBESTOOLS%\PyCharmOpen or %SCRIBESTOOLS%\PyCharmCommercial. This naming schema allows to have both editions installed at the same time.

  • by default your personal configuration of PyCharm goes in a directory like .PyCharm in your home directory, but if you want you can change this by editing the file bin/idea.properties in the installation directory. You have to adjust for instance the following two lines:

    idea.config.path=Z:/.PyCharm50/config
    idea.system.path=Z:/.PyCharm50/system
    

Launching PyCharm

The installer most likely created a shortcut. Click on it to launch PyCharm. Alternatively you can also find the executable in the bin directory of the installation or in a standard bin directory (e.g. /usr/bin/pycharm).

Launching PyCharm the first time

When launching pycharm for the first time, you will have no .PyCharm50 in your home directory. This directory contains the global configuration describing your global preference, your environment, the licencing information, and so on. PyCharm will therefore ask a few questions.

If you use the commercial version of PyCharm, you have to provide information for:

  • your pycharm/jetbrain account (created before) if you work at home for instance,
  • or a pycharm server licence if you work at university for instance. If you are in the context of the UGA enter http://im2ag-licence.e-im2ag.ujf-grenoble.fr:1111 for the licence server.

Opening/Creating PyCharm projects

Just like eclipse or netbeans, PyCharm is NOT a text file editor. So one do not open a file when launching PyCharm, but on the contrary create a project at a given place; and this project (or other projects) will always be opened and used in next sessions. A PyCharm project is simply a directory with a .idea subdirectory. This .idea subdirectoy is created on the first time and then managed by PyCharm.

When launching PyCharm you have to select your “project” directory, that is the directory that contains all files you want to work on. Usually this is the directory that also contains versioning information, so it is most likely that this project directory will contain both .idea and .git subdirectories (if you are using Git).

Note

The normal way to proceed with PyCharm is to open only projects and you should therefore have only one .idea directory at the top level of your “project directory”.

Documentation

Documentation is available from the help menu of the tool.

Configuration

To configure PyCharm use the menu File > Settings:

Editor
    File Encodings
        UTF8
    Appearance
        Show line numbers
        Show method separators
Code Style
    General
        right margin (columns)