mirror of
https://github.com/kennethreitz/python-guide.git
synced 2026-06-05 23:00:18 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
Vendored
+1
-1
@@ -21,7 +21,7 @@
|
||||
<h3>Contributors</h3>
|
||||
<p>
|
||||
This guide is the result of the collaboration of
|
||||
<a href="https://github.com/kennethreitz/python-guide/graphs/contributors">135+ people</a>
|
||||
<a href="https://github.com/kennethreitz/python-guide/graphs/contributors">hundreds of people</a>
|
||||
around the world, and your contributions
|
||||
<a href="http://docs.python-guide.org/en/latest/notes/contribute/">are welcome</a>!
|
||||
</p>
|
||||
|
||||
@@ -270,6 +270,11 @@ most out of using Python interactively. Its main components are:
|
||||
|
||||
$ pip install ipython
|
||||
|
||||
To download and install IPython with all it's optional dependencies for the notebook, qtconsole, tests, and other functionalities
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ pip install ipython[all]
|
||||
|
||||
BPython
|
||||
-------
|
||||
|
||||
@@ -23,7 +23,7 @@ both popular and exotic.
|
||||
pydoc
|
||||
-----
|
||||
|
||||
:program:`pydoc` is a utlity that is installed when you install Python.
|
||||
:program:`pydoc` is a utility that is installed when you install Python.
|
||||
It allows you to quickly retrieve and search for documentation from your
|
||||
shell. For example, if you needed a quick refresher on the
|
||||
:mod:`time` module, pulling up documentation would be as simple as
|
||||
|
||||
@@ -255,8 +255,8 @@ system. `Puppet Forge <https://forge.puppetlabs.com/>`_ is a repository for
|
||||
modules written by the community for Open Source and Enterprise Puppet.
|
||||
|
||||
Puppet Agents are installed on nodes whose state needs to be monitored or
|
||||
changed. A desginated server known as the Puppet Master is responsible for
|
||||
orchastrating the agent nodes.
|
||||
changed. A designated server known as the Puppet Master is responsible for
|
||||
orchestrating the agent nodes.
|
||||
|
||||
Agent nodes send basic facts about the system such as to the operating system,
|
||||
kernel, architecture, ip address, hostname etc. to the Puppet Master.
|
||||
|
||||
@@ -15,7 +15,7 @@ and the mailing list https://groups.google.com/forum/#!forum/project-camelot
|
||||
|
||||
Cocoa
|
||||
-----
|
||||
.. note:: The Cocoa framework is only available on OS X. Don't pick this if you're writing a cross-platform application!
|
||||
.. note:: The Cocoa framework is only available on OS X. Don't pick this if you're writing a cross-platform application!
|
||||
|
||||
GTk
|
||||
---
|
||||
|
||||
@@ -107,7 +107,7 @@ Prerequisite is to have installed :ref:`Python, Setuptools and pywin32 dependenc
|
||||
- `Manual <http://www.pyinstaller.org/export/d3398dd79b68901ae1edd761f3fe0f4ff19cfb1a/project/doc/Manual.html?format=raw>`_
|
||||
|
||||
|
||||
OS X
|
||||
OS X
|
||||
----
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ The downside of distributing code like this is that it relies on the
|
||||
recipient understanding how to install the required version of Python,
|
||||
and being able and willing to use tools such as pip to install your code's
|
||||
other dependencies. This is fine when distributing to other developers, but
|
||||
makes this method unsuitable for distributing applications to end-uers.
|
||||
makes this method unsuitable for distributing applications to end-users.
|
||||
|
||||
The `Python Packaging Guide <https://python-packaging-user-guide.readthedocs.org/en/latest/>`_
|
||||
provides an extensive guide on creating and maintaining Python packages.
|
||||
|
||||
@@ -73,7 +73,7 @@ software over a network (usually the Internet) with a single command
|
||||
capability to your own Python software with very little work.
|
||||
|
||||
``pip`` is a tool for easily installing and managing Python packages,
|
||||
that is recommended over ``easy_install``. It is superior to ``easy_install`` in `several ways <https://python-packaging-user-guide.readthedocs.org/en/latest/pip_easy_install.html#pip-vs-easy-install>`_,
|
||||
that is recommended over ``easy_install``. It is superior to ``easy_install`` in `several ways <https://python-packaging-user-guide.readthedocs.org/en/latest/pip_easy_install/#pip-vs-easy-install>`_,
|
||||
and is actively maintained.
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Further Configuration of Pip and Virtualenv
|
||||
Requiring an active virtual environment for ``pip``
|
||||
---------------------------------------------------
|
||||
|
||||
By now it should be clear that using virtual envirtonments is a great way to
|
||||
By now it should be clear that using virtual environments is a great way to
|
||||
keep your development environment clean and keeping different projects'
|
||||
requirements separate.
|
||||
|
||||
@@ -71,7 +71,7 @@ add the following lines to this new file:
|
||||
|
||||
|
||||
You will of course need to install some packages globally (usually ones that
|
||||
you use across different projects consistenly) and this can be accomplished by
|
||||
you use across different projects consistently) and this can be accomplished by
|
||||
adding the following to your :file:`~/.bashrc` file:
|
||||
|
||||
.. code-block:: console
|
||||
@@ -94,7 +94,7 @@ that you use. For example, you may be using the ``requests`` library in a lot
|
||||
of different projects.
|
||||
|
||||
It is surely unnecessary to re-download the same packages/libraries each time
|
||||
you start working on a new project (and in a new virtual environmen as a result).
|
||||
you start working on a new project (and in a new virtual environment as a result).
|
||||
Fortunately, you can configure pip in such a way that it tries to reuse already
|
||||
installed packages.
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ comment block is a programmer's note. The docstring describes the
|
||||
"""Returns the square root of self times self."""
|
||||
...
|
||||
|
||||
.. seealso:: Further reading on docstrings: :pep:`257`
|
||||
.. see also:: Further reading on docstrings: :pep:`257`
|
||||
|
||||
|
||||
Other Tools
|
||||
|
||||
@@ -213,8 +213,8 @@ can be somewhat misleading and needs to be clarified.
|
||||
In Python, everything is an object, and can be handled as such. This is what is
|
||||
meant when we say, for example, that functions are first-class objects.
|
||||
Functions, classes, strings, and even types are objects in Python: like any
|
||||
objects, they have a type, they can be passed as function arguments, they may
|
||||
have methods and properties. In this understanding, Python is an
|
||||
object, they have a type, they can be passed as function arguments, and they
|
||||
may have methods and properties. In this understanding, Python is an
|
||||
object-oriented language.
|
||||
|
||||
However, unlike Java, Python does not impose object-oriented programming as the
|
||||
|
||||
+18
-1
@@ -6,7 +6,7 @@ Code Style
|
||||
If you ask Python programmers what they like most in Python, they will
|
||||
often say its high readability. Indeed, a high level of readability
|
||||
is at the heart of the design of the Python language, following the
|
||||
recognised fact that code is read much more often than it is written.
|
||||
recognized fact that code is read much more often than it is written.
|
||||
|
||||
One reason for Python code to be easily read and understood is its relatively
|
||||
complete set of Code Style guidelines and "Pythonic" idioms.
|
||||
@@ -452,6 +452,23 @@ Then run it on a file or series of files to get a report of any violations.
|
||||
optparse.py:472:29: E221 multiple spaces before operator
|
||||
optparse.py:544:21: W601 .has_key() is deprecated, use 'in'
|
||||
|
||||
The program `autopep8 <https://pypi.python.org/pypi/autopep8/>`_ can be used to
|
||||
automatically reformat code in the PEP 8 style. Install the program with:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ pip install autopep8
|
||||
|
||||
Use it to format a file in-place with:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ autopep8 --in-place optparse.py
|
||||
|
||||
Excluding the ``--in-place`` flag will cause the program to output the modified
|
||||
code directly to the console for review. The ``--aggressive`` flag will perform
|
||||
more substantial changes and can be applied multiple times for greater effect.
|
||||
|
||||
Conventions
|
||||
----------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user