mirror of
https://github.com/kennethreitz-archive/conductofcode.git
synced 2026-06-05 23:30:19 +00:00
256 lines
12 KiB
HTML
256 lines
12 KiB
HTML
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
|
<title>Your Development Environment — pythonguide 0.0.1 documentation</title>
|
|
|
|
<link rel="stylesheet" href="../_static/flasky.css" type="text/css" />
|
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
|
|
|
<script type="text/javascript">
|
|
var DOCUMENTATION_OPTIONS = {
|
|
URL_ROOT: '../',
|
|
VERSION: '0.0.1',
|
|
COLLAPSE_INDEX: false,
|
|
FILE_SUFFIX: '.html',
|
|
HAS_SOURCE: true
|
|
};
|
|
</script>
|
|
<script type="text/javascript" src="../_static/jquery.js"></script>
|
|
<script type="text/javascript" src="../_static/underscore.js"></script>
|
|
<script type="text/javascript" src="../_static/doctools.js"></script>
|
|
<link rel="top" title="pythonguide 0.0.1 documentation" href="../index.html" />
|
|
<link rel="next" title="<no title>" href="next.html" />
|
|
<link rel="prev" title="Properly Installing Python" href="installation.html" />
|
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
|
|
|
|
</head>
|
|
<body>
|
|
<div class="related">
|
|
<h3>Navigation</h3>
|
|
<ul>
|
|
<li class="right" style="margin-right: 10px">
|
|
<a href="../genindex.html" title="General Index"
|
|
accesskey="I">index</a></li>
|
|
<li class="right" >
|
|
<a href="next.html" title="<no title>"
|
|
accesskey="N">next</a> |</li>
|
|
<li class="right" >
|
|
<a href="installation.html" title="Properly Installing Python"
|
|
accesskey="P">previous</a> |</li>
|
|
<li><a href="../index.html">pythonguide 0.0.1 documentation</a> »</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="document">
|
|
<div class="documentwrapper">
|
|
<div class="bodywrapper">
|
|
<div class="body">
|
|
|
|
<div class="section" id="your-development-environment">
|
|
<h1>Your Development Environment<a class="headerlink" href="#your-development-environment" title="Permalink to this headline">¶</a></h1>
|
|
<div class="section" id="text-editors">
|
|
<h2>Text Editors<a class="headerlink" href="#text-editors" title="Permalink to this headline">¶</a></h2>
|
|
<div class="section" id="vim">
|
|
<h3>VIM<a class="headerlink" href="#vim" title="Permalink to this headline">¶</a></h3>
|
|
<p>There exist a couple of plugins and settings for the VIM editor to aid python
|
|
development. If you only develop in Python, a good start is to set the default
|
|
settings for indentation and linewrapping to values compliant with PEP8:</p>
|
|
<div class="highlight-python"><pre>set textwidth=79
|
|
set shiftwidth=4
|
|
set tabstop=4
|
|
set expandtab
|
|
set softtabstop=4
|
|
set shiftround</pre>
|
|
</div>
|
|
<p>With these settings newlines are inserted after 79 characters and indentation
|
|
is set to 4 spaces per tab. If you also use VIM for other languages, there is a
|
|
handy plugin at <a class="reference external" href="http://www.vim.org/scripts/script.php?script_id=974">indent</a>, which handles indentation settings for python source
|
|
files.
|
|
Additionally there is also a handy syntax plugin at <a class="reference external" href="http://www.vim.org/scripts/script.php?script_id=790">syntax</a> featuring some
|
|
improvements over the syntax file included in VIM 6.1.</p>
|
|
<p>These plugins supply you with a basic environment for developing in Python.
|
|
However in order to improve the programming flow we also want to continually
|
|
check for PEP8 compliance and check syntax. Luckily there exist <a class="reference external" href="http://pypi.python.org/pypi/pep8/">PEP8</a> and
|
|
<a href="#id4"><span class="problematic" id="id5">Pyflakes_</span></a> to do this for you. If your VIM is compiled with <cite>+python</cite> you can
|
|
also utilize some very handy plugins to do these checks from within the editor.
|
|
For PEP8 checking install <a class="reference external" href="https://github.com/nvie/vim-pep8">vim-pep8</a>. Now you can map the vim function
|
|
<cite>Pep8()</cite> to any hotkey or action you want. Similarly for pyflakes you can
|
|
install <a class="reference external" href="https://github.com/nvie/vim-pyflakes">vim-pyflakes</a>. Now you can map <cite>Pyflakes()</cite> like the PEP8 function and
|
|
have it called quickly. Both plugins will display errors in a quickfix list and
|
|
provide an easy way to jump to the corresponding line. A very handy setting is
|
|
calling these functions whenever a buffer is saved. In order to do this, enter
|
|
the following lines into your vimrc:</p>
|
|
<div class="highlight-python"><pre>autocmd BufWritePost *.py call Pyflakes()
|
|
autocmd BufWritePost *.py call Pep8()</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="ides">
|
|
<h2>IDEs<a class="headerlink" href="#ides" title="Permalink to this headline">¶</a></h2>
|
|
<div class="section" id="pycharm-intellij-idea">
|
|
<h3>PyCharm / IntelliJ IDEA<a class="headerlink" href="#pycharm-intellij-idea" title="Permalink to this headline">¶</a></h3>
|
|
<p>PyCharm is developed by JetBrains, also known for IntelliJ IDEA. Both share the same code base and most of PyCharm’s features can be brought to IntelliJ with the free <a class="reference external" href="http://plugins.intellij.net/plugin/?id=631/">Python Plug-In</a>..</p>
|
|
</div>
|
|
<div class="section" id="eclipse">
|
|
<h3>Eclipse<a class="headerlink" href="#eclipse" title="Permalink to this headline">¶</a></h3>
|
|
<p>The most popular Eclipse plugin for Python development is Aptana’s
|
|
<a class="reference external" href="http://pydev.org">PyDev</a>.</p>
|
|
</div>
|
|
<div class="section" id="komodo-ide">
|
|
<h3>Komodo IDE<a class="headerlink" href="#komodo-ide" title="Permalink to this headline">¶</a></h3>
|
|
<p><a class="reference external" href="http://www.activestate.com/komodo-ide">Komodo IDE</a> is developed by ActiveState and is a commerical IDE for Windows, Mac
|
|
and Linux.</p>
|
|
</div>
|
|
<div class="section" id="spyder">
|
|
<h3>Spyder<a class="headerlink" href="#spyder" title="Permalink to this headline">¶</a></h3>
|
|
<p><a class="reference external" href="http://code.google.com/p/spyderlib/">Spyder</a> an IDE specifically geared toward working with scientific python libraries (namely <a class="reference external" href="http://www.scipy.org/">Scipy</a>).
|
|
Includes integration with <a class="reference external" href="http://pypi.python.org/pypi/pyflakes">pyflakes</a>, <a class="reference external" href="http://www.logilab.org/857">pylint</a>,
|
|
and <a class="reference external" href="http://rope.sourceforge.net/">rope</a>.</p>
|
|
<p>Spyder is open-source (free), offers code completion, syntax highlighting, class and function browser, and object
|
|
inspection</p>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="interpreter-tools">
|
|
<h2>Interpreter Tools<a class="headerlink" href="#interpreter-tools" title="Permalink to this headline">¶</a></h2>
|
|
<div class="section" id="virtualenv">
|
|
<h3>virtualenv<a class="headerlink" href="#virtualenv" title="Permalink to this headline">¶</a></h3>
|
|
<p>Virtualenv is a tool to keep the dependencies required by different projects in separate places, by creating virtual Python environments for them.
|
|
It solves the “Project X depends on version 1.x but, Project Y needs 4.x” dilemma and keeps your global site-packages directory clean and manageable.</p>
|
|
</div>
|
|
<div class="section" id="virtualenvwrapper">
|
|
<h3>virtualenvwrapper<a class="headerlink" href="#virtualenvwrapper" title="Permalink to this headline">¶</a></h3>
|
|
<p>Virtualenvwrapper makes virtualenv a pleasure to use by wrapping the command line API with a nicer CLI.</p>
|
|
<div class="highlight-python"><pre>pip install virtualenvwrapper</pre>
|
|
</div>
|
|
<p>Put this into your <cite>~/.bash_profile</cite> (Linux/Mac) file:</p>
|
|
<div class="highlight-python"><pre>export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'</pre>
|
|
</div>
|
|
<p>This will prevent your virtualenvs from relying on your (global) site packages directory, so that they are completely separate..</p>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="other-tools">
|
|
<h2>Other Tools<a class="headerlink" href="#other-tools" title="Permalink to this headline">¶</a></h2>
|
|
<div class="section" id="ipython">
|
|
<h3>IPython<a class="headerlink" href="#ipython" title="Permalink to this headline">¶</a></h3>
|
|
<div class="highlight-python"><pre>$ pip install ipython</pre>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="bpython">
|
|
<h3>BPython<a class="headerlink" href="#bpython" title="Permalink to this headline">¶</a></h3>
|
|
<div class="highlight-python"><pre>$ pip install bpython</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="sphinxsidebar">
|
|
<div class="sphinxsidebarwrapper"><h3><a href="http://python-guide.org">About This Guide</a></h3>
|
|
<p>
|
|
This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis.
|
|
</p>
|
|
<h3><a href="../index.html">Table Of Contents</a></h3>
|
|
<ul>
|
|
<li><a class="reference internal" href="#">Your Development Environment</a><ul>
|
|
<li><a class="reference internal" href="#text-editors">Text Editors</a><ul>
|
|
<li><a class="reference internal" href="#vim">VIM</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a class="reference internal" href="#ides">IDEs</a><ul>
|
|
<li><a class="reference internal" href="#pycharm-intellij-idea">PyCharm / IntelliJ IDEA</a></li>
|
|
<li><a class="reference internal" href="#eclipse">Eclipse</a></li>
|
|
<li><a class="reference internal" href="#komodo-ide">Komodo IDE</a></li>
|
|
<li><a class="reference internal" href="#spyder">Spyder</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a class="reference internal" href="#interpreter-tools">Interpreter Tools</a><ul>
|
|
<li><a class="reference internal" href="#virtualenv">virtualenv</a></li>
|
|
<li><a class="reference internal" href="#virtualenvwrapper">virtualenvwrapper</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a class="reference internal" href="#other-tools">Other Tools</a><ul>
|
|
<li><a class="reference internal" href="#ipython">IPython</a></li>
|
|
<li><a class="reference internal" href="#bpython">BPython</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<h3>Related Topics</h3>
|
|
<ul>
|
|
<li><a href="../index.html">Documentation overview</a><ul>
|
|
<li>Previous: <a href="installation.html" title="previous chapter">Properly Installing Python</a></li>
|
|
<li>Next: <a href="next.html" title="next chapter"><no title></a></li>
|
|
</ul></li>
|
|
</ul>
|
|
<h3>This Page</h3>
|
|
<ul class="this-page-menu">
|
|
<li><a href="../_sources/starting/dev-env.txt"
|
|
rel="nofollow">Show Source</a></li>
|
|
</ul>
|
|
<div id="searchbox" style="display: none">
|
|
<h3>Quick search</h3>
|
|
<form class="search" action="../search.html" method="get">
|
|
<input type="text" name="q" />
|
|
<input type="submit" value="Go" />
|
|
<input type="hidden" name="check_keywords" value="yes" />
|
|
<input type="hidden" name="area" value="default" />
|
|
</form>
|
|
<p class="searchtip" style="font-size: 90%">
|
|
Enter search terms or a module, class or function name.
|
|
</p>
|
|
</div>
|
|
<script type="text/javascript">$('#searchbox').show(0);</script>
|
|
</div>
|
|
</div>
|
|
<div class="clearer"></div>
|
|
</div>
|
|
<div class="footer">
|
|
© Copyright 2011. A <a href="http://kennethreitz.com/pages/open-projects.html">Kenneth Reitz</a> Project.
|
|
</div>
|
|
<a href="https://github.com/kennethreitz/python-guide" class="github">
|
|
<img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" />
|
|
</a>
|
|
|
|
<script type="text/javascript">
|
|
|
|
var _gaq2 = _gaq2 || [];
|
|
_gaq2.push(['_setAccount', 'UA-8742933-10']);
|
|
_gaq2.push(['_setDomainName', 'none']);
|
|
_gaq2.push(['_setAllowLinker', true]);
|
|
_gaq2.push(['_trackPageview']);
|
|
|
|
(function() {
|
|
var ga2 = document.createElement('script'); ga.type = 'text/javascript'; ga2.async = true;
|
|
ga2.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
|
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga2, s);
|
|
})();
|
|
|
|
</script>
|
|
|
|
<script type="text/javascript">
|
|
(function() {
|
|
var t = document.createElement('script');
|
|
t.type = 'text/javascript';
|
|
t.async = true;
|
|
t.id = 'gauges-tracker';
|
|
t.setAttribute('data-site-id',
|
|
'4ddc1cfaf5a1f50fcc000001');
|
|
t.src = '//secure.gaug.es/track.js';
|
|
var s = document.getElementsByTagName('script')[0];
|
|
s.parentNode.insertBefore(t, s);
|
|
})();
|
|
</script>
|
|
</body>
|
|
</html> |