Fixed all H2 headings

Before, H2 fomratting was not consistent.
Now, all H2 headings use over/under asterisks.
This commit is contained in:
Marc Poulin
2018-12-04 13:44:41 -07:00
parent 58fe178325
commit 35c13bc9ea
43 changed files with 532 additions and 203 deletions
+16 -8
View File
@@ -7,16 +7,19 @@ The Community
.. image:: /_static/photos/34689432801_78d97ecec9_k_d.jpg .. image:: /_static/photos/34689432801_78d97ecec9_k_d.jpg
****
BDFL BDFL
---- ****
Guido van Rossum, the creator of Python, is often referred to as the BDFL — the Guido van Rossum, the creator of Python, is often referred to as the BDFL — the
Benevolent Dictator For Life. Benevolent Dictator For Life.
**************************
Python Software Foundation Python Software Foundation
-------------------------- **************************
The mission of the Python Software Foundation is to promote, protect, and The mission of the Python Software Foundation is to promote, protect, and
advance the Python programming language, and to support and facilitate the advance the Python programming language, and to support and facilitate the
@@ -25,8 +28,9 @@ growth of a diverse and international community of Python programmers.
`Learn More about the PSF <http://www.python.org/psf/>`_. `Learn More about the PSF <http://www.python.org/psf/>`_.
****
PEPs PEPs
---- ****
PEPs are *Python Enhancement Proposals*. They describe changes to Python itself, PEPs are *Python Enhancement Proposals*. They describe changes to Python itself,
or the standards around it. or the standards around it.
@@ -72,8 +76,9 @@ Here's an overview of the PEP acceptance workflow:
.. image:: ../_static/pep-0001-1.png .. image:: ../_static/pep-0001-1.png
******************
Python Conferences Python Conferences
------------------ ******************
The major events for the Python community are developer conferences. The two The major events for the Python community are developer conferences. The two
most notable conferences are PyCon, which is held in the US, and its European most notable conferences are PyCon, which is held in the US, and its European
@@ -82,16 +87,18 @@ sibling, EuroPython.
A comprehensive list of conferences is maintained at `pycon.org <http://www.pycon.org/>`_. A comprehensive list of conferences is maintained at `pycon.org <http://www.pycon.org/>`_.
******************
Python User Groups Python User Groups
------------------ ******************
User Groups are where a bunch of Python developers meet to present or talk User Groups are where a bunch of Python developers meet to present or talk
about Python topics of interest. A list of local user groups is maintained at about Python topics of interest. A list of local user groups is maintained at
the `Python Software Foundation Wiki <http://wiki.python.org/moin/LocalUserGroups>`_. the `Python Software Foundation Wiki <http://wiki.python.org/moin/LocalUserGroups>`_.
******************
Online Communities Online Communities
------------------ ******************
`PythonistaCafe <https://www.pythonistacafe.com>`_ is an invite-only, online community `PythonistaCafe <https://www.pythonistacafe.com>`_ is an invite-only, online community
of Python and software development enthusiasts helping each other succeed and grow. of Python and software development enthusiasts helping each other succeed and grow.
@@ -99,8 +106,9 @@ Think of it as a club of mutual improvement for Pythonistas where a broad range
programming questions, career advice, and other topics are discussed every day. programming questions, career advice, and other topics are discussed every day.
*****************
Python Job Boards Python Job Boards
----------------- *****************
`Python Jobs HQ <https://www.pythonjobshq.com>`_ is a Python job board, by Python Developers `Python Jobs HQ <https://www.pythonjobshq.com>`_ is a Python job board, by Python Developers
for Python Developers. The site aggregates Python job postings from across the web and for Python Developers. The site aggregates Python job postings from across the web and
+7 -3
View File
@@ -6,8 +6,10 @@ Documentation
.. image:: /_static/photos/33928823133_2f3d32cf32_k_d.jpg .. image:: /_static/photos/33928823133_2f3d32cf32_k_d.jpg
**********************
Official Documentation Official Documentation
---------------------- **********************
The official Python Language and Library documentation can be found here: The official Python Language and Library documentation can be found here:
@@ -15,8 +17,9 @@ The official Python Language and Library documentation can be found here:
- `Python 3.x <https://docs.python.org/3/>`_ - `Python 3.x <https://docs.python.org/3/>`_
*************
Read the Docs Read the Docs
------------- *************
Read the Docs is a popular community project that hosts documentation Read the Docs is a popular community project that hosts documentation
for open source software. It holds documentation for many Python modules, for open source software. It holds documentation for many Python modules,
@@ -25,8 +28,9 @@ both popular and exotic.
`Read the Docs <https://readthedocs.org/>`_ `Read the Docs <https://readthedocs.org/>`_
*****
pydoc pydoc
----- *****
:program:`pydoc` is a utility 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 It allows you to quickly retrieve and search for documentation from your
+3 -1
View File
@@ -59,8 +59,10 @@ include:
.. _about-ref: .. _about-ref:
****************
About This Guide About This Guide
---------------- ****************
Purpose Purpose
~~~~~~~ ~~~~~~~
+14 -7
View File
@@ -6,8 +6,10 @@ Learning Python
.. image:: /_static/photos/32800783863_11a00db52c_k_d.jpg .. image:: /_static/photos/32800783863_11a00db52c_k_d.jpg
********
Beginner Beginner
-------- ********
The Python Tutorial The Python Tutorial
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
@@ -195,8 +197,9 @@ making the process of learning Python fun and engaging.
`Code the blocks <https://codetheblocks.com/tutorials/introduction>`_ `Code the blocks <https://codetheblocks.com/tutorials/introduction>`_
************
Intermediate Intermediate
------------ ************
Python Tricks: The Book Python Tricks: The Book
~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
@@ -218,8 +221,9 @@ programmers.
`Effective Python <http://www.effectivepython.com/>`_ `Effective Python <http://www.effectivepython.com/>`_
********
Advanced Advanced
-------- ********
Pro Python Pro Python
~~~~~~~~~~ ~~~~~~~~~~
@@ -261,9 +265,9 @@ and can make classes and objects behave in different and magical ways.
`A Guide to Python's Magic Methods (repo on GitHub) <https://github.com/RafeKettler/magicmethods/blob/master/magicmethods.pdf>`_ `A Guide to Python's Magic Methods (repo on GitHub) <https://github.com/RafeKettler/magicmethods/blob/master/magicmethods.pdf>`_
****************************
For Engineers and Scientists For Engineers and Scientists
---------------------------- ****************************
A Primer on Scientific Programming with Python A Primer on Scientific Programming with Python
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -282,8 +286,10 @@ puts the emphasis on numerical methods and how to implement them in Python.
`Numerical Methods in Engineering with Python <http://www.cambridge.org/us/academic/subjects/engineering/engineering-mathematics-and-programming/numerical-methods-engineering-python-2nd-edition>`_ `Numerical Methods in Engineering with Python <http://www.cambridge.org/us/academic/subjects/engineering/engineering-mathematics-and-programming/numerical-methods-engineering-python-2nd-edition>`_
********************
Miscellaneous Topics Miscellaneous Topics
-------------------- ********************
Problem Solving with Algorithms and Data Structures Problem Solving with Algorithms and Data Structures
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -339,8 +345,9 @@ PythonistaCafe is an invite-only, online community of Python and software develo
`PythonistaCafe <https://www.pythonistacafe.com>`_ `PythonistaCafe <https://www.pythonistacafe.com>`_
**********
References References
---------- **********
Python in a Nutshell Python in a Nutshell
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
+30 -10
View File
@@ -6,76 +6,96 @@ News
.. image:: /_static/photos/33573767786_eececc5d27_k_d.jpg .. image:: /_static/photos/33573767786_eececc5d27_k_d.jpg
****************
PyCoders Weekly PyCoders Weekly
~~~~~~~~~~~~~~~~ ****************
PyCoders Weekly is a free weekly Python newsletter for Python developers PyCoders Weekly is a free weekly Python newsletter for Python developers
by Python developers (Projects, Articles, News, and Jobs). by Python developers (Projects, Articles, News, and Jobs).
`PyCoders Weekly <https://pycoders.com/>`_ `PyCoders Weekly <https://pycoders.com/>`_
***********
Real Python Real Python
~~~~~~~~~~~ ***********
At Real Python you can learn all things Python from the ground up, with weekly free and in-depth tutorials. Everything from the absolute basics of Python, to web development and web scraping, to data visualization, and beyond. At Real Python you can learn all things Python from the ground up, with weekly free and in-depth tutorials. Everything from the absolute basics of Python, to web development and web scraping, to data visualization, and beyond.
`Real Python <https://realpython.com/>`_ `Real Python <https://realpython.com/>`_
*************
Planet Python Planet Python
~~~~~~~~~~~~~ *************
This is an aggregate of Python news from a growing number of developers. This is an aggregate of Python news from a growing number of developers.
`Planet Python <http://planet.python.org>`_ `Planet Python <http://planet.python.org>`_
*********
/r/python /r/python
~~~~~~~~~ *********
/r/python is the Reddit Python community where users contribute and vote on /r/python is the Reddit Python community where users contribute and vote on
Python-related news. Python-related news.
`/r/python <http://reddit.com/r/python>`_ `/r/python <http://reddit.com/r/python>`_
*******************
Talk Python Podcast Talk Python Podcast
~~~~~~~~~~~~~~~~~~~ *******************
The #1 Python-focused podcast covering the people and ideas in Python. The #1 Python-focused podcast covering the people and ideas in Python.
`Talk Python To Me <https://talkpython.fm>`_ `Talk Python To Me <https://talkpython.fm>`_
********************
Python Bytes Podcast Python Bytes Podcast
~~~~~~~~~~~~~~~~~~~~ ********************
A short-form Python podcast covering recent developer headlines. A short-form Python podcast covering recent developer headlines.
`Python Bytes <https://pythonbytes.fm>`_ `Python Bytes <https://pythonbytes.fm>`_
*************
Python Weekly Python Weekly
~~~~~~~~~~~~~ *************
Python Weekly is a free weekly newsletter featuring curated news, articles, Python Weekly is a free weekly newsletter featuring curated news, articles,
new releases, jobs, etc. related to Python. new releases, jobs, etc. related to Python.
`Python Weekly <http://www.pythonweekly.com/>`_ `Python Weekly <http://www.pythonweekly.com/>`_
***********
Python News Python News
~~~~~~~~~~~~~ ***********
Python News is the news section in the official Python web site Python News is the news section in the official Python web site
(www.python.org). It briefly highlights the news from the Python community. (www.python.org). It briefly highlights the news from the Python community.
`Python News <http://www.python.org/news/>`_ `Python News <http://www.python.org/news/>`_
********************
Import Python Weekly Import Python Weekly
~~~~~~~~~~~~~~~~~~~~ ********************
Weekly Python Newsletter containing Python Articles, Projects, Videos, Tweets Weekly Python Newsletter containing Python Articles, Projects, Videos, Tweets
delivered in your inbox. Keep Your Python Programming Skills Updated. delivered in your inbox. Keep Your Python Programming Skills Updated.
`Import Python Weekly Newsletter <http://www.importpython.com/newsletter/>`_ `Import Python Weekly Newsletter <http://www.importpython.com/newsletter/>`_
*************************
Awesome Python Newsletter Awesome Python Newsletter
~~~~~~~~~~~~~~~~~~~~~~~~~ *************************
A weekly overview of the most popular Python news, articles and packages. A weekly overview of the most popular Python news, articles and packages.
+6 -2
View File
@@ -11,15 +11,19 @@ issue on GitHub_. To submit patches, please send a pull request on GitHub_.
Once your changes get merged back in, you'll automatically be added to the Once your changes get merged back in, you'll automatically be added to the
`Contributors List <https://github.com/kennethreitz/python-guide/contributors>`_. `Contributors List <https://github.com/kennethreitz/python-guide/contributors>`_.
***********
Style Guide Style Guide
----------- ***********
For all contributions, please follow the :ref:`guide-style-guide`. For all contributions, please follow the :ref:`guide-style-guide`.
.. _todo-list-ref: .. _todo-list-ref:
*********
Todo List Todo List
--------- *********
If you'd like to contribute, there's plenty to do. Here's a short todo_ list. If you'd like to contribute, there's plenty to do. Here's a short todo_ list.
+24 -8
View File
@@ -19,8 +19,10 @@ The Guide is written as :ref:`restructuredtext-ref`.
.. note:: On any page of the rendered HTML you can click "Show Source" to .. note:: On any page of the rendered HTML you can click "Show Source" to
see how authors have styled the page. see how authors have styled the page.
*********
Relevancy Relevancy
--------- *********
Strive to keep any contributions relevant to the :ref:`purpose of The Guide Strive to keep any contributions relevant to the :ref:`purpose of The Guide
<about-ref>`. <about-ref>`.
@@ -36,8 +38,10 @@ Strive to keep any contributions relevant to the :ref:`purpose of The Guide
resources, and describe why it's useful to Python. resources, and describe why it's useful to Python.
* When in doubt, ask. * When in doubt, ask.
********
Headings Headings
-------- ********
Use the following styles for headings. Use the following styles for headings.
@@ -71,8 +75,10 @@ Sub section headings:
Very Deep Very Deep
~~~~~~~~~ ~~~~~~~~~
*****
Prose Prose
----- *****
Wrap text lines at 78 characters. Where necessary, lines may exceed 78 Wrap text lines at 78 characters. Where necessary, lines may exceed 78
characters, especially if wrapping would make the source text more difficult characters, especially if wrapping would make the source text more difficult
@@ -85,8 +91,10 @@ from this project, due to complete and total lack of taste.
Banishment? Is this a joke? Hopefully we will never have to find out. Banishment? Is this a joke? Hopefully we will never have to find out.
*************
Code Examples Code Examples
------------- *************
Wrap all code examples at 70 characters to avoid horizontal scrollbars. Wrap all code examples at 70 characters to avoid horizontal scrollbars.
@@ -122,8 +130,10 @@ Python examples:
def get_answer(): def get_answer():
return 42 return 42
******************
Externally Linking Externally Linking
------------------ ******************
* Prefer labels for well known subjects (ex: proper nouns) when linking: * Prefer labels for well known subjects (ex: proper nouns) when linking:
@@ -143,8 +153,10 @@ Externally Linking
* Avoid using labels such as "click here", "this", etc. preferring * Avoid using labels such as "click here", "this", etc. preferring
descriptive labels (SEO worthy) instead. descriptive labels (SEO worthy) instead.
********************************
Linking to Sections in The Guide Linking to Sections in The Guide
-------------------------------- ********************************
To cross-reference other parts of this documentation, use the `:ref: To cross-reference other parts of this documentation, use the `:ref:
<http://sphinx.pocoo.org/markup/inline.html#cross-referencing-arbitrary-locations>`_ <http://sphinx.pocoo.org/markup/inline.html#cross-referencing-arbitrary-locations>`_
@@ -159,8 +171,10 @@ To make reference labels more clear and unique, always add a ``-ref`` suffix:
Some Section Some Section
------------ ------------
******************
Notes and Warnings Notes and Warnings
------------------ ******************
Make use of the appropriate `admonitions directives Make use of the appropriate `admonitions directives
<http://sphinx.pocoo.org/rest.html#directives>`_ when making notes. <http://sphinx.pocoo.org/rest.html#directives>`_ when making notes.
@@ -180,8 +194,10 @@ Warnings:
.. warning:: DON'T PANIC .. warning:: DON'T PANIC
*****
TODOs TODOs
----- *****
Please mark any incomplete areas of The Guide with a `todo directive Please mark any incomplete areas of The Guide with a `todo directive
<http://sphinx.pocoo.org/ext/todo.html?highlight=todo#directive-todo>`_. To <http://sphinx.pocoo.org/ext/todo.html?highlight=todo#directive-todo>`_. To
+26 -9
View File
@@ -5,8 +5,10 @@ Systems Administration
.. image:: /_static/photos/34435690580_3afec7d4cd_k_d.jpg .. image:: /_static/photos/34435690580_3afec7d4cd_k_d.jpg
******
Fabric Fabric
------ ******
`Fabric <http://docs.fabfile.org>`_ is a library for simplifying system `Fabric <http://docs.fabfile.org>`_ is a library for simplifying system
administration tasks. While Chef and Puppet tend to focus on managing servers administration tasks. While Chef and Puppet tend to focus on managing servers
@@ -73,8 +75,10 @@ programs, and host grouping.
`Fabric Documentation <http://docs.fabfile.org>`_ `Fabric Documentation <http://docs.fabfile.org>`_
****
Salt Salt
---- ****
`Salt <http://saltstack.org/>`_ is an open source infrastructure management `Salt <http://saltstack.org/>`_ is an open source infrastructure management
tool. It supports remote command execution from a central point (master host) tool. It supports remote command execution from a central point (master host)
@@ -132,8 +136,9 @@ State files can be written using YAML, the Jinja2 template system or pure Python
`Salt Documentation <http://docs.saltstack.com>`_ `Salt Documentation <http://docs.saltstack.com>`_
******
Psutil Psutil
------ ******
`Psutil <https://github.com/giampaolo/psutil/>`_ is an interface to different `Psutil <https://github.com/giampaolo/psutil/>`_ is an interface to different
system information (e.g. CPU, memory, disks, network, users and processes). system information (e.g. CPU, memory, disks, network, users and processes).
@@ -188,8 +193,10 @@ A full terminal application like a widely extended top which is based on
psutil and with the ability of a client-server monitoring is psutil and with the ability of a client-server monitoring is
`glance <https://github.com/nicolargo/glances/>`_. `glance <https://github.com/nicolargo/glances/>`_.
*******
Ansible Ansible
------- *******
`Ansible <http://ansible.com/>`_ is an open source system automation tool. `Ansible <http://ansible.com/>`_ is an open source system automation tool.
The biggest advantage over Puppet or Chef is it does not require an agent on The biggest advantage over Puppet or Chef is it does not require an agent on
@@ -240,8 +247,10 @@ about Ansible, read the `Ansible Docs <http://docs.ansible.com/>`_.
great and detailed introduction to getting started with Ansible. great and detailed introduction to getting started with Ansible.
****
Chef Chef
---- ****
`Chef <https://www.chef.io/chef/>`_ is a systems and cloud infrastructure automation `Chef <https://www.chef.io/chef/>`_ is a systems and cloud infrastructure automation
framework that makes it easy to deploy servers and applications to any physical, framework that makes it easy to deploy servers and applications to any physical,
virtual, or cloud location. In case this is your choice for configuration management, virtual, or cloud location. In case this is your choice for configuration management,
@@ -271,8 +280,10 @@ found on the `Chef Supermarket <https://supermarket.chef.io/cookbooks>`_.
- `Chef Documentation <https://docs.chef.io/>`_ - `Chef Documentation <https://docs.chef.io/>`_
******
Puppet Puppet
------ ******
`Puppet <http://puppetlabs.com>`_ is IT Automation and configuration management `Puppet <http://puppetlabs.com>`_ is IT Automation and configuration management
software from Puppet Labs that allows System Administrators to define the state software from Puppet Labs that allows System Administrators to define the state
@@ -367,13 +378,17 @@ everytime the sshd configuration file is changed.
For more information, refer to the `Puppet Labs Documentation <http://docs.puppetlabs.com>`_ For more information, refer to the `Puppet Labs Documentation <http://docs.puppetlabs.com>`_
*********
Blueprint Blueprint
--------- *********
.. todo:: Write about Blueprint .. todo:: Write about Blueprint
********
Buildout Buildout
-------- ********
`Buildout <http://www.buildout.org>`_ is an open source software build tool. `Buildout <http://www.buildout.org>`_ is an open source software build tool.
Buildout is created using the Python programming language. It implements a Buildout is created using the Python programming language. It implements a
@@ -382,8 +397,10 @@ Buildout is primarily used to download and set up dependencies in Python eggs
format of the software being developed or deployed. Recipes for build tasks in any format of the software being developed or deployed. Recipes for build tasks in any
environment can be created, and many are already available. environment can be created, and many are already available.
*******
Shinken Shinken
------- *******
`Shinken <http://www.shinken-monitoring.org/>`_ is a modern, Nagios compatible `Shinken <http://www.shinken-monitoring.org/>`_ is a modern, Nagios compatible
monitoring framework written in Python. Its main goal is to give users a flexible monitoring framework written in Python. Its main goal is to give users a flexible
+12 -7
View File
@@ -8,8 +8,10 @@ Continuous Integration
.. note:: .. note::
For advice on writing your tests, see :doc:`/writing/tests`. For advice on writing your tests, see :doc:`/writing/tests`.
****
Why? Why?
---- ****
Martin Fowler, who first wrote about `Continuous Integration <http://martinfowler.com/articles/continuousIntegration.html>`_ Martin Fowler, who first wrote about `Continuous Integration <http://martinfowler.com/articles/continuousIntegration.html>`_
(short: CI) together with Kent Beck, describes the CI as follows: (short: CI) together with Kent Beck, describes the CI as follows:
@@ -22,24 +24,26 @@ Martin Fowler, who first wrote about `Continuous Integration <http://martinfowle
significantly reduced integration problems and allows a team to develop significantly reduced integration problems and allows a team to develop
cohesive software more rapidly. cohesive software more rapidly.
*******
Jenkins Jenkins
------- *******
`Jenkins CI <http://jenkins-ci.org>`_ is an extensible continuous integration `Jenkins CI <http://jenkins-ci.org>`_ is an extensible continuous integration
engine. Use it. engine. Use it.
********
Buildbot Buildbot
-------- ********
`Buildbot <http://docs.buildbot.net/current/>`_ is a Python system to `Buildbot <http://docs.buildbot.net/current/>`_ is a Python system to
automate the compile/test cycle to validate code changes. automate the compile/test cycle to validate code changes.
***
Tox Tox
--- ***
`tox <https://tox.readthedocs.io/en/latest/>`_ is an automation tool providing `tox <https://tox.readthedocs.io/en/latest/>`_ is an automation tool providing
packaging, testing and deployment of Python software right from the console or packaging, testing and deployment of Python software right from the console or
@@ -54,8 +58,9 @@ which provides the following features:
and merging CI and shell-based testing. and merging CI and shell-based testing.
*********
Travis-CI Travis-CI
--------- *********
`Travis-CI <https://travis-ci.org/>`_ is a distributed CI server which builds `Travis-CI <https://travis-ci.org/>`_ is a distributed CI server which builds
tests for open source projects for free. It provides multiple workers to run tests for open source projects for free. It provides multiple workers to run
+21 -7
View File
@@ -23,31 +23,39 @@ Some popular command-line applications include:
* `mercurial <https://www.mercurial-scm.org/>`_ - A distributed version control * `mercurial <https://www.mercurial-scm.org/>`_ - A distributed version control
system primarily written in Python system primarily written in Python
*****
Clint Clint
----- *****
`clint <https://pypi.python.org/pypi/clint/>`_ is a Python module which is `clint <https://pypi.python.org/pypi/clint/>`_ is a Python module which is
filled with very useful tools for developing command-line applications. filled with very useful tools for developing command-line applications.
It supports features such as; CLI colors and indents, simple and powerful It supports features such as; CLI colors and indents, simple and powerful
column printer, iterator based progress bars and implicit argument handling. column printer, iterator based progress bars and implicit argument handling.
*****
Click Click
----- *****
`click <http://click.pocoo.org/>`_ is a Python package for creating `click <http://click.pocoo.org/>`_ is a Python package for creating
command-line interfaces in a composable way with as little code as command-line interfaces in a composable way with as little code as
possible. This “Command-line Interface Creation Kit” is highly possible. This “Command-line Interface Creation Kit” is highly
configurable but comes with good defaults out of the box. configurable but comes with good defaults out of the box.
******
docopt docopt
------ ******
`docopt <http://docopt.org/>`_ is a lightweight, highly Pythonic package that `docopt <http://docopt.org/>`_ is a lightweight, highly Pythonic package that
allows creating command-line interfaces easily and intuitively, by parsing allows creating command-line interfaces easily and intuitively, by parsing
POSIX-style usage instructions. POSIX-style usage instructions.
****
Plac Plac
------ ****
`Plac <https://pypi.python.org/pypi/plac>`_ is a simple wrapper `Plac <https://pypi.python.org/pypi/plac>`_ is a simple wrapper
over the Python standard library `argparse <http://docs.python.org/2/library/argparse.html>`_, over the Python standard library `argparse <http://docs.python.org/2/library/argparse.html>`_,
@@ -57,8 +65,10 @@ module targets especially unsophisticated users, programmers, sys-admins,
scientists and in general people writing throw-away scripts for themselves, scientists and in general people writing throw-away scripts for themselves,
who choose to create a command-line interface because it is quick and simple. who choose to create a command-line interface because it is quick and simple.
*****
Cliff Cliff
------ *****
`Cliff <http://docs.openstack.org/developer/cliff/>`_ is a framework for `Cliff <http://docs.openstack.org/developer/cliff/>`_ is a framework for
building command-line programs. It uses setuptools entry points to provide building command-line programs. It uses setuptools entry points to provide
@@ -67,8 +77,10 @@ to be used to create multi-level commands such as subversion and git, where
the main program handles some basic argument parsing and then invokes a the main program handles some basic argument parsing and then invokes a
sub-command to do the work. sub-command to do the work.
******
Cement Cement
------ ******
`Cement <http://builtoncement.com/>`_ is an advanced CLI Application Framework. `Cement <http://builtoncement.com/>`_ is an advanced CLI Application Framework.
Its goal is to introduce a standard, and feature-full platform Its goal is to introduce a standard, and feature-full platform
@@ -77,8 +89,10 @@ as support rapid development needs without sacrificing quality.
Cement is flexible, and it's use cases span from the simplicity of a micro-framework Cement is flexible, and it's use cases span from the simplicity of a micro-framework
to the complexity of a meg-framework. to the complexity of a meg-framework.
***********
Python Fire Python Fire
----------- ***********
`Python Fire <https://github.com/google/python-fire/>`_ is a library for `Python Fire <https://github.com/google/python-fire/>`_ is a library for
automatically generating command line interfaces from absolutely any Python automatically generating command line interfaces from absolutely any Python
+11 -4
View File
@@ -5,8 +5,10 @@ Interfacing with C/C++ Libraries
.. image:: /_static/photos/34725951345_c8f5959a2e_k_d.jpg .. image:: /_static/photos/34725951345_c8f5959a2e_k_d.jpg
****************************
C Foreign Function Interface C Foreign Function Interface
---------------------------- ****************************
`CFFI <https://cffi.readthedocs.io/en/latest/>`_ provides a simple to use `CFFI <https://cffi.readthedocs.io/en/latest/>`_ provides a simple to use
mechanism for interfacing with C from both CPython and PyPy. It supports two mechanism for interfacing with C from both CPython and PyPy. It supports two
@@ -29,8 +31,10 @@ ABI Interaction
# prints: 23 # prints: 23
print("{}".format(length)) print("{}".format(length))
******
ctypes ctypes
------ ******
`ctypes <https://docs.python.org/3/library/ctypes.html>`_ is the de facto `ctypes <https://docs.python.org/3/library/ctypes.html>`_ is the de facto
library for interfacing with C/C++ from CPython, and it provides not only library for interfacing with C/C++ from CPython, and it provides not only
@@ -68,8 +72,10 @@ Struct Equivalents
_fields_ = [("a", c_int), _fields_ = [("a", c_int),
("b", c_int)] ("b", c_int)]
****
SWIG SWIG
---- ****
`SWIG <http://www.swig.org>`_, though not strictly Python focused (it supports a `SWIG <http://www.swig.org>`_, though not strictly Python focused (it supports a
large number of scripting languages), is a tool for generating bindings for large number of scripting languages), is a tool for generating bindings for
@@ -124,8 +130,9 @@ Example: Overloading __repr__
%include "MyClass.h" %include "MyClass.h"
************
Boost.Python Boost.Python
------------ ************
`Boost.Python <http://www.boost.org/doc/libs/1_59_0/libs/python/doc/>`_ `Boost.Python <http://www.boost.org/doc/libs/1_59_0/libs/python/doc/>`_
requires a bit more manual work to expose C++ object functionality, but requires a bit more manual work to expose C++ object functionality, but
+5 -2
View File
@@ -5,8 +5,10 @@ Network Applications
.. image:: /_static/photos/34364815780_bea6614025_k_d.jpg .. image:: /_static/photos/34364815780_bea6614025_k_d.jpg
****
HTTP HTTP
:::: ****
The Hypertext Transfer Protocol (HTTP) is an application protocol for The Hypertext Transfer Protocol (HTTP) is an application protocol for
distributed, collaborative, hypermedia information systems. HTTP is the distributed, collaborative, hypermedia information systems. HTTP is the
@@ -31,8 +33,9 @@ Requests.
- `GitHub <https://github.com/kennethreitz/requests>`_ - `GitHub <https://github.com/kennethreitz/requests>`_
*******************
Distributed Systems Distributed Systems
:::::::::::::::::::: *******************
ZeroMQ ZeroMQ
+9 -8
View File
@@ -5,8 +5,10 @@ Cryptography
.. image:: /_static/photos/33907152824_bf91078cc1_k_d.jpg .. image:: /_static/photos/33907152824_bf91078cc1_k_d.jpg
************
Cryptography Cryptography
------------ ************
`Cryptography <https://cryptography.io/en/latest/>`_ is an actively developed `Cryptography <https://cryptography.io/en/latest/>`_ is an actively developed
library that provides cryptographic recipes and primitives. It supports library that provides cryptographic recipes and primitives. It supports
@@ -40,10 +42,9 @@ Example code using high level symmetric encryption recipe:
plain_text = cipher_suite.decrypt(cipher_text) plain_text = cipher_suite.decrypt(cipher_text)
**************
GPGME bindings GPGME bindings
-------------- **************
The `GPGME Python bindings <https://dev.gnupg.org/source/gpgme/browse/master/lang/python/>`_ provide pythonic access to `GPG Made Easy <https://dev.gnupg.org/source/gpgme/browse/master/>`_, a C API for the entire GNU Privacy Guard suite of projects, including GPG, libgcrypt and gpgsm (the S/MIME engine). It supports Python 2.6, 2.7, 3.4 and above. Depends on the SWIG C interface for Python as well as the GnuPG software and libraries. The `GPGME Python bindings <https://dev.gnupg.org/source/gpgme/browse/master/lang/python/>`_ provide pythonic access to `GPG Made Easy <https://dev.gnupg.org/source/gpgme/browse/master/>`_, a C API for the entire GNU Privacy Guard suite of projects, including GPG, libgcrypt and gpgsm (the S/MIME engine). It supports Python 2.6, 2.7, 3.4 and above. Depends on the SWIG C interface for Python as well as the GnuPG software and libraries.
@@ -52,12 +53,12 @@ A more comprehensive `GPGME Python Bindings HOWTO <https://dev.gnupg.org/source/
Available under the same terms as the rest of the GnuPG Project: GPLv2 and LGPLv2.1, both with the "or any later version" clause. Available under the same terms as the rest of the GnuPG Project: GPLv2 and LGPLv2.1, both with the "or any later version" clause.
Installation Installation
------------ ~~~~~~~~~~~~
Included by default when compiling GPGME if the configure script locates a supported python version (which it will if it's in $PATH during configuration). Included by default when compiling GPGME if the configure script locates a supported python version (which it will if it's in $PATH during configuration).
Example Example
------- ~~~~~~~
.. code-block:: python3 .. code-block:: python3
@@ -90,9 +91,9 @@ Example
********
PyCrypto PyCrypto
-------- ********
`PyCrypto <https://www.dlitz.net/software/pycrypto/>`_ is another library, `PyCrypto <https://www.dlitz.net/software/pycrypto/>`_ is another library,
which provides secure hash functions and various encryption algorithms. It which provides secure hash functions and various encryption algorithms. It
+20 -8
View File
@@ -5,8 +5,10 @@ Databases
.. image:: /_static/photos/33907152464_a99fdcc8de_k_d.jpg .. image:: /_static/photos/33907152464_a99fdcc8de_k_d.jpg
******
DB-API DB-API
------ ******
The Python Database API (DB-API) defines a standard interface for Python The Python Database API (DB-API) defines a standard interface for Python
database access modules. It's documented in :pep:`249`. database access modules. It's documented in :pep:`249`.
@@ -17,8 +19,10 @@ Tutorials that explain how to work with modules that conform to this interface c
`here <http://halfcooked.com/presentations/osdc2006/python_databases.html>`__ and `here <http://halfcooked.com/presentations/osdc2006/python_databases.html>`__ and
`here <http://web.archive.org/web/20120815130844/http://www.amk.ca/python/writing/DB-API.html>`__. `here <http://web.archive.org/web/20120815130844/http://www.amk.ca/python/writing/DB-API.html>`__.
**********
SQLAlchemy SQLAlchemy
---------- **********
`SQLAlchemy <http://www.sqlalchemy.org/>`_ is a commonly used database toolkit. `SQLAlchemy <http://www.sqlalchemy.org/>`_ is a commonly used database toolkit.
Unlike many database libraries it not only provides an ORM layer but also a Unlike many database libraries it not only provides an ORM layer but also a
@@ -28,8 +32,10 @@ generalized API for writing database-agnostic code without SQL.
$ pip install sqlalchemy $ pip install sqlalchemy
*******
Records Records
------- *******
`Records <https://github.com/kennethreitz/records>`_ is minimalist SQL library, `Records <https://github.com/kennethreitz/records>`_ is minimalist SQL library,
designed for sending raw SQL queries to various databases. Data can be used designed for sending raw SQL queries to various databases. Data can be used
@@ -41,8 +47,10 @@ programmatically, or exported to a number of useful data formats.
Also included is a command-line tool for exporting SQL data. Also included is a command-line tool for exporting SQL data.
**********
Django ORM Django ORM
---------- **********
The Django ORM is the interface used by `Django <http://www.djangoproject.com>`_ The Django ORM is the interface used by `Django <http://www.djangoproject.com>`_
to provide database access. to provide database access.
@@ -58,8 +66,10 @@ The basics:
- Django gives you an automatically-generated database-access API; see - Django gives you an automatically-generated database-access API; see
`Making queries <https://docs.djangoproject.com/en/dev/topics/db/queries/>`__. `Making queries <https://docs.djangoproject.com/en/dev/topics/db/queries/>`__.
******
peewee peewee
------ ******
`peewee <http://docs.peewee-orm.com/en/latest/>`_ is another ORM with a focus `peewee <http://docs.peewee-orm.com/en/latest/>`_ is another ORM with a focus
on being lightweight with support for Python 2.6+ and 3.2+ which supports on being lightweight with support for Python 2.6+ and 3.2+ which supports
@@ -71,8 +81,10 @@ to query data. While SQLite, MySQL and Postgres are supported out-of-the-box,
there is a `collection of add-ons <https://peewee.readthedocs.io/en/latest/peewee/playhouse.html#playhouse>`_ there is a `collection of add-ons <https://peewee.readthedocs.io/en/latest/peewee/playhouse.html#playhouse>`_
available. available.
*******
PonyORM PonyORM
------- *******
`PonyORM <http://ponyorm.com/>`_ is an ORM that takes a different approach to `PonyORM <http://ponyorm.com/>`_ is an ORM that takes a different approach to
querying the database. Instead of writing an SQL-like language or boolean querying the database. Instead of writing an SQL-like language or boolean
@@ -81,9 +93,9 @@ schema editor that can generate PonyORM entities for you. It supports Python
2.6+ and Python 3.3+ and can connect to SQLite, MySQL, Postgres & Oracle 2.6+ and Python 3.3+ and can connect to SQLite, MySQL, Postgres & Oracle
*********
SQLObject SQLObject
--------- *********
`SQLObject <http://www.sqlobject.org/>`_ is yet another ORM. It supports a wide `SQLObject <http://www.sqlobject.org/>`_ is yet another ORM. It supports a wide
variety of databases: Common database systems MySQL, Postgres and SQLite and variety of databases: Common database systems MySQL, Postgres and SQLite and
+56 -14
View File
@@ -8,8 +8,11 @@ GUI Applications
Alphabetical list of GUI Applications. Alphabetical list of GUI Applications.
*******
Camelot Camelot
------- *******
`Camelot <http://www.python-camelot.com>`_ provides components for building `Camelot <http://www.python-camelot.com>`_ provides components for building
applications on top of Python, SQLAlchemy and Qt. It is inspired by applications on top of Python, SQLAlchemy and Qt. It is inspired by
the Django admin interface. the Django admin interface.
@@ -18,27 +21,39 @@ The main resource for information is the website:
http://www.python-camelot.com http://www.python-camelot.com
and the mailing list https://groups.google.com/forum/#!forum/project-camelot and the mailing list https://groups.google.com/forum/#!forum/project-camelot
*****
Cocoa 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 GTk
--- ***
PyGTK provides Python bindings for the GTK+ toolkit. Like the GTK+ library PyGTK provides Python bindings for the GTK+ toolkit. Like the GTK+ library
itself, it is currently licensed under the GNU LGPL. It is worth noting that itself, it is currently licensed under the GNU LGPL. It is worth noting that
PyGTK only currently supports the Gtk-2.X API (NOT Gtk-3.0). It is currently PyGTK only currently supports the Gtk-2.X API (NOT Gtk-3.0). It is currently
recommended that PyGTK not be used for new projects and that existing recommended that PyGTK not be used for new projects and that existing
applications be ported from PyGTK to PyGObject. applications be ported from PyGTK to PyGObject.
********************
PyGObject aka (PyGi) PyGObject aka (PyGi)
-------------------- ********************
`PyGObject <https://wiki.gnome.org/Projects/PyGObject>`_ provides Python bindings, which gives access to the entire GNOME software platform. `PyGObject <https://wiki.gnome.org/Projects/PyGObject>`_ provides Python bindings, which gives access to the entire GNOME software platform.
It is fully compatible with GTK+ 3. Here is a tutorial to get started with `Python GTK+ 3 Tutorial <https://python-gtk-3-tutorial.readthedocs.io/en/latest/>`_. It is fully compatible with GTK+ 3. Here is a tutorial to get started with `Python GTK+ 3 Tutorial <https://python-gtk-3-tutorial.readthedocs.io/en/latest/>`_.
`API Reference <http://lazka.github.io/pgi-docs/>`_ `API Reference <http://lazka.github.io/pgi-docs/>`_
****
Kivy Kivy
---- ****
`Kivy <http://kivy.org>`_ is a Python library for development of multi-touch `Kivy <http://kivy.org>`_ is a Python library for development of multi-touch
enabled media rich applications. The aim is to allow for quick and easy enabled media rich applications. The aim is to allow for quick and easy
interaction design and rapid prototyping, while making your code reusable interaction design and rapid prototyping, while making your code reusable
@@ -53,12 +68,18 @@ on all major platforms (Linux, OSX, Windows, Android).
The main resource for information is the website: http://kivy.org The main resource for information is the website: http://kivy.org
******
PyObjC PyObjC
------ ******
.. note:: Only available on OS X. Don't pick this if you're writing a cross-platform application. .. note:: Only available on OS X. Don't pick this if you're writing a cross-platform application.
******
PySide PySide
------ ******
PySide is a Python binding of the cross-platform GUI toolkit Qt. PySide is a Python binding of the cross-platform GUI toolkit Qt.
.. code-block:: console .. code-block:: console
@@ -67,16 +88,22 @@ PySide is a Python binding of the cross-platform GUI toolkit Qt.
https://wiki.qt.io/Category:LanguageBindings::PySide::Downloads https://wiki.qt.io/Category:LanguageBindings::PySide::Downloads
****
PyQt PyQt
---- ****
.. note:: If your software does not fully comply with the GPL you will need a commercial license! .. note:: If your software does not fully comply with the GPL you will need a commercial license!
PyQt provides Python bindings for the Qt Framework (see below). PyQt provides Python bindings for the Qt Framework (see below).
http://www.riverbankcomputing.co.uk/software/pyqt/download http://www.riverbankcomputing.co.uk/software/pyqt/download
*****************************
PyjamasDesktop (pyjs Desktop) PyjamasDesktop (pyjs Desktop)
----------------------------- *****************************
PyjamasDesktop is a port of Pyjamas. PyjamasDesktop is application widget set PyjamasDesktop is a port of Pyjamas. PyjamasDesktop is application widget set
for desktop and a cross-platform framework. (After release v0.6 PyjamasDesktop for desktop and a cross-platform framework. (After release v0.6 PyjamasDesktop
is a part of Pyjamas (Pyjs)). Briefly, it allows the exact same Python web is a part of Pyjamas (Pyjs)). Briefly, it allows the exact same Python web
@@ -86,14 +113,20 @@ application source code to be executed as a standalone desktop application.
The main website; `pyjs Desktop <http://pyjs.org/>`_. The main website; `pyjs Desktop <http://pyjs.org/>`_.
**
Qt Qt
-- **
`Qt <http://qt-project.org/>`_ is a cross-platform application framework that `Qt <http://qt-project.org/>`_ is a cross-platform application framework that
is widely used for developing software with a GUI but can also be used for is widely used for developing software with a GUI but can also be used for
non-GUI applications. non-GUI applications.
***********
PySimpleGUI PySimpleGUI
------ ***********
`PySimpleGUI <https://pysimplegui.readthedocs.io/>`_ is a wrapper for Tkinter and Qt (others on the way). The amount of code required to implement custom GUIs is much shorter using PySimpleGUI than if the same GUI were written directly using tkinter or Qt. PySimpleGUI code can be "ported" between GUI frameworks by changing import statement. `PySimpleGUI <https://pysimplegui.readthedocs.io/>`_ is a wrapper for Tkinter and Qt (others on the way). The amount of code required to implement custom GUIs is much shorter using PySimpleGUI than if the same GUI were written directly using tkinter or Qt. PySimpleGUI code can be "ported" between GUI frameworks by changing import statement.
.. code-block:: console .. code-block:: console
@@ -102,8 +135,11 @@ PySimpleGUI
PySimpleGUI is contained in a single PySimpleGUI.py file. Should pip installation be impossible, pasting the PySimpleGUI.py file into a project's folder is all that's required to import and begin using. PySimpleGUI is contained in a single PySimpleGUI.py file. Should pip installation be impossible, pasting the PySimpleGUI.py file into a project's folder is all that's required to import and begin using.
****
Toga Toga
---- ****
`Toga <https://toga.readthedocs.io/en/latest/>`_ is a Python native, OS `Toga <https://toga.readthedocs.io/en/latest/>`_ is a Python native, OS
native, cross platform GUI toolkit. Toga consists of a library of base native, cross platform GUI toolkit. Toga consists of a library of base
components with a shared interface to simplify platform-agnostic GUI components with a shared interface to simplify platform-agnostic GUI
@@ -112,8 +148,11 @@ development.
Toga is available on Mac OS, Windows, Linux (GTK), and mobile platforms such Toga is available on Mac OS, Windows, Linux (GTK), and mobile platforms such
as Android and iOS. as Android and iOS.
**
Tk Tk
-- **
Tkinter is a thin object-oriented layer on top of Tcl/Tk. **It has the advantage Tkinter is a thin object-oriented layer on top of Tcl/Tk. **It has the advantage
of being included with the Python standard library, making it the most of being included with the Python standard library, making it the most
convenient and compatible toolkit to program with.** convenient and compatible toolkit to program with.**
@@ -126,8 +165,11 @@ There's a good multi-language Tk tutorial with Python examples at
`TkDocs <http://www.tkdocs.com/tutorial/index.html>`_. There's more information `TkDocs <http://www.tkdocs.com/tutorial/index.html>`_. There's more information
available on the `Python Wiki <http://wiki.python.org/moin/TkInter>`_. available on the `Python Wiki <http://wiki.python.org/moin/TkInter>`_.
********
wxPython wxPython
-------- ********
wxPython is a GUI toolkit for the Python programming language. It allows wxPython is a GUI toolkit for the Python programming language. It allows
Python programmers to create programs with a robust, highly functional Python programmers to create programs with a robust, highly functional
graphical user interface, simply and easily. It is implemented as a Python graphical user interface, simply and easily. It is implemented as a Python
+5 -2
View File
@@ -11,8 +11,10 @@ Computer Vision (OpenCV).
A brief description of both is given below. A brief description of both is given below.
**********************
Python Imaging Library Python Imaging Library
---------------------- **********************
The `Python Imaging Library <http://www.pythonware.com/products/pil/>`_, or PIL The `Python Imaging Library <http://www.pythonware.com/products/pil/>`_, or PIL
for short, is one of the core libraries for image manipulation in Python. Unfortunately, for short, is one of the core libraries for image manipulation in Python. Unfortunately,
@@ -63,8 +65,9 @@ There are more examples of the Pillow library in the
`Pillow tutorial <https://pillow.readthedocs.io/en/3.0.x/handbook/tutorial.html>`_. `Pillow tutorial <https://pillow.readthedocs.io/en/3.0.x/handbook/tutorial.html>`_.
**************************
OpenSource Computer Vision OpenSource Computer Vision
-------------------------- **************************
OpenSource Computer Vision, more commonly known as OpenCV, is a more advanced OpenSource Computer Vision, more commonly known as OpenCV, is a more advanced
image manipulation and processing software than PIL. It has been implemented image manipulation and processing software than PIL. It has been implemented
+5 -2
View File
@@ -9,8 +9,10 @@ The `json <https://docs.python.org/2/library/json.html>`_ library can parse
JSON from strings or files. The library parses JSON into a Python dictionary JSON from strings or files. The library parses JSON into a Python dictionary
or list. It can also convert Python dictionaries or lists into JSON strings. or list. It can also convert Python dictionaries or lists into JSON strings.
************
Parsing JSON Parsing JSON
------------ ************
Take the following string containing JSON data: Take the following string containing JSON data:
@@ -46,8 +48,9 @@ You can also convert the following to JSON:
'{"first_name": "Guido", "last_name": "Rossum", "titles": ["BDFL", "Developer"]}' '{"first_name": "Guido", "last_name": "Rossum", "titles": ["BDFL", "Developer"]}'
**********
simplejson simplejson
---------- **********
The JSON library was added to Python in version 2.6. The JSON library was added to Python in version 2.6.
If you're using an earlier version of Python, the If you're using an earlier version of Python, the
+6 -2
View File
@@ -10,8 +10,10 @@ Python has a vast number of libraries for data analysis, statistics and Machine
Some widely used packages for Machine Learning and other Data Science applications are enlisted below. Some widely used packages for Machine Learning and other Data Science applications are enlisted below.
***********
Scipy Stack Scipy Stack
----------- ***********
The Scipy stack consists of a bunch of core helper packages used in data science, for statistical analysis and visualising data. Because of its huge number of functionalities and ease of use, the Stack is considered a must-have for most data science applications. The Scipy stack consists of a bunch of core helper packages used in data science, for statistical analysis and visualising data. Because of its huge number of functionalities and ease of use, the Stack is considered a must-have for most data science applications.
@@ -34,8 +36,10 @@ For installing the full stack, or individual packages, you can refer to the inst
**NB:** `Anaconda <https://www.continuum.io/anaconda-overview>`_ is highly preferred and recommended for installing and maintaining data science packages seamlessly. **NB:** `Anaconda <https://www.continuum.io/anaconda-overview>`_ is highly preferred and recommended for installing and maintaining data science packages seamlessly.
************
scikit-learn scikit-learn
------------ ************
Scikit is a free and open-source machine learning library for Python. It offers off-the-shelf functions to implement many algorithms like linear regression, classifiers, SVMs, k-means, Neural Networks etc. It also has a few sample datasets which can be directly used for training and testing. Scikit is a free and open-source machine learning library for Python. It offers off-the-shelf functions to implement many algorithms like linear regression, classifiers, SVMs, k-means, Neural Networks etc. It also has a few sample datasets which can be directly used for training and testing.
+9 -3
View File
@@ -5,8 +5,10 @@ Networking
.. image:: /_static/photos/34151833832_6bdfd930af_k_d.jpg .. image:: /_static/photos/34151833832_6bdfd930af_k_d.jpg
*******
Twisted Twisted
------- *******
`Twisted <http://twistedmatrix.com/trac/>`_ is an event-driven networking `Twisted <http://twistedmatrix.com/trac/>`_ is an event-driven networking
engine. It can be used to build applications around many different networking engine. It can be used to build applications around many different networking
@@ -14,8 +16,10 @@ protocols, including http servers and clients, applications using SMTP, POP3,
IMAP or SSH protocols, instant messaging IMAP or SSH protocols, instant messaging
and `much more <http://twistedmatrix.com/trac/wiki/Documentation>`_. and `much more <http://twistedmatrix.com/trac/wiki/Documentation>`_.
*****
PyZMQ PyZMQ
----- *****
`PyZMQ <http://zeromq.github.com/pyzmq/>`_ is the Python binding for `PyZMQ <http://zeromq.github.com/pyzmq/>`_ is the Python binding for
`ZeroMQ <http://www.zeromq.org/>`_, which is a high-performance asynchronous `ZeroMQ <http://www.zeromq.org/>`_, which is a high-performance asynchronous
@@ -32,8 +36,10 @@ message queuing without a message broker. The basic patterns for this are:
For a quick start, read the `ZeroMQ guide <http://zguide.zeromq.org/page:all>`_. For a quick start, read the `ZeroMQ guide <http://zguide.zeromq.org/page:all>`_.
******
gevent gevent
------ ******
`gevent <http://www.gevent.org/>`_ is a coroutine-based Python networking `gevent <http://www.gevent.org/>`_ is a coroutine-based Python networking
library that uses greenlets to provide a high-level synchronous API on top of library that uses greenlets to provide a high-level synchronous API on top of
+9 -4
View File
@@ -5,8 +5,10 @@ Scientific Applications
.. image:: /_static/photos/33925223870_97e44f5629_k_d.jpg .. image:: /_static/photos/33925223870_97e44f5629_k_d.jpg
*******
Context Context
::::::: *******
Python is frequently used for high-performance scientific applications. It Python is frequently used for high-performance scientific applications. It
is widely used in academia and scientific projects because it is easy to write is widely used in academia and scientific projects because it is easy to write
@@ -21,8 +23,9 @@ Python ecosystem can be found in the `Python Scientific Lecture Notes
<http://scipy-lectures.github.com/>`_ <http://scipy-lectures.github.com/>`_
*****
Tools Tools
::::: *****
IPython IPython
------- -------
@@ -37,8 +40,9 @@ store chunks of Python code along side the results and additional comments
file formats. file formats.
*********
Libraries Libraries
::::::::: *********
NumPy NumPy
----- -----
@@ -112,8 +116,9 @@ The library handles presentation of stimuli, scripting of experimental design
and data collection. and data collection.
*********
Resources Resources
::::::::: *********
Installation of scientific Python packages can be troublesome, as many of Installation of scientific Python packages can be troublesome, as many of
these packages are implemented as Python C extensions which need to be compiled. these packages are implemented as Python C extensions which need to be compiled.
+6 -2
View File
@@ -5,8 +5,10 @@ HTML Scraping
.. image:: /_static/photos/34268661876_442428e122_k_d.jpg .. image:: /_static/photos/34268661876_442428e122_k_d.jpg
************
Web Scraping Web Scraping
------------ ************
Web sites are written using HTML, which means that each web page is a Web sites are written using HTML, which means that each web page is a
structured document. Sometimes it would be great to obtain some data from structured document. Sometimes it would be great to obtain some data from
@@ -18,8 +20,10 @@ computer program to sift through a web page and gather the data that you need
in a format most useful to you while at the same time preserving the structure in a format most useful to you while at the same time preserving the structure
of the data. of the data.
*****************
lxml and Requests lxml and Requests
----------------- *****************
`lxml <http://lxml.de/>`_ is a pretty extensive library written for parsing `lxml <http://lxml.de/>`_ is a pretty extensive library written for parsing
XML and HTML documents very quickly, even handling messed up tags in the XML and HTML documents very quickly, even handling messed up tags in the
+9 -3
View File
@@ -5,8 +5,10 @@ Data Serialization
.. image:: /_static/photos/33467946364_3e59bd376a_k_d.jpg .. image:: /_static/photos/33467946364_3e59bd376a_k_d.jpg
***************************
What is data serialization? What is data serialization?
--------------------------- ***************************
Data serialization is the concept of converting structured data into a format Data serialization is the concept of converting structured data into a format
that allows it to be shared or stored in such a way that its original that allows it to be shared or stored in such a way that its original
@@ -14,8 +16,10 @@ structure to be recovered. In some cases, the secondary intention of data
serialization is to minimize the size of the serialized data which then serialization is to minimize the size of the serialized data which then
minimizes disk space or bandwidth requirements. minimizes disk space or bandwidth requirements.
******
Pickle Pickle
------ ******
The native data serialization module for Python is called `Pickle The native data serialization module for Python is called `Pickle
<https://docs.python.org/2/library/pickle.html>`_. <https://docs.python.org/2/library/pickle.html>`_.
@@ -35,8 +39,10 @@ Here's an example:
#Use loads to de-serialize an object #Use loads to de-serialize an object
received_grades = pickle.loads( serial_grades ) received_grades = pickle.loads( serial_grades )
********
Protobuf Protobuf
-------- ********
If you're looking for a serialization module that has support in multiple If you're looking for a serialization module that has support in multiple
languages, Google's `Protobuf languages, Google's `Protobuf
+9 -3
View File
@@ -37,8 +37,10 @@ and PyPy's processing.
1.54693889618 1.54693889618
1.60109114647 1.60109114647
*******
Context Context
::::::: *******
The GIL The GIL
@@ -65,8 +67,10 @@ The GIL
`Special care`_ must be taken when writing C extensions to make sure you `Special care`_ must be taken when writing C extensions to make sure you
register your threads with the interpreter. register your threads with the interpreter.
************
C Extensions C Extensions
:::::::::::: ************
Cython Cython
@@ -226,8 +230,10 @@ Pyrex
Shedskin? Shedskin?
--------- ---------
***********
Concurrency Concurrency
::::::::::: ***********
Concurrent.futures Concurrent.futures
+19 -7
View File
@@ -9,8 +9,10 @@ As a powerful scripting language adapted to both fast prototyping
and bigger projects, Python is widely used in web application and bigger projects, Python is widely used in web application
development. development.
*******
Context Context
::::::: *******
@@ -25,8 +27,9 @@ can be deployed in any :ref:`WSGI-compliant web server <wsgi-servers-ref>`.
WSGI is documented in :pep:`3333`. WSGI is documented in :pep:`3333`.
**********
Frameworks Frameworks
:::::::::: **********
Broadly speaking, a web framework consists of a set of libraries and a main Broadly speaking, a web framework consists of a set of libraries and a main
handler within which you can build custom code to implement a web application handler within which you can build custom code to implement a web application
@@ -141,8 +144,10 @@ Masonite comes with a lot of functionality out of the box including a powerful I
Masonite is perfect for beginners or experienced developers alike and works hard to be fast and easy from install through to deployment. Try it once and youll fall in love. Masonite is perfect for beginners or experienced developers alike and works hard to be fast and easy from install through to deployment. Try it once and youll fall in love.
***********
Web Servers Web Servers
::::::::::: ***********
.. _nginx-ref: .. _nginx-ref:
@@ -159,8 +164,10 @@ to serve high-load websites, Nginx is gradually becoming quite popular.
.. _wsgi-servers-ref: .. _wsgi-servers-ref:
************
WSGI Servers WSGI Servers
:::::::::::: ************
Stand-alone WSGI servers typically use less resources than traditional web Stand-alone WSGI servers typically use less resources than traditional web
servers and provide top performance [3]_. servers and provide top performance [3]_.
@@ -215,8 +222,9 @@ I do not recommend using uWSGI unless you know why you need it.
.. _server-best-practices-ref: .. _server-best-practices-ref:
*********************
Server Best Practices Server Best Practices
::::::::::::::::::::: *********************
The majority of self-hosted Python applications today are hosted with a WSGI The majority of self-hosted Python applications today are hosted with a WSGI
server such as :ref:`Gunicorn <gunicorn-ref>`, either directly or behind a server such as :ref:`Gunicorn <gunicorn-ref>`, either directly or behind a
@@ -226,8 +234,10 @@ The WSGI servers serve the Python applications while the web server handles
tasks better suited for it such as static file serving, request routing, DDoS tasks better suited for it such as static file serving, request routing, DDoS
protection, and basic authentication. protection, and basic authentication.
*******
Hosting Hosting
::::::: *******
Platform-as-a-Service (PaaS) is a type of cloud computing infrastructure Platform-as-a-Service (PaaS) is a type of cloud computing infrastructure
which abstracts and manages infrastructure, routing, and scaling of web which abstracts and manages infrastructure, routing, and scaling of web
@@ -259,8 +269,10 @@ Eldarion
by Kubernetes, CoreOS, and Docker. They support any WSGI application and have a by Kubernetes, CoreOS, and Docker. They support any WSGI application and have a
guide on deploying `Django projects <https://eldarion-gondor.github.io/docs/how-to/setup-deploy-first-django-project/>`_. guide on deploying `Django projects <https://eldarion-gondor.github.io/docs/how-to/setup-deploy-first-django-project/>`_.
**********
Templating Templating
:::::::::: **********
Most WSGI applications are responding to HTTP requests to serve content in HTML Most WSGI applications are responding to HTTP requests to serve content in HTML
or other markup languages. Instead of generating directly textual content from or other markup languages. Instead of generating directly textual content from
+6 -2
View File
@@ -5,8 +5,10 @@ XML parsing
.. image:: /_static/photos/33888714601_a1f7d020a2_k_d.jpg .. image:: /_static/photos/33888714601_a1f7d020a2_k_d.jpg
********
untangle untangle
-------- ********
`untangle <https://github.com/stchris/untangle>`_ is a simple library which `untangle <https://github.com/stchris/untangle>`_ is a simple library which
takes an XML document and returns a Python object which mirrors the nodes and takes an XML document and returns a Python object which mirrors the nodes and
@@ -36,8 +38,10 @@ and then you can get the child elements name like this:
untangle also supports loading XML from a string or an URL. untangle also supports loading XML from a string or an URL.
*********
xmltodict xmltodict
--------- *********
`xmltodict <http://github.com/martinblech/xmltodict>`_ is another simple `xmltodict <http://github.com/martinblech/xmltodict>`_ is another simple
library that aims at making XML feel like working with JSON. library that aims at making XML feel like working with JSON.
+12 -5
View File
@@ -27,8 +27,10 @@ distribution by about 212MB. Also, you will be responsible for shipping
updated versions of your application when security vulnerabilities to updated versions of your application when security vulnerabilities to
Python are patched. Python are patched.
************************
Alternatives to Freezing Alternatives to Freezing
------------------------ ************************
:ref:`Packaging your code <packaging-your-code-ref>` is for distributing :ref:`Packaging your code <packaging-your-code-ref>` is for distributing
libraries or tools to other developers. libraries or tools to other developers.
@@ -40,8 +42,9 @@ On Linux, an alternative to freezing is to
.. todo:: Fill in "Freezing Your Code" stub .. todo:: Fill in "Freezing Your Code" stub
****************************
Comparison of Freezing Tools Comparison of Freezing Tools
---------------------------- ****************************
Solutions and platforms/features supported: Solutions and platforms/features supported:
@@ -65,8 +68,10 @@ py2app no no yes yes MIT no yes yes
Only Pyinstaller makes self-executable exe that bundles the dll when Only Pyinstaller makes self-executable exe that bundles the dll when
passing ``--onefile`` to :file:`Configure.py`. passing ``--onefile`` to :file:`Configure.py`.
*******
Windows Windows
------- *******
bbFreeze bbFreeze
~~~~~~~~ ~~~~~~~~
@@ -153,8 +158,9 @@ Prerequisite is to have installed :ref:`Python, Setuptools and pywin32 dependenc
- `Manual <https://pyinstaller.readthedocs.io/en/stable/>`_ - `Manual <https://pyinstaller.readthedocs.io/en/stable/>`_
****
OS X OS X
---- ****
py2app py2app
@@ -208,8 +214,9 @@ This creates a :code:`script.app` in the :code:`dist` folder. Make sure to use G
There are several options in :code:`script.spec` related to Mac OS X app bundles `here <http://pythonhosted.org/PyInstaller/spec-files.html#spec-file-options-for-a-mac-os-x-bundle>`_. For example, to specify an icon for the app, use the :code:`icon=\path\to\icon.icns` option. There are several options in :code:`script.spec` related to Mac OS X app bundles `here <http://pythonhosted.org/PyInstaller/spec-files.html#spec-file-options-for-a-mac-os-x-bundle>`_. For example, to specify an icon for the app, use the :code:`icon=\path\to\icon.icns` option.
*****
Linux Linux
----- *****
bbFreeze bbFreeze
+9 -3
View File
@@ -31,8 +31,10 @@ makes this method unsuitable for distributing applications to end-users.
The `Python Packaging Guide <https://python-packaging-user-guide.readthedocs.io/>`_ The `Python Packaging Guide <https://python-packaging-user-guide.readthedocs.io/>`_
provides an extensive guide on creating and maintaining Python packages. provides an extensive guide on creating and maintaining Python packages.
*************************
Alternatives to Packaging Alternatives to Packaging
::::::::::::::::::::::::: *************************
To distribute applications to end-users, you should To distribute applications to end-users, you should
:ref:`freeze your application <freezing-your-code-ref>`. :ref:`freeze your application <freezing-your-code-ref>`.
@@ -41,8 +43,10 @@ On Linux, you may also want to consider
:ref:`creating a Linux distro package <packaging-for-linux-distributions-ref>` :ref:`creating a Linux distro package <packaging-for-linux-distributions-ref>`
(e.g. a .deb file for Debian or Ubuntu.) (e.g. a .deb file for Debian or Ubuntu.)
*********************
For Python Developers For Python Developers
::::::::::::::::::::: *********************
If you're writing an open source Python module, `PyPI <http://pypi.python.org>`_ If you're writing an open source Python module, `PyPI <http://pypi.python.org>`_
, more properly known as *The Cheeseshop*, is the place to host it. , more properly known as *The Cheeseshop*, is the place to host it.
@@ -141,8 +145,10 @@ prerequisite for this is that you have an Amazon AWS account with an S3 bucket.
.. _packaging-for-linux-distributions-ref: .. _packaging-for-linux-distributions-ref:
***********************
For Linux Distributions For Linux Distributions
:::::::::::::::::::::::: ***********************
Creating a Linux distro package is arguably the "right way" to distribute code Creating a Linux distro package is arguably the "right way" to distribute code
on Linux. on Linux.
+6 -2
View File
@@ -33,8 +33,10 @@ described in the next section before you start building Python applications
for real-world use. In particular, you should always install Setuptools and pip, as for real-world use. In particular, you should always install Setuptools and pip, as
it makes it much easier for you to use other third-party Python libraries. it makes it much easier for you to use other third-party Python libraries.
****************
Setuptools & Pip Setuptools & Pip
---------------- ****************
The two most crucial third-party Python packages are `setuptools <https://pypi.python.org/pypi/setuptools>`_ and `pip <https://pip.pypa.io/en/stable/>`_. The two most crucial third-party Python packages are `setuptools <https://pypi.python.org/pypi/setuptools>`_ and `pip <https://pip.pypa.io/en/stable/>`_.
@@ -53,8 +55,10 @@ To see if pip is installed, open a command prompt and run
To install pip, `follow the official pip installation guide <https://pip.pypa.io/en/latest/installing/>`_ - this will automatically install the latest version of setuptools. To install pip, `follow the official pip installation guide <https://pip.pypa.io/en/latest/installing/>`_ - this will automatically install the latest version of setuptools.
********************
Virtual Environments Virtual Environments
-------------------- ********************
A Virtual Environment is a tool to keep the dependencies required by different projects A Virtual Environment is a tool to keep the dependencies required by different projects
in separate places, by creating virtual Python environments for them. It solves the in separate places, by creating virtual Python environments for them. It solves the
+7 -4
View File
@@ -23,8 +23,10 @@ good for development. The version shipped with OS X may be out of date from the
`official current Python release <https://www.python.org/downloads/mac-osx/>`_, `official current Python release <https://www.python.org/downloads/mac-osx/>`_,
which is considered the stable production version. which is considered the stable production version.
**************
Doing it Right Doing it Right
-------------- **************
Let's install a real version of Python. Let's install a real version of Python.
@@ -89,8 +91,9 @@ Homebrew names the executable ``python2`` so that you can still run the system P
$ python3 -V # Homebrew installed Python 3 interpreter (if installed) $ python3 -V # Homebrew installed Python 3 interpreter (if installed)
****************
Setuptools & Pip Setuptools & Pip
---------------- ****************
Homebrew installs Setuptools and ``pip`` for you. Homebrew installs Setuptools and ``pip`` for you.
@@ -110,9 +113,9 @@ and is actively maintained.
$ pip -V # pip pointing to the Homebrew installed Python 3 interpreter (if installed) $ pip -V # pip pointing to the Homebrew installed Python 3 interpreter (if installed)
********************
Virtual Environments Virtual Environments
-------------------- ********************
A Virtual Environment (commonly referred to as a 'virtualenv') is a tool to keep the dependencies required by different projects A Virtual Environment (commonly referred to as a '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 in separate places, by creating virtual Python environments for them. It solves the
+5 -2
View File
@@ -52,8 +52,10 @@ described in the next section before you start building Python applications for
real-world use. In particular, you should always install Setuptools, as it real-world use. In particular, you should always install Setuptools, as it
makes it much easier for you to use other third-party Python libraries. makes it much easier for you to use other third-party Python libraries.
****************
Setuptools + Pip Setuptools + Pip
---------------- ****************
The two most crucial third-party Python packages are `setuptools <https://pypi.python.org/pypi/setuptools>`_ and `pip <https://pip.pypa.io/en/stable/>`_. The two most crucial third-party Python packages are `setuptools <https://pypi.python.org/pypi/setuptools>`_ and `pip <https://pip.pypa.io/en/stable/>`_.
@@ -73,8 +75,9 @@ To see if pip is installed, open a command prompt and run
To install pip, `follow the official pip installation guide <https://pip.pypa.io/en/latest/installing/>`_ - this will automatically install the latest version of setuptools. To install pip, `follow the official pip installation guide <https://pip.pypa.io/en/latest/installing/>`_ - this will automatically install the latest version of setuptools.
********************
Virtual Environments Virtual Environments
-------------------- ********************
A Virtual Environment is a tool to keep the dependencies required by different projects A Virtual Environment is a tool to keep the dependencies required by different projects
in separate places, by creating virtual Python environments for them. It solves the in separate places, by creating virtual Python environments for them. It solves the
+10 -4
View File
@@ -1,7 +1,9 @@
.. _install3-linux: .. _install3-linux:
############################
Installing Python 3 on Linux Installing Python 3 on Linux
============================ ############################
.. image:: /_static/photos/34435689480_2e6f358510_k_d.jpg .. image:: /_static/photos/34435689480_2e6f358510_k_d.jpg
@@ -42,8 +44,9 @@ to read about `multiple Python versions available in Fedora`_.
.. _multiple Python versions available in Fedora: https://developer.fedoraproject.org/tech/languages/python/multiple-pythons.html .. _multiple Python versions available in Fedora: https://developer.fedoraproject.org/tech/languages/python/multiple-pythons.html
*********************
Working with Python 3 Working with Python 3
--------------------- *********************
At this point, you may have system Python 2.7 available as well. At this point, you may have system Python 2.7 available as well.
@@ -59,8 +62,10 @@ This will launch the Python 2 interpreter.
This will launch the Python 3 interpreter. This will launch the Python 3 interpreter.
****************
Setuptools & Pip Setuptools & Pip
---------------- ****************
The two most crucial third-party Python packages are `setuptools <https://pypi.python.org/pypi/setuptools>`_ and `pip <https://pip.pypa.io/en/stable/>`_. The two most crucial third-party Python packages are `setuptools <https://pypi.python.org/pypi/setuptools>`_ and `pip <https://pip.pypa.io/en/stable/>`_.
@@ -90,8 +95,9 @@ However, when using virtual environments (described below), you don't need to
care about that. care about that.
*****************************
Pipenv & Virtual Environments Pipenv & Virtual Environments
----------------------------- *****************************
The next step is to install Pipenv, so you can install dependencies and manage virtual environments. The next step is to install Pipenv, so you can install dependencies and manage virtual environments.
+13 -6
View File
@@ -2,8 +2,10 @@
.. _install3-osx: .. _install3-osx:
###############################
Installing Python 3 on Mac OS X Installing Python 3 on Mac OS X
=============================== ###############################
.. image:: /_static/photos/34435689480_2e6f358510_k_d.jpg .. image:: /_static/photos/34435689480_2e6f358510_k_d.jpg
@@ -17,8 +19,10 @@ good for development. The version shipped with OS X may be out of date from the
`official current Python release <https://www.python.org/downloads/mac-osx/>`_, `official current Python release <https://www.python.org/downloads/mac-osx/>`_,
which is considered the stable production version. which is considered the stable production version.
**************
Doing it Right Doing it Right
-------------- **************
Let's install a real version of Python. Let's install a real version of Python.
@@ -72,14 +76,16 @@ Now, we can install Python 3:
This will take a minute or two. This will take a minute or two.
***
Pip Pip
--- ***
Homebrew installs ``pip`` pointing to the Homebrew'd Python 3 for you. Homebrew installs ``pip`` pointing to the Homebrew'd Python 3 for you.
*********************
Working with Python 3 Working with Python 3
--------------------- *********************
At this point, you have the system Python 2.7 available, potentially the At this point, you have the system Python 2.7 available, potentially the
:ref:`Homebrew version of Python 2 <install-osx>` installed, and the Homebrew :ref:`Homebrew version of Python 2 <install-osx>` installed, and the Homebrew
@@ -115,8 +121,9 @@ The rest of the guide will assume that ``python`` references Python 3.
Python 3.7.1 # Success! Python 3.7.1 # Success!
*****************************
Pipenv & Virtual Environments Pipenv & Virtual Environments
----------------------------- *****************************
The next step is to install Pipenv, so you can install dependencies and manage virtual environments. The next step is to install Pipenv, so you can install dependencies and manage virtual environments.
+8 -3
View File
@@ -1,7 +1,9 @@
.. _install3-windows: .. _install3-windows:
##############################
Installing Python 3 on Windows Installing Python 3 on Windows
============================== ##############################
.. image:: /_static/photos/34435689480_2e6f358510_k_d.jpg .. image:: /_static/photos/34435689480_2e6f358510_k_d.jpg
@@ -17,8 +19,10 @@ Once done, installing Python 3 is very simple, because Chocolatey pushes Python
Once you've run this command, you should be able to launch Python directly from to the console. Once you've run this command, you should be able to launch Python directly from to the console.
(Chocolatey is fantastic and automatically adds Python to your path.) (Chocolatey is fantastic and automatically adds Python to your path.)
****************
Setuptools + Pip Setuptools + Pip
---------------- ****************
The two most crucial third-party Python packages are `setuptools <https://pypi.python.org/pypi/setuptools>`_ and `pip <https://pip.pypa.io/en/stable/>`_, The two most crucial third-party Python packages are `setuptools <https://pypi.python.org/pypi/setuptools>`_ and `pip <https://pip.pypa.io/en/stable/>`_,
which let you download, install and uninstall any compliant Python software which let you download, install and uninstall any compliant Python software
@@ -30,8 +34,9 @@ All supported versions of Python 3 include pip, so just make sure it's up to dat
python -m pip install -U pip python -m pip install -U pip
*****************************
Pipenv & Virtual Environments Pipenv & Virtual Environments
----------------------------- *****************************
The next step is to install Pipenv, so you can install dependencies and manage virtual environments. The next step is to install Pipenv, so you can install dependencies and manage virtual environments.
+2 -2
View File
@@ -19,9 +19,9 @@ other third-party Python libraries.
.. note:: The use of **Python 3** is *highly* preferred over Python 2. Consider upgrading your applications and infrastructure if you find yourself *still* using Python 2 in production today. If you are using Python 3, congratulations — you are indeed a person of excellent taste. .. note:: The use of **Python 3** is *highly* preferred over Python 2. Consider upgrading your applications and infrastructure if you find yourself *still* using Python 2 in production today. If you are using Python 3, congratulations — you are indeed a person of excellent taste.
*Kenneth Reitz* *Kenneth Reitz*
*******************
Installation Guides Installation Guides
------------------- *******************
These guides go over the proper installation of :ref:`Python <which-python>` These guides go over the proper installation of :ref:`Python <which-python>`
for development purposes, as well as setuptools, pip and virtualenv. for development purposes, as well as setuptools, pip and virtualenv.
+12 -4
View File
@@ -8,8 +8,10 @@ Picking a Python Interpreter (3 vs 2)
.. _which-python: .. _which-python:
***************************
The State of Python (3 & 2) The State of Python (3 & 2)
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ***************************
When choosing a Python interpreter, one looming question is always present: When choosing a Python interpreter, one looming question is always present:
"Should I choose Python 2 or Python 3"? The answer is a bit more subtle than "Should I choose Python 2 or Python 3"? The answer is a bit more subtle than
@@ -23,8 +25,10 @@ The basic gist of the state of things is as follows:
3. Python 2.7 will only receive necessary security updates until 2020 [#pep373_eol]_. 3. Python 2.7 will only receive necessary security updates until 2020 [#pep373_eol]_.
4. The brand name "Python" encapsulates both Python 3 and Python 2. 4. The brand name "Python" encapsulates both Python 3 and Python 2.
***************
Recommendations Recommendations
~~~~~~~~~~~~~~~ ***************
.. note:: The use of **Python 3** is *highly* preferred over Python 2. Consider upgrading your applications and infrastructure if you find yourself *still* using Python 2 in production today. If you are using Python 3, congratulations — you are indeed a person of excellent taste. .. note:: The use of **Python 3** is *highly* preferred over Python 2. Consider upgrading your applications and infrastructure if you find yourself *still* using Python 2 in production today. If you are using Python 3, congratulations — you are indeed a person of excellent taste.
@@ -41,8 +45,10 @@ I'll be blunt:
simultaneously. Only supporting Python 3 for a new library you want to be widely adopted is a simultaneously. Only supporting Python 3 for a new library you want to be widely adopted is a
political statement and will alienate many of your users. This is not a problem — slowly, over the next three years, this will become less the case. political statement and will alienate many of your users. This is not a problem — slowly, over the next three years, this will become less the case.
*********
So.... 3? So.... 3?
~~~~~~~~~ *********
If you're choosing a Python interpreter to use, I If you're choosing a Python interpreter to use, I
recommend you use the newest Python 3.x, since every version brings new and recommend you use the newest Python 3.x, since every version brings new and
@@ -65,8 +71,10 @@ worry about. Note that Python 2.6 is end-of-life upstream, so you shouldn't
try to write 2.6-compatible code unless you're being paid specifically to try to write 2.6-compatible code unless you're being paid specifically to
do that. do that.
***************
Implementations Implementations
~~~~~~~~~~~~~~~ ***************
When people speak of *Python* they often mean not just the language but also When people speak of *Python* they often mean not just the language but also
the CPython implementation. *Python* is actually a specification for a language the CPython implementation. *Python* is actually a specification for a language
+15 -5
View File
@@ -1,5 +1,8 @@
#############
Documentation Documentation
============= #############
.. image:: /_static/photos/35620636012_f66aa88f93_k_d.jpg .. image:: /_static/photos/35620636012_f66aa88f93_k_d.jpg
@@ -7,8 +10,10 @@ Readability is a primary focus for Python developers, in both project
and code documentation. Following some simple best practices can save and code documentation. Following some simple best practices can save
both you and others a lot of time. both you and others a lot of time.
*********************
Project Documentation Project Documentation
--------------------- *********************
A :file:`README` file at the root directory should give general information A :file:`README` file at the root directory should give general information
to both users and maintainers of a project. It should be raw text or to both users and maintainers of a project. It should be raw text or
@@ -32,8 +37,10 @@ planned development for the code.
A :file:`CHANGELOG` file or section in :file:`README` should compile a short A :file:`CHANGELOG` file or section in :file:`README` should compile a short
overview of the changes in the code base for the latest versions. overview of the changes in the code base for the latest versions.
*******************
Project Publication Project Publication
------------------- *******************
Depending on the project, your documentation might include some or all Depending on the project, your documentation might include some or all
of the following components: of the following components:
@@ -97,8 +104,9 @@ Reference`_ should help you familiarize yourself with its syntax.
.. _reStructuredText Quick Reference: http://docutils.sourceforge.net/docs/user/rst/quickref.html .. _reStructuredText Quick Reference: http://docutils.sourceforge.net/docs/user/rst/quickref.html
*************************
Code Documentation Advice Code Documentation Advice
------------------------- *************************
Comments clarify the code and they are added with purpose of making the Comments clarify the code and they are added with purpose of making the
code easier to understand. In Python, comments begin with a hash code easier to understand. In Python, comments begin with a hash
@@ -249,8 +257,10 @@ For further reading on docstrings, feel free to consult :pep:`257`
.. _sphinx.ext.napoleon: https://sphinxcontrib-napoleon.readthedocs.io/ .. _sphinx.ext.napoleon: https://sphinxcontrib-napoleon.readthedocs.io/
.. _`NumPy style`: http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html .. _`NumPy style`: http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html
***********
Other Tools Other Tools
----------- ***********
You might see these in the wild. Use :ref:`sphinx-ref`. You might see these in the wild. Use :ref:`sphinx-ref`.
+11 -5
View File
@@ -1,5 +1,8 @@
##############
Common Gotchas Common Gotchas
============== ##############
.. image:: /_static/photos/34435688380_b5a740762b_k_d.jpg .. image:: /_static/photos/34435688380_b5a740762b_k_d.jpg
@@ -16,8 +19,10 @@ the surprise.
.. _default_args: .. _default_args:
*************************
Mutable Default Arguments Mutable Default Arguments
------------------------- *************************
Seemingly the *most* common surprise new Python programmers encounter is Seemingly the *most* common surprise new Python programmers encounter is
Python's treatment of mutable default arguments in function definitions. Python's treatment of mutable default arguments in function definitions.
@@ -88,8 +93,9 @@ to maintain state between calls of a function. This is often done when writing
a caching function. a caching function.
****************************
Late Binding Closures Late Binding Closures
--------------------- ****************************
Another common source of confusion is the way Python binds its variables in Another common source of confusion is the way Python binds its variables in
closures (or in the surrounding global scope). closures (or in the surrounding global scope).
@@ -189,9 +195,9 @@ lots of situations. Looping to create unique functions is unfortunately a case
where they can cause hiccups. where they can cause hiccups.
*********************************
Bytecode (.pyc) Files Everywhere! Bytecode (.pyc) Files Everywhere!
--------------------------------- *********************************
By default, when executing Python code from files, the Python interpreter By default, when executing Python code from files, the Python interpreter
will automatically write a bytecode version of that file to disk, e.g. will automatically write a bytecode version of that file to disk, e.g.
+4 -1
View File
@@ -1,5 +1,8 @@
##################
Choosing a License Choosing a License
================== ##################
.. image:: /_static/photos/33907149294_82d7535a6c_k_d.jpg .. image:: /_static/photos/33907149294_82d7535a6c_k_d.jpg
+10 -4
View File
@@ -1,5 +1,8 @@
#######
Logging Logging
======= #######
.. image:: /_static/photos/35254379756_c9fe23f843_k_d.jpg .. image:: /_static/photos/35254379756_c9fe23f843_k_d.jpg
@@ -17,8 +20,9 @@ Logging serves two purposes:
reports or to optimize a business goal. reports or to optimize a business goal.
*************
... or Print? ... or Print?
------------- *************
The only time that ``print`` is a better option than logging is when The only time that ``print`` is a better option than logging is when
the goal is to display a help statement for a command line application. the goal is to display a help statement for a command line application.
@@ -34,8 +38,9 @@ Other reasons why logging is better than ``print``:
:attr:`logging.Logger.disabled` to ``True``. :attr:`logging.Logger.disabled` to ``True``.
********************
Logging in a Library Logging in a Library
-------------------- ********************
Notes for `configuring logging for a library`_ are in the Notes for `configuring logging for a library`_ are in the
`logging tutorial`_. Because the *user*, not the library, should `logging tutorial`_. Because the *user*, not the library, should
@@ -61,8 +66,9 @@ this in your ``__init__.py``
logging.getLogger(__name__).addHandler(logging.NullHandler()) logging.getLogger(__name__).addHandler(logging.NullHandler())
*************************
Logging in an Application Logging in an Application
------------------------- *************************
The `twelve factor app <http://12factor.net>`_, an authoritative reference The `twelve factor app <http://12factor.net>`_, an authoritative reference
for good practice in application development, contains a section on for good practice in application development, contains a section on
+4 -1
View File
@@ -1,5 +1,8 @@
##################
Reading Great Code Reading Great Code
================== ##################
.. image:: /_static/photos/34689452831_93d7fd0571_k_d.jpg .. image:: /_static/photos/34689452831_93d7fd0571_k_d.jpg
+33 -15
View File
@@ -1,5 +1,8 @@
########################
Structuring Your Project Structuring Your Project
======================== ########################
.. image:: /_static/photos/33907151224_0574e7dfc2_k_d.jpg .. image:: /_static/photos/33907151224_0574e7dfc2_k_d.jpg
@@ -21,9 +24,9 @@ project. We then discuss various perspectives on how to build code which
can be extended and tested reliably. can be extended and tested reliably.
***************************
Structure of the Repository Structure of the Repository
--------------------------- ***************************
It's Important. It's Important.
::::::::::::::: :::::::::::::::
@@ -313,9 +316,9 @@ The resulting structure:
************************
Structure of Code is Key Structure of Code is Key
------------------------ ************************
Thanks to the way imports and modules are handled in Python, it is Thanks to the way imports and modules are handled in Python, it is
relatively easy to structure a Python project. Easy, here, means relatively easy to structure a Python project. Easy, here, means
@@ -366,8 +369,9 @@ include:
task at hand, you might be swimming in ravioli code. task at hand, you might be swimming in ravioli code.
*******
Modules Modules
------- *******
Python modules are one of the main abstraction layers available and probably the Python modules are one of the main abstraction layers available and probably the
most natural one. Abstraction layers allow separating code into parts holding most natural one. Abstraction layers allow separating code into parts holding
@@ -476,8 +480,9 @@ Being able to tell immediately where a class or function comes from, as in the
all but the simplest single file projects. all but the simplest single file projects.
********
Packages Packages
-------- ********
Python provides a very straightforward packaging system, which is simply an Python provides a very straightforward packaging system, which is simply an
extension of the module mechanism to a directory. extension of the module mechanism to a directory.
@@ -509,8 +514,10 @@ Lastly, a convenient syntax is available for importing deeply nested packages:
``import very.deep.module as mod``. This allows you to use `mod` in place of the ``import very.deep.module as mod``. This allows you to use `mod` in place of the
verbose repetition of ``very.deep.module``. verbose repetition of ``very.deep.module``.
***************************
Object-oriented programming Object-oriented programming
--------------------------- ***************************
Python is sometimes described as an object-oriented programming language. This Python is sometimes described as an object-oriented programming language. This
can be somewhat misleading and needs to be clarified. can be somewhat misleading and needs to be clarified.
@@ -587,8 +594,9 @@ things that are manipulated (windows, buttons, avatars, vehicles) have a
relatively long life of their own in the computer's memory. relatively long life of their own in the computer's memory.
**********
Decorators Decorators
---------- **********
The Python language provides a simple yet powerful syntax called 'decorators'. The Python language provides a simple yet powerful syntax called 'decorators'.
A decorator is a function or a class that wraps (or decorates) a function A decorator is a function or a class that wraps (or decorates) a function
@@ -621,8 +629,10 @@ expensive function in a table and use them directly instead of recomputing
them when they have already been computed. This is clearly not part them when they have already been computed. This is clearly not part
of the function logic. of the function logic.
****************
Context Managers Context Managers
---------------- ****************
A context manager is a Python object that provides extra contextual information A context manager is a Python object that provides extra contextual information
to an action. This extra information takes the form of running a callable upon to an action. This extra information takes the form of running a callable upon
@@ -694,8 +704,10 @@ to decide when to use which. The class approach might be better if there's
a considerable amount of logic to encapsulate. The function approach a considerable amount of logic to encapsulate. The function approach
might be better for situations where we're dealing with a simple action. might be better for situations where we're dealing with a simple action.
**************
Dynamic typing Dynamic typing
-------------- **************
Python is dynamically typed, which means that variables do not have a fixed Python is dynamically typed, which means that variables do not have a fixed
type. In fact, in Python, variables are very different from what they are in type. In fact, in Python, variables are very different from what they are in
@@ -758,8 +770,10 @@ a `final` keyword and it would be against its philosophy anyway. However, it may
be a good discipline to avoid assigning to a variable more than once, and it be a good discipline to avoid assigning to a variable more than once, and it
helps in grasping the concept of mutable and immutable types. helps in grasping the concept of mutable and immutable types.
***************************
Mutable and immutable types Mutable and immutable types
--------------------------- ***************************
Python has two kinds of built-in or user-defined types. Python has two kinds of built-in or user-defined types.
@@ -873,16 +887,20 @@ like above or in cases where you are adding to an existing string, using
foobar = '{foo}{bar}'.format(foo=foo, bar=bar) # It is best foobar = '{foo}{bar}'.format(foo=foo, bar=bar) # It is best
************************
Vendorizing Dependencies Vendorizing Dependencies
------------------------ ************************
*******
Runners Runners
------- *******
***************
Further Reading Further Reading
--------------- ***************
- http://docs.python.org/2/library/ - http://docs.python.org/2/library/
- http://www.diveintopython.net/toc/index.html - http://www.diveintopython.net/toc/index.html
+17 -6
View File
@@ -1,7 +1,9 @@
.. _code_style: .. _code_style:
##########
Code Style Code Style
========== ##########
.. image:: /_static/photos/33907150054_5ee79e8940_k_d.jpg .. image:: /_static/photos/33907150054_5ee79e8940_k_d.jpg
@@ -21,8 +23,10 @@ what is considered the best (hear: most readable) way.
On some border cases, no best way has been agreed upon on how to express On some border cases, no best way has been agreed upon on how to express
an intent in Python code, but these cases are rare. an intent in Python code, but these cases are rare.
****************
General concepts General concepts
---------------- ****************
Explicit code Explicit code
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
@@ -260,8 +264,10 @@ is needed.
return x # One single exit point for the returned value x will help return x # One single exit point for the returned value x will help
# when maintaining the code. # when maintaining the code.
******
Idioms Idioms
------ ******
A programming idiom, put simply, is a *way* to write code. The notion of A programming idiom, put simply, is a *way* to write code. The notion of
programming idioms is discussed amply at `c2 <http://c2.com/cgi/wiki?ProgrammingIdiom>`_ programming idioms is discussed amply at `c2 <http://c2.com/cgi/wiki?ProgrammingIdiom>`_
@@ -417,8 +423,9 @@ hashtable will often be greater than the time saved by the improved search
speed. speed.
*************
Zen of Python Zen of Python
------------- *************
Also known as :pep:`20`, the guiding principles for Python's design. Also known as :pep:`20`, the guiding principles for Python's design.
@@ -450,8 +457,10 @@ Also known as :pep:`20`, the guiding principles for Python's design.
For some examples of good Python style, see `these slides from a Python user For some examples of good Python style, see `these slides from a Python user
group <http://artifex.org/~hblanks/talks/2011/pep20_by_example.pdf>`_. group <http://artifex.org/~hblanks/talks/2011/pep20_by_example.pdf>`_.
*****
PEP 8 PEP 8
----- *****
:pep:`8` is the de-facto code style guide for Python. A high quality, :pep:`8` is the de-facto code style guide for Python. A high quality,
easy-to-read version of PEP 8 is also available at `pep8.org <http://pep8.org/>`_. easy-to-read version of PEP 8 is also available at `pep8.org <http://pep8.org/>`_.
@@ -504,8 +513,10 @@ 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 code directly to the console for review. The ``--aggressive`` flag will perform
more substantial changes and can be applied multiple times for greater effect. more substantial changes and can be applied multiple times for greater effect.
***********
Conventions Conventions
---------------- ***********
Here are some conventions you should follow to make your code easier to read. Here are some conventions you should follow to make your code easier to read.
+11 -3
View File
@@ -1,5 +1,8 @@
#################
Testing Your Code Testing Your Code
================= #################
.. image:: /_static/photos/34435687940_8f73fc1fa6_k_d.jpg .. image:: /_static/photos/34435687940_8f73fc1fa6_k_d.jpg
@@ -71,8 +74,11 @@ Some general rules of testing:
be to add a test to ensure that the new functionality is not already a be to add a test to ensure that the new functionality is not already a
working path that has not been plugged into the interface. working path that has not been plugged into the interface.
**********
The Basics The Basics
:::::::::: **********
Unittest Unittest
@@ -136,8 +142,10 @@ When running this module from the command line as in ``python module.py``, the
doctests will run and complain if anything is not behaving as described in the doctests will run and complain if anything is not behaving as described in the
docstrings. docstrings.
*****
Tools Tools
::::: *****
py.test py.test