@@ -5,40 +5,40 @@ Your Development Environment
5
5
Text Editors
6
6
::::::::::::
7
7
8
- Just about anything which can edit plain text will work for writing Python code,
8
+ Just about anything that can edit plain text will work for writing Python code,
9
9
however, using a more powerful editor may make your life a bit easier.
10
10
11
11
12
- VIM
12
+ Vim
13
13
---
14
14
15
15
Vim is a text editor which uses keyboard shortcuts for editing instead of menus
16
- or icons. There exist a couple of plugins and settings for the VIM editor to
16
+ or icons. There are a couple of plugins and settings for the Vim editor to
17
17
aid Python development. If you only develop in Python, a good start is to set
18
18
the default settings for indentation and line-wrapping to values compliant with
19
19
:pep: `8 `. In your home directory, open a file called :file: `.vimrc ` and add the
20
20
following lines::
21
21
22
22
set textwidth=79 " lines longer than 79 columns will be broken
23
23
set shiftwidth=4 " operation >> indents 4 columns; << unindents 4 columns
24
- set tabstop=4 " an hard TAB displays as 4 columns
24
+ set tabstop=4 " a hard TAB displays as 4 columns
25
25
set expandtab " insert spaces when hitting TABs
26
26
set softtabstop=4 " insert/delete 4 spaces when hitting a TAB/BACKSPACE
27
27
set shiftround " round indent to multiple of 'shiftwidth'
28
28
set autoindent " align the new line indent with the previous line
29
29
30
30
With these settings, newlines are inserted after 79 characters and indentation
31
- is set to 4 spaces per tab. If you also use VIM for other languages, there is a
32
- handy plugin at indent _, which handles indentation settings for Python source
31
+ is set to 4 spaces per tab. If you also use Vim for other languages, there is a
32
+ handy plugin called indent _, which handles indentation settings for Python source
33
33
files.
34
34
35
- There is also a handy syntax plugin at syntax _ featuring some improvements over
36
- the syntax file included in VIM 6.1.
35
+ There is also a handy syntax plugin called syntax _ featuring some improvements over
36
+ the syntax file included in Vim 6.1.
37
37
38
38
These plugins supply you with a basic environment for developing in Python.
39
39
To get the most out of Vim, you should continually check your code for syntax
40
40
errors and PEP8 compliance. Luckily PEP8 _ and Pyflakes _ will do this for you.
41
- If your VIM is compiled with :option: `+python ` you can also utilize some very handy
41
+ If your Vim is compiled with :option: `+python ` you can also utilize some very handy
42
42
plugins to do these checks from within the editor.
43
43
44
44
For PEP8 checking, install the vim-pep8 _ plugin, and for pyflakes you can
@@ -51,7 +51,7 @@ order to do this, add the following lines to your :file:`.vimrc`::
51
51
autocmd BufWritePost *.py call Pyflakes()
52
52
autocmd BufWritePost *.py call Pep8()
53
53
54
- If you are already using syntastic _ you can enable it to run Pyflakes on write
54
+ If you are already using syntastic _, you can set it to run Pyflakes on write
55
55
and show errors and warnings in the quickfix window. An example configuration
56
56
to do that which also shows status and warning messages in the statusbar would be::
57
57
@@ -61,21 +61,28 @@ to do that which also shows status and warning messages in the statusbar would b
61
61
let g:syntastic_auto_loc_list=1
62
62
let g:syntastic_loc_list_height=5
63
63
64
+
64
65
Python-mode
65
66
^^^^^^^^^^^
66
67
67
- Python-mode _ is a complex solution in VIM for working with Python code.
68
+ Python-mode _ is a complex solution for working with Python code in Vim .
68
69
It has:
69
70
70
71
- Asynchronous Python code checking (``pylint ``, ``pyflakes ``, ``pep8 ``, ``mccabe ``) in any combination
71
72
- Code refactoring and autocompletion with Rope
72
73
- Fast Python folding
73
74
- Virtualenv support
74
- - Search by Python documentation and run Python code
75
+ - Search through Python documentation and run Python code
75
76
- Auto PEP8 _ error fixes
76
77
77
78
And more.
78
79
80
+ SuperTab
81
+ ^^^^^^^^
82
+
83
+ SuperTab _ is a small Vim plugin that makes code completion more convenient by
84
+ using ``<Tab> `` key or any other customized keys.
85
+
79
86
.. _indent : http://www.vim.org/scripts/script.php?script_id=974
80
87
.. _syntax : http://www.vim.org/scripts/script.php?script_id=790
81
88
.. _Pyflakes : http://pypi.python.org/pypi/pyflakes/
@@ -84,15 +91,14 @@ And more.
84
91
.. _vim-pep8 : https://github.com/nvie/vim-pep8
85
92
.. _syntastic : https://github.com/scrooloose/syntastic
86
93
.. _Python-mode : https://github.com/klen/python-mode
87
-
88
- .. todo :: add supertab notes
94
+ .. _SuperTab : http://www.vim.org/scripts/script.php?script_id=1643
89
95
90
96
Emacs
91
97
-----
92
98
93
- Emacs is a powerful text editor. It's fully programmable (lisp), but
94
- it can be some work to wire up correctly. A good start if you're
95
- already an Emacs user is `Python Programming in Emacs `_ at EmacsWiki.
99
+ Emacs is another powerful text editor. It is fully programmable (lisp), but
100
+ it can be some work to wire up correctly. A good start if you're already an
101
+ Emacs user is `Python Programming in Emacs `_ at EmacsWiki.
96
102
97
103
1. Emacs itself comes with a Python mode.
98
104
2. Python ships with an alternate version:
@@ -121,6 +127,17 @@ Sublime Text has excellent support for editing Python code and uses Python for
121
127
its plugin API. It also has a diverse variety of plugins, `some of which <https://github.com/SublimeLinter/SublimeLinter >`_
122
128
allow for in-editor PEP8 checking and code "linting".
123
129
130
+ Atom
131
+ ----
132
+
133
+ `Atom <https://atom.io/ >`_ is a hackable text editor for the 21st century,
134
+ built on atom-shell, and based on everything we love about our favorite editors.
135
+
136
+ Atom is web native (HTML, CSS, JS), focusing on modular design and easy plugin development.
137
+ It comes with native package control and plethora of packages. Recommended for Python
138
+ development is `Linter <https://github.com/AtomLinter/Linter >`_ combined with
139
+ `linter-flake8 <https://github.com/AtomLinter/linter-flake8 >`_.
140
+
124
141
125
142
IDEs
126
143
::::
@@ -131,6 +148,8 @@ PyCharm / IntelliJ IDEA
131
148
`PyCharm <http://www.jetbrains.com/pycharm/ >`_ is developed by JetBrains, also
132
149
known for IntelliJ IDEA. Both share the same code base and most of PyCharm's
133
150
features can be brought to IntelliJ with the free `Python Plug-In <http://plugins.intellij.net/plugin/?id=631 >`_.
151
+ There are two versions of PyCharm: Professional Edition (Free 30-day trial)
152
+ and Community Edition(Apache 2.0 License) with fewer features.
134
153
135
154
136
155
Eclipse
@@ -142,27 +161,30 @@ The most popular Eclipse plugin for Python development is Aptana's
142
161
143
162
Komodo IDE
144
163
----------
164
+
145
165
`Komodo IDE <http://www.activestate.com/komodo-ide >`_ is developed by
146
166
ActiveState and is a commercial IDE for Windows, Mac, and Linux.
167
+ `KomodoEdit <https://github.com/Komodo/KomodoEdit >`_ is the open source
168
+ alternative.
147
169
148
170
149
171
Spyder
150
172
------
151
173
152
174
`Spyder <http://code.google.com/p/spyderlib/ >`_ is an IDE specifically geared
153
175
toward working with scientific Python libraries (namely `Scipy <http://www.scipy.org/ >`_).
154
- It includes integration with pyflakes _, `pylint <http://www.logilab.org/857 >`_,
176
+ It includes integration with pyflakes _, `pylint <http://www.logilab.org/857 >`_
155
177
and `rope <http://rope.sourceforge.net/ >`_.
156
178
157
179
Spyder is open-source (free), offers code completion, syntax highlighting,
158
- class and function browser, and object inspection.
180
+ a class and function browser, and object inspection.
159
181
160
182
161
183
WingIDE
162
184
-------
163
185
164
186
`WingIDE <http://wingware.com/ >`_ is a Python specific IDE. It runs on Linux,
165
- Windows, and Mac (as an X11 application, which frustrates some Mac users).
187
+ Windows and Mac (as an X11 application, which frustrates some Mac users).
166
188
167
189
WingIDE offers code completion, syntax highlighting, source browser, graphical
168
190
debugger and support for version control systems.
@@ -179,116 +201,35 @@ systems. Installers for these platforms can be downloaded from the website.
179
201
NINJA-IDE is open-source software (GPLv3 licence) and is developed in Python and
180
202
Qt. The source files can be downloaded from `GitHub <https://github.com/ninja-ide >`_.
181
203
182
- Interpreter Tools
183
- :::::::::::::::::
184
-
185
-
186
- virtualenv
187
- ----------
188
-
189
- Virtualenv is a tool to keep the dependencies required by different projects
190
- in separate places, by creating virtual Python environments for them.
191
- It solves the "Project X depends on version 1.x but, Project Y needs 4.x"
192
- dilemma, and keeps your global site-packages directory clean and manageable.
193
-
194
- `virtualenv <http://www.virtualenv.org/en/latest/index.html >`_ creates
195
- a folder which contains all the necessary executables to contain the
196
- packages that a Python project would need. An example workflow is given.
197
-
198
- Install virtualenv:
199
-
200
- .. code-block :: console
201
-
202
- $ pip install virtualenv
203
-
204
204
205
- Create a virtual environment for a project:
206
-
207
- .. code-block :: console
208
-
209
- $ cd my_project
210
- $ virtualenv venv
211
-
212
- ``virtualenv venv `` will create a folder in the current directory
213
- which will contain the Python executable files, and a copy of the ``pip ``
214
- library which you can use to install other packages. The name of the
215
- virtual environment (in this case, it was ``venv ``) can be anything;
216
- omitting the name will place the files in the current directory instead.
217
-
218
- To start using the virtual environment, run:
219
-
220
- .. code-block :: console
205
+ Eric (The Eric Python IDE)
206
+ --------------------------
221
207
222
- $ source venv/bin/activate
208
+ `Eric <http://eric-ide.python-projects.org/ >`_ is a full featured Python IDE
209
+ offering sourcecode autocompletion, syntax highlighting, support for version
210
+ control systems, python 3 support, integrated web browser, python shell,
211
+ integrated debugger and a flexible plug-in system. Written in python, it is
212
+ based on the Qt gui toolkit, integrating the Scintilla editor control. Eric
213
+ is an open-source software project (GPLv3 licence) with more than ten years of active
214
+ development.
223
215
224
216
225
- The name of the current virtual environment will now appear on the left
226
- of the prompt (e.g. ``(venv)Your-Computer:your_project UserName$ ``) to
227
- let you know that it's active. From now on, any package that you install
228
- using ``pip `` will be placed in the ``venv `` folder, isolated from the global
229
- Python installation.
230
-
231
- Install packages as usual:
232
-
233
- .. code-block :: console
234
-
235
- $ pip install requests
236
-
237
- To stop using an environment, simply type ``deactivate ``. To remove the
238
- environment, just remove the directory it was installed into. (In this
239
- case, it would be ``rm -rf venv ``.)
240
-
241
- Other Notes
242
- ^^^^^^^^^^^
243
-
244
- Running ``virtualenv `` with the option :option: `--no-site-packages ` will not
245
- include the packages that are installed globally. This can be useful
246
- for keeping the package list clean in case it needs to be accessed later.
247
- [This is the default behavior for ``virtualenv `` 1.7 and later.]
248
-
249
- In order to keep your environment consistent, it's a good idea to "freeze"
250
- the current state of the environment packages. To do this, run
251
-
252
- .. code-block :: console
253
-
254
- $ pip freeze > requirements.txt
255
-
256
- This will create a :file: `requirements.txt ` file, which contains a simple
257
- list of all the packages in the current environment, and their respective
258
- versions. Later, when a different developer (or you, if you need to re-
259
- create the environment) can install the same packages, with the same
260
- versions by running
261
-
262
- .. code-block :: console
263
-
264
- $ pip install -r requirements.txt
265
-
266
- This can help ensure consistency across installations, across deployments,
267
- and across developers.
268
-
269
- Lastly, remember to exclude the virtual environment folder from source
270
- control by adding it to the ignore list.
271
-
272
- virtualenvwrapper
273
- -----------------
274
-
275
- `Virtualenvwrapper <http://pypi.python.org/pypi/virtualenvwrapper >`_ makes
276
- virtualenv a pleasure to use by wrapping the command line API with a nicer CLI.
277
-
278
- .. code-block :: console
279
-
280
- $ pip install virtualenvwrapper
217
+ Interpreter Tools
218
+ :::::::::::::::::
281
219
282
220
283
- Put this into your :file: `~/.bash_profile ` (Linux/Mac) file:
221
+ Virtual Environments
222
+ --------------------
284
223
285
- .. code-block :: console
224
+ A Virtual Environment is a tool to keep the dependencies required by different projects
225
+ in separate places, by creating virtual Python environments for them. It solves the
226
+ "Project X depends on version 1.x but, Project Y needs 4.x" dilemma, and keeps
227
+ your global site-packages directory clean and manageable.
286
228
287
- $ export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
229
+ For example, you can work on a project which requires Django 1.3 while also
230
+ maintaining a project which requires Django 1.0.
288
231
289
- This will prevent your virtualenvs from relying on your (global) site packages
290
- directory, so that they are completely separate..
291
- [note: This is the default behavior for ``virtualenv `` 1.7 and later]
232
+ To start using and see more information: `Virtual Environments <http://github.com/kennethreitz/python-guide/blob/master/docs/dev/virtualenvs.rst >`_ docs.
292
233
293
234
Other Tools
294
235
:::::::::::
@@ -346,4 +287,3 @@ Python interpreter for Unix-like operating systems. It has the following feature
346
287
.. code-block :: console
347
288
348
289
$ pip install bpython
349
-
0 commit comments