mirror of
https://github.com/kennethreitz/python-guide.git
synced 2026-06-05 14:50:19 +00:00
Mark up files & directories
This commit is contained in:
+3
-3
@@ -16,7 +16,7 @@ Vim is a text editor which uses keyboard shortcuts for editing instead of menus
|
||||
or icons. 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 line-wrapping to values compliant with
|
||||
:pep:`8`. In your home directory, open a file called ``.vimrc`` and add the
|
||||
:pep:`8`. In your home directory, open a file called :file:`.vimrc` and add the
|
||||
following lines::
|
||||
|
||||
set textwidth=79 " lines longer than 79 columns will be broken
|
||||
@@ -46,7 +46,7 @@ install vim-pyflakes_. Now you can map the functions ``Pep8()`` or ``Pyflakes()`
|
||||
to any hotkey or action you want in Vim. Both plugins will display errors at
|
||||
the bottom of the screen, and provide an easy way to jump to the corresponding
|
||||
line. It's very handy to call these functions whenever you save a file. In
|
||||
order to do this, add the following lines to your ``.vimrc``::
|
||||
order to do this, add the following lines to your :file:`.vimrc`::
|
||||
|
||||
autocmd BufWritePost *.py call Pyflakes()
|
||||
autocmd BufWritePost *.py call Pep8()
|
||||
@@ -253,7 +253,7 @@ the current state of the environment packages. To do this, run
|
||||
|
||||
$ pip freeze > requirements.txt
|
||||
|
||||
This will create a ``requirements.txt`` file, which contains a simple
|
||||
This will create a :file:`requirements.txt` file, which contains a simple
|
||||
list of all the packages in the current environment, and their respective
|
||||
versions. Later, when a different developer (or you, if you need to re-
|
||||
create the environment) can install the same packages, with the same
|
||||
|
||||
@@ -30,7 +30,7 @@ Basic Usage
|
||||
$ virtualenv venv
|
||||
|
||||
This creates a copy of Python in whichever directory you ran the command in,
|
||||
placing it in a folder named ``venv``.
|
||||
placing it in a folder named :file:`venv`.
|
||||
|
||||
2. To begin using the virtual environment, it needs to be activated:
|
||||
|
||||
@@ -94,7 +94,7 @@ Basic Usage
|
||||
|
||||
$ mkvirtualenv venv
|
||||
|
||||
This creates the ``venv`` folder inside ``~/Envs``.
|
||||
This creates the :file:`venv` folder inside :file:`~/Envs`.
|
||||
|
||||
2. Work on a virtual environment:
|
||||
|
||||
@@ -105,6 +105,7 @@ This creates the ``venv`` folder inside ``~/Envs``.
|
||||
**virtualenvwrapper** provides tab-completion on environment names. It really
|
||||
helps when you have a lot of environments and have trouble remembering their
|
||||
names.
|
||||
|
||||
``workon`` also deactivates whatever environment you are currently in, so you
|
||||
can quickly switch between environments.
|
||||
|
||||
@@ -128,19 +129,19 @@ Other useful commands
|
||||
|
||||
``cdvirtualenv``
|
||||
Navigate into the directory of the currently activated virtual environment,
|
||||
so you can browse its ``site-packages``, for example.
|
||||
so you can browse its :file:`site-packages`, for example.
|
||||
|
||||
``cdsitepackages``
|
||||
Like the above, but directly into ``site-packages`` directory.
|
||||
Like the above, but directly into :file:`site-packages` directory.
|
||||
|
||||
``lssitepackages``
|
||||
Shows contents of ``site-packages`` directory.
|
||||
Shows contents of :file:`site-packages` directory.
|
||||
|
||||
`Full list of virtualenvwrapper commands <http://virtualenvwrapper.readthedocs.org/en/latest/command_ref.html>`_.
|
||||
|
||||
autoenv
|
||||
-------
|
||||
When you ``cd`` into a directory containing a ``.env``, `autoenv <https://github.com/kennethreitz/autoenv>`_
|
||||
When you ``cd`` into a directory containing a :file:`.env`, `autoenv <https://github.com/kennethreitz/autoenv>`_
|
||||
automagically activates the environment.
|
||||
|
||||
Install it on Mac OS X using ``brew``:
|
||||
|
||||
Reference in New Issue
Block a user