A good IDE is the best teacher for learning a new language, so I think you should use it positively without being stingy. So, let's take a look at PyCharm, the strongest integrated development environment in Python. I think it's the most, so I'm writing it assuming WebApplication development with Django.
The functions and pricing system are as of December 15, 2015, PyCharm 5.0.2.
PyCharm is an IDE for Python from the Czech JetBrains s.r.o., which is famous for its high quality IDE. Works on Windows / OS X / Linux.
The JetBrains IDE is based on a Java IDE called IntelliJ IDEA PyCharm is developed as its Python plugin. We are also developing IDEs such as Ruby, PHP, JS, C ++, Objective-C / Swift.
Of these, PyCharm also comes with plugins related to Web development such as JS, CSS, HTML, so front-end development can be done in the same environment.
There is a paid Professional Edition and a free Community Edition. Community Edition has the same analysis mechanism of Python itself, but the above-mentioned plugins related to Web development and It should be noted that support for WebApplicationFramework and support for DB and SQL are omitted.
If you want to do web development, you should use Professional Edition.
There is a 30-day free trial, so give it a try.
JetBrains products have a monthly / yearly subscription. The first year is the highest, and as you continue, it gradually becomes cheaper, and the amount is the same after the third year.
If you go to the purchase page, you will find two plans, a PyCharm-only plan and an All Products Pack that includes all IDEs in other languages, such as IntelliJ IDEA Ultimate. If you're developing iOS apps or using Ruby, PHP, Java, C ++, etc., the All Products Pack may be worth considering.
PyCharm comes with web-related features, so you don't need to buy WebStorm separately if you just want to write client-side code.
https://www.jetbrains.com/pycharm/download/ If you go to, you can download the image that suits your platform. All you have to do is install as instructed. The OS X version now comes with Java, so it works as is.
PyCharm manages code and settings in units called Project. It also supports project creation from the start screen, and it is also possible to load existing code or fetch it from VCS such as git.
In the following, we will introduce the recommended functions after that about the project settings.
In Python, the environment is often divided by virtualenv, so create and set the virtualenv environment for the created Porject. You can specify an existing virtualenv environment or create a new one when creating a project or in Preferences-> Project-> Project Interpreter. A list of installed libraries and the latest version are also displayed, which is convenient for batch checking of library updates.
Since the warning level for PEP8 violation, which is the standard Python coding standard, is low, it is better to raise it by one level to make it a warning. There is no merit in violating PEP8 because the code of PEP8 violation causes nausea.
Raise the week warning to warning from Python-> PEP8 coding style violation in Preferences-> Editor-> Inspections. It's a good idea to raise the level of naming conversion violation below it as well.
Python has a rule that indicates it at the beginning of the code if the file encoding is other than ascii. Add the following for its description style and check. Choose the Encoding comment format to your liking with Python-> File contains non-ASCII characters in Preferences-> Editor-> Inspections. It is also necessary if there is Japanese in the comment part, so it is good to put it in all files by default.
You can add routes for search paths, templates, reference paths such as images, etc. If you can't get it out with code completion or jump to Template, check it.
When using Django, specify the location of settings and the location of the root as a Django project.
The format used by Docstring. It works well when using commented type hinting. There is no problem if you select reStructuredText.
In addition to Django, it also supports Jinja2, Mako, Chameleon, etc. Let's specify the Template language to use.
It supports VCS such as Git, Mercurial, Subversion. If it is set, changes can be confirmed from the editor, and partial restoration is also supported.
Even if the root of VCS is outside git submodule or Project, it will be recognized if you add the setting here.
It can be found in Preferences-> Editor-> General-> Appearance. Overall, PyCharm's search is very good, so for now, just put it in the search box in the upper left and it will look nice.
You can specify the template when creating a new file. Preferences-> Editor-> File and Code Templates.
When using Python2.x, it is good to add the following two.
Absolute_import is confused by relative references if the import rule is Python 2.x, so let's only use absolute references. If you want to make a relative reference, you can explicitly describe it, and it is preferable to add it, so you do not have to worry about it. Same as the default behavior of Python3.x.
unicode_literals makes the default string type unicode. It's a bit long to explain, but it's also better to meet the behavior of Python3.x because it's less confusing.
from __future__ import absolute_import from __future__ import unicode_literals
You can select multiple versions to check with Python-> Code compatibility inspection in Preferences-> Editor-> Inspections. It is effective in library development. When writing code that works with 2.x series, it is better to write code that matches 3.4 or higher as much as possible.
It is a search bar that appears when you press Shift twice. It increments most things related to the Project, such as filenames, symbols, and actions. Method names and file names are searched by ignoring case and underscore delimiters, so it's nice to remember them. I think there are quite a lot of PyCharm users who depend on this.
You can jump to the definition with Cmd + click or shortcut. It will look inside the library, so if you have any doubts about the behavior or arguments, you can easily read it. Even if the target cannot be specified by meta operation etc., the candidates are displayed, which makes code reading considerably easier.
In Project and Structure of ToolWindow, you can set the linkage with the specified editor side. You can specify the operation by selecting the following with the gear mark on the upper right. (Icon in Structure)
It is a good idea to set it to your liking. By the way, the path of the file that is currently in focus is shown at the top of the editor, so you can refer to the file in the directory in the middle from there.
General code completion will do everything you can. Moreover, it works with the same logic as Search everywhere, so I'm glad that it complements the latter half of the method name. To be honest, this is pretty strong.
Also, since it works even if you have not imported it, if you remember the class name or function name, you can write it for the time being, select a candidate with Alt + Enter, and automatically add an import statement.
There are various menus that come out from Alt + Enter where the warning is issued.
--Conversion of double quotes and single quotes. ――The automatic addition system gives various candidates depending on the context. The following is an example.
It's a type hint that has recently become a hot topic in Python3.5. PyCharm has been using commented TypeHinting for several years, and you can use TypeHinting for code completion and refactoring even if you are not using Python3.5.
If the type information is lost due to meta operations etc., add it with TypeHinting and the completion will be effective and argument errors will be found, so let's use it positively. I can't finish talking about TypeHinting, so I'll leave it to another article. The Syntax of TypeHinting that can be used in PyCharm is summarized below.
You can view / operate data from GUI by connecting to RDB such as MySQL. I mainly use SequelPro, so I don't use it much, but I think it will come in handy if I don't use ORM.
Supports Django / SQL Alchemy ORM completion. These internal implementations have many meta operations, and although it is difficult to complete by simply analyzing static code, it is possible to complete or jump to the definition.
Template & HTML & JS
You can seamlessly move from View to Template, and HTML / CSS / JS completion is perfect. It also analyzes the dependencies between Templates and paths such as images properly.
Since it also supports TypeScript and CoffeeScript, PyCharm is very useful even for clients who do not write server side.
PyCharm comes with a debugger that allows you to step, set breakpoints, stop variables, watch, and much more with a typical debugger. This debugger is also caught in the Template. Of course, step execution is possible. The stack trace in the Template is hard to see, so it's quite appreciated for complex Templates.
You can use the debugger to follow the execution in the environment on the remote server by connecting with ssh. It is quite effective in investigating environment-specific problems.
There are too many functions to write, but the accuracy of code analysis and completion is quite good, and the fact that all the functions are included from the beginning and there is no need to build an environment are the main reasons for recommending PyCharm. Once the indexing is done when the first project is loaded, search, replace, and automatic refactoring will work fairly fast, and they will all work together and be stress-free.
I often look at the comparison of only the function list, such as taking out only a part of the function and substituting it, but in the development environment, I think that it is most important that the code analysis and search that are used most are fast and comfortable. .. In that respect, PyCharm will give you an irreplaceable experience.