diff --git a/docs/_build/doctrees/_themes/README.doctree b/docs/_build/doctrees/_themes/README.doctree index f06766e..2483c37 100644 Binary files a/docs/_build/doctrees/_themes/README.doctree and b/docs/_build/doctrees/_themes/README.doctree differ diff --git a/docs/_build/doctrees/dev/env.doctree b/docs/_build/doctrees/dev/env.doctree deleted file mode 100644 index c94beaf..0000000 Binary files a/docs/_build/doctrees/dev/env.doctree and /dev/null differ diff --git a/docs/_build/doctrees/dev/virtualenvs.doctree b/docs/_build/doctrees/dev/virtualenvs.doctree deleted file mode 100644 index 6940a64..0000000 Binary files a/docs/_build/doctrees/dev/virtualenvs.doctree and /dev/null differ diff --git a/docs/_build/doctrees/environment.pickle b/docs/_build/doctrees/environment.pickle index 3eba1f2..5642941 100644 Binary files a/docs/_build/doctrees/environment.pickle and b/docs/_build/doctrees/environment.pickle differ diff --git a/docs/_build/doctrees/index.doctree b/docs/_build/doctrees/index.doctree index dfca411..dee6a26 100644 Binary files a/docs/_build/doctrees/index.doctree and b/docs/_build/doctrees/index.doctree differ diff --git a/docs/_build/doctrees/intro/community.doctree b/docs/_build/doctrees/intro/community.doctree deleted file mode 100644 index e1c8ca9..0000000 Binary files a/docs/_build/doctrees/intro/community.doctree and /dev/null differ diff --git a/docs/_build/doctrees/intro/documentation.doctree b/docs/_build/doctrees/intro/documentation.doctree deleted file mode 100644 index f01fa0d..0000000 Binary files a/docs/_build/doctrees/intro/documentation.doctree and /dev/null differ diff --git a/docs/_build/doctrees/intro/duction.doctree b/docs/_build/doctrees/intro/duction.doctree deleted file mode 100644 index bdfbaa3..0000000 Binary files a/docs/_build/doctrees/intro/duction.doctree and /dev/null differ diff --git a/docs/_build/doctrees/intro/learning.doctree b/docs/_build/doctrees/intro/learning.doctree deleted file mode 100644 index 37c8002..0000000 Binary files a/docs/_build/doctrees/intro/learning.doctree and /dev/null differ diff --git a/docs/_build/doctrees/intro/news.doctree b/docs/_build/doctrees/intro/news.doctree deleted file mode 100644 index 360fdd9..0000000 Binary files a/docs/_build/doctrees/intro/news.doctree and /dev/null differ diff --git a/docs/_build/doctrees/notes/contribute.doctree b/docs/_build/doctrees/notes/contribute.doctree deleted file mode 100644 index 7b8e93f..0000000 Binary files a/docs/_build/doctrees/notes/contribute.doctree and /dev/null differ diff --git a/docs/_build/doctrees/notes/license.doctree b/docs/_build/doctrees/notes/license.doctree deleted file mode 100644 index b31acbe..0000000 Binary files a/docs/_build/doctrees/notes/license.doctree and /dev/null differ diff --git a/docs/_build/doctrees/notes/styleguide.doctree b/docs/_build/doctrees/notes/styleguide.doctree deleted file mode 100644 index 19432a0..0000000 Binary files a/docs/_build/doctrees/notes/styleguide.doctree and /dev/null differ diff --git a/docs/_build/doctrees/scenarios/admin.doctree b/docs/_build/doctrees/scenarios/admin.doctree deleted file mode 100644 index bd734c1..0000000 Binary files a/docs/_build/doctrees/scenarios/admin.doctree and /dev/null differ diff --git a/docs/_build/doctrees/scenarios/ci.doctree b/docs/_build/doctrees/scenarios/ci.doctree deleted file mode 100644 index 38696a8..0000000 Binary files a/docs/_build/doctrees/scenarios/ci.doctree and /dev/null differ diff --git a/docs/_build/doctrees/scenarios/cli.doctree b/docs/_build/doctrees/scenarios/cli.doctree deleted file mode 100644 index b23557a..0000000 Binary files a/docs/_build/doctrees/scenarios/cli.doctree and /dev/null differ diff --git a/docs/_build/doctrees/scenarios/db.doctree b/docs/_build/doctrees/scenarios/db.doctree deleted file mode 100644 index dbe0a30..0000000 Binary files a/docs/_build/doctrees/scenarios/db.doctree and /dev/null differ diff --git a/docs/_build/doctrees/scenarios/gui.doctree b/docs/_build/doctrees/scenarios/gui.doctree deleted file mode 100644 index 047e3d8..0000000 Binary files a/docs/_build/doctrees/scenarios/gui.doctree and /dev/null differ diff --git a/docs/_build/doctrees/scenarios/scientific.doctree b/docs/_build/doctrees/scenarios/scientific.doctree deleted file mode 100644 index 518a0a8..0000000 Binary files a/docs/_build/doctrees/scenarios/scientific.doctree and /dev/null differ diff --git a/docs/_build/doctrees/scenarios/speed.doctree b/docs/_build/doctrees/scenarios/speed.doctree deleted file mode 100644 index f8f0121..0000000 Binary files a/docs/_build/doctrees/scenarios/speed.doctree and /dev/null differ diff --git a/docs/_build/doctrees/scenarios/web.doctree b/docs/_build/doctrees/scenarios/web.doctree deleted file mode 100644 index fbf095e..0000000 Binary files a/docs/_build/doctrees/scenarios/web.doctree and /dev/null differ diff --git a/docs/_build/doctrees/shipping/freezing.doctree b/docs/_build/doctrees/shipping/freezing.doctree deleted file mode 100644 index 09371d5..0000000 Binary files a/docs/_build/doctrees/shipping/freezing.doctree and /dev/null differ diff --git a/docs/_build/doctrees/shipping/packaging.doctree b/docs/_build/doctrees/shipping/packaging.doctree deleted file mode 100644 index dfa8106..0000000 Binary files a/docs/_build/doctrees/shipping/packaging.doctree and /dev/null differ diff --git a/docs/_build/doctrees/starting/dev-env.doctree b/docs/_build/doctrees/starting/dev-env.doctree deleted file mode 100644 index a8166b7..0000000 Binary files a/docs/_build/doctrees/starting/dev-env.doctree and /dev/null differ diff --git a/docs/_build/doctrees/starting/install/linux.doctree b/docs/_build/doctrees/starting/install/linux.doctree deleted file mode 100644 index 2b9c476..0000000 Binary files a/docs/_build/doctrees/starting/install/linux.doctree and /dev/null differ diff --git a/docs/_build/doctrees/starting/install/osx.doctree b/docs/_build/doctrees/starting/install/osx.doctree deleted file mode 100644 index b56e53c..0000000 Binary files a/docs/_build/doctrees/starting/install/osx.doctree and /dev/null differ diff --git a/docs/_build/doctrees/starting/install/win.doctree b/docs/_build/doctrees/starting/install/win.doctree deleted file mode 100644 index 14b0e0a..0000000 Binary files a/docs/_build/doctrees/starting/install/win.doctree and /dev/null differ diff --git a/docs/_build/doctrees/starting/installation.doctree b/docs/_build/doctrees/starting/installation.doctree deleted file mode 100644 index 447ec90..0000000 Binary files a/docs/_build/doctrees/starting/installation.doctree and /dev/null differ diff --git a/docs/_build/doctrees/starting/next.doctree b/docs/_build/doctrees/starting/next.doctree deleted file mode 100644 index f960243..0000000 Binary files a/docs/_build/doctrees/starting/next.doctree and /dev/null differ diff --git a/docs/_build/doctrees/starting/which-python.doctree b/docs/_build/doctrees/starting/which-python.doctree deleted file mode 100644 index a745ba9..0000000 Binary files a/docs/_build/doctrees/starting/which-python.doctree and /dev/null differ diff --git a/docs/_build/doctrees/writing/documentation.doctree b/docs/_build/doctrees/writing/documentation.doctree deleted file mode 100644 index c58225a..0000000 Binary files a/docs/_build/doctrees/writing/documentation.doctree and /dev/null differ diff --git a/docs/_build/doctrees/writing/license.doctree b/docs/_build/doctrees/writing/license.doctree deleted file mode 100644 index eb70bfe..0000000 Binary files a/docs/_build/doctrees/writing/license.doctree and /dev/null differ diff --git a/docs/_build/doctrees/writing/structure.doctree b/docs/_build/doctrees/writing/structure.doctree deleted file mode 100644 index cc779ad..0000000 Binary files a/docs/_build/doctrees/writing/structure.doctree and /dev/null differ diff --git a/docs/_build/doctrees/writing/style.doctree b/docs/_build/doctrees/writing/style.doctree deleted file mode 100644 index 4fe5938..0000000 Binary files a/docs/_build/doctrees/writing/style.doctree and /dev/null differ diff --git a/docs/_build/doctrees/writing/tests.doctree b/docs/_build/doctrees/writing/tests.doctree deleted file mode 100644 index e3b76cb..0000000 Binary files a/docs/_build/doctrees/writing/tests.doctree and /dev/null differ diff --git a/docs/_build/html/.buildinfo b/docs/_build/html/.buildinfo index bda7d10..617f760 100644 --- a/docs/_build/html/.buildinfo +++ b/docs/_build/html/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: f9ca5d98ba72140a2e4abd39df74c871 +config: 482b79009dc7bb9dba1ccab6f9c586c2 tags: fbb0d17656682115ca4d033fb2f83ba1 diff --git a/docs/_build/html/_sources/dev/env.txt b/docs/_build/html/_sources/dev/env.txt deleted file mode 100644 index 99ccf7b..0000000 --- a/docs/_build/html/_sources/dev/env.txt +++ /dev/null @@ -1,241 +0,0 @@ -Your Development Environment -============================ - - -Text Editors -:::::::::::: - -Just about anything which can edit plain text will work for writing Python code, -however, using a more powerful editor may make your life a bit easier. - - -VIM ---- - - -There exist a couple of plugins and settings for the VIM editor to aid python -development. If you only develop in Python, a good start is to set the default -settings for indentation and linewrapping to values compliant with PEP8:: - - set textwidth=79 - set shiftwidth=4 - set tabstop=4 - set expandtab - set softtabstop=4 - set shiftround - -With these settings newlines are inserted after 79 characters and indentation -is set to 4 spaces per tab. If you also use VIM for other languages, there is a -handy plugin at indent_, which handles indentation settings for python source -files. -Additionally there is also a handy syntax plugin at syntax_ featuring some -improvements over the syntax file included in VIM 6.1. - -These plugins supply you with a basic environment for developing in Python. -However in order to improve the programming flow we also want to continually -check for PEP8 compliance and check syntax. Luckily there exist PEP8_ and -Pyflakes_ to do this for you. If your VIM is compiled with `+python` you can -also utilize some very handy plugins to do these checks from within the editor. -For PEP8 checking install vim-pep8_. Now you can map the vim function -`Pep8()` to any hotkey or action you want. Similarly for pyflakes you can -install vim-pyflakes_. Now you can map `Pyflakes()` like the PEP8 function and -have it called quickly. Both plugins will display errors in a quickfix list and -provide an easy way to jump to the corresponding line. A very handy setting is -calling these functions whenever a buffer is saved. In order to do this, enter -the following lines into your vimrc:: - - autocmd BufWritePost *.py call Pyflakes() - autocmd BufWritePost *.py call Pep8() - - -.. _indent: http://www.vim.org/scripts/script.php?script_id=974 -.. _syntax: http://www.vim.org/scripts/script.php?script_id=790 -.. _Pyflakes: http://pypi.python.org/pypi/pyflakes/ -.. _vim-pyflakes: https://github.com/nvie/vim-pyflakes -.. _PEP8: http://pypi.python.org/pypi/pep8/ -.. _vim-pep8: https://github.com/nvie/vim-pep8 - -.. todo:: add supertab notes - -TextMate --------- - -"`TextMate `_ brings Apple's approach to operating systems into the world of text editors. By bridging UNIX underpinnings and GUI, TextMate cherry-picks the best of both worlds to the benefit of expert scripters and novice users alike." - -Sublime Text ------------- - -"`Sublime Text `_ is a sophisticated text editor -for code, html and prose. You'll love the slick user interface and -extraordinary features." - -Sublime Text has excellent support for editing Python code and uses Python for -its plugin API. - -`Sublime Text 2 `_ is currently in beta. - -IDEs -:::: - -PyCharm / IntelliJ IDEA ------------------------ - -`PyCharm `_ is developed by JetBrains, also known for IntelliJ IDEA. Both share the same code base and most of PyCharm's features can be brought to IntelliJ with the free `Python Plug-In `_. - -Eclipse -------- - -The most popular Eclipse plugin for Python development is Aptana's -`PyDev `_. - - -Komodo IDE ------------ -`Komodo IDE `_ is developed by ActiveState and is a commerical IDE for Windows, Mac -and Linux. - -Spyder ------- - -`Spyder `_ an IDE specifically geared toward working with scientific python libraries (namely `Scipy `_). -Includes integration with pyflakes_, `pylint `_, -and `rope `_. - -Spyder is open-source (free), offers code completion, syntax highlighting, class and function browser, and object inspection. - - - -Interpreter Tools -::::::::::::::::: - - -virtualenv ----------- - -Virtualenv is a tool to keep the dependencies required by different projects in separate places, by creating virtual Python environments for them. -It solves the "Project X depends on version 1.x but, Project Y needs 4.x" dilemma and keeps your global site-packages directory clean and manageable. - -`virtualenv `_ creates -a folder which contains all the necessary executables to contain the -packages that a Python project would need. An example workflow is given. - -Install virtualenv:: - - $ pip install virtualenv - - -Create a virtual environment for a project:: - - $ cd my_project - $ virtualenv venv - -``virtualenv venv`` will create a folder in the currect directory -which will contain the Python executable files, and a copy of the ``pip`` -library which you can use to install other packages. The name of the -virtual environment (in this case, it was ``venv``) can be anything; -omitting the name will place the files in the current directory instead. - -In order the start using the virtual environment, run:: - - $ source venv/bin/activate - - -The name of the current virtual environment will now appear on the left -of the prompt (e.g. ``(venv)Your-Computer:your_project UserName$``) to -let you know that it's active. From now on, any package that you install -using ``pip`` will be placed in the venv folder, isolated from the global -Python installation. Install packages as usual:: - - $ pip install requests - -To stop using an environment simply type ``deactivate``. To remove the -environment, just remove the directory it was installed into. (In this -case, it would be ``rm -rf venv``). - -Other Notes -~~~~~~~~~~~ - -Running ``virtualenv`` with the option ``--no-site-packages`` will not -include the packages that are installed globally. This can be useful -for keeping the package list clean in case it needs to be accessed later. - -In order to keep your environment consistent, it's a good idea to "freeze" -the current state of the environment packages. To do this, run - -:: - - $ pip freeze > requirements.txt - -This will create a ``requirements.txt`` file, which contains a simple -list of all the packages in the current environment, and their respective -versions. Later, when a different developer (or you, if you need to re- -create the environment) can install the same packages, with the same -versions by running - -:: - - $ pip install -r requirements.txt - -This can help ensure consistency across installations, across deployments, -and across developers. - -Lastly, remember to exclude the virtual environment folder from source -control by adding it to the ignore list. - -virtualenvwrapper ------------------ - -`Virtualenvwrapper `_ makes virtualenv a pleasure to use by wrapping the command line API with a nicer CLI. - -:: - - $ pip install virtualenvwrapper - - -Put this into your `~/.bash_profile` (Linux/Mac) file: - -:: - - $ export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages' - -This will prevent your virtualenvs from relying on your (global) site packages directory, so that they are completely separate.. - -Other Tools -::::::::::: - -IPython -------- - -`IPython `_ provides a rich toolkit to help you make the most out of using Python interactively. Its main components are: - -* Powerful Python shells (terminal- and Qt-based). -* A web-based notebook with the same core features but support for rich media, text, code, mathematical expressions and inline plots. -* Support for interactive data visualization and use of GUI toolkits. -* Flexible, embeddable interpreters to load into your own projects. -* Tools for high level and interactive parallel computing. - -:: - - $ pip install ipython - - - -BPython -------- - -`bpython `_ is an alternative interface to the Python interpreter for Unix-like operating systems. It has the following features: - -* In-line syntax highlighting. -* Readline-like autocomplete with suggestions displayed as you type. -* Expected parameter list for any Python function. -* "Rewind" function to pop the last line of code from memory and re-evaluate. -* Send entered code off to a pastebin. -* Save entered code to a file. -* Auto-indentation. -* Python 3 support. - -:: - - $ pip install bpython - - diff --git a/docs/_build/html/_sources/dev/virtualenvs.txt b/docs/_build/html/_sources/dev/virtualenvs.txt deleted file mode 100644 index 9def09b..0000000 --- a/docs/_build/html/_sources/dev/virtualenvs.txt +++ /dev/null @@ -1,128 +0,0 @@ -Virtual Environments -==================== - -A Virtual Environment, put simply, is an isolated working copy of Python which -allows you to work on a specific project without worry of affecting other -projects. - -For example, you can work on a project which requires Django 1.3 while also -maintaining a project which requires Django 1.0. - -virtualenv ----------- - -`virtualenv `_ is a tool to create -isolated Python environments. - -Install it via pip: - -.. code-block:: console - - $ pip install virtualenv - -Basic Usage -~~~~~~~~~~~ - -1. Create a virtual environment: - -.. code-block:: console - - $ virtualenv venv - -This creates a copy of Python in whichever directory you ran the command in, -placing it in a folder named ``venv``. - -2. To begin using the virtual environment, it needs to be activated: - -.. code-block:: console - - $ source venv/bin/activate - -You can then begin installing any new modules without affecting the system -default Python or other virtual environments. - -3. If you are done working in the virtual environment for the moment, you can - deactivate it: - -.. code-block:: console - - $ deactivate - -This puts you back to the system's default Python interpreter with all its -installed libraries. - -To delete a virtual environment, just delete its folder. - -After a while, though, you might end up with a lot of virtual environments -littered across your system, and its possible you'll forget their names or -where they were placed. - -virtualenvwrapper ------------------ - -`virtualenvwrapper `_ -provides a set of commands which makes working with virtual environments much -more pleasant. It also places all your virtual environments in one place. - -To install (make sure **virtualenv** is already installed): - -.. code-block:: console - - $ pip install virtualenvwrapper - $ export WORKON_HOME=~/Envs - $ source /usr/local/bin/virtualenvwrapper.sh - -(`Full virtualenvwrapper install instructions `_.) - -Basic Usage -~~~~~~~~~~~ - -1. Create a virtual environment: - -.. code-block:: console - - $ mkvirtualenv venv - -This creates the ``venv`` folder inside ``~/Envs``. - -2. Work on a virtual environment: - -.. code-block:: console - - $ workon venv - -**virtualenvwrapper** provides tab-completion on environment names. It really -helps when you have a lot of environments and have trouble remembering their -names. -``workon`` also deactivates whatever environment you are currently in, so you -can quickly switch between environments. - -3. Deactivating is still the same: - -.. code-block:: console - - $ deactivate - -4. To delete: - -.. code-block:: console - - $ rmvirtualenv venv - -Other useful commands -~~~~~~~~~~~~~~~~~~~~~ - -``lsvirtualenv`` - List all of the environments. - -``cdvirtualenv`` - Navigate into the directory of the currently activated virtual environment, - so you can browse its ``site-packages``, for example. - -``cdsitepackages`` - Like the above, but directly into ``site-packages`` directory. - -``lssitepackages`` - Shows contents of ``site-packages`` directory. - -`Full list of virtualenvwrapper commands `_. diff --git a/docs/_build/html/_sources/index.txt b/docs/_build/html/_sources/index.txt index a1b1d4d..3b32cbd 100644 --- a/docs/_build/html/_sources/index.txt +++ b/docs/_build/html/_sources/index.txt @@ -1,15 +1,13 @@ -.. osxpython documentation master file, created by - sphinx-quickstart on Wed Aug 4 22:51:11 2010. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. +The Conduct of Code +=================== -The Hitchhiker's Guide to Python! -================================= +Welcome to The Hitchhiker's Guide to Python. `DON'T PANIC! `_ -Welcome to The Hitchhiker's Guide to Python. **DON'T PANIC!** +**This guide is currently under heavy development, and is mostly a skeleton at +the moment.** If you'd like to help, `fork us on GitHub `_! -**This guide is currently under heavy development, and is mostly a skeleton at the moment.** If you'd like to help, `fork us on GitHub `_! - -This *opinionated* guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. +This *opinionated* guide exists to provide both novice and expert Python +developers a best-practice handbook to the installation, configuration, and +usage of Python on a daily basis. .. include:: contents.rst.inc \ No newline at end of file diff --git a/docs/_build/html/_sources/intro/community.txt b/docs/_build/html/_sources/intro/community.txt deleted file mode 100644 index be1176e..0000000 --- a/docs/_build/html/_sources/intro/community.txt +++ /dev/null @@ -1,73 +0,0 @@ -The Community -============= - -BDFL ----- - -Guido van Rossum, the creator of Python, is often referred to as the BDFL — the Benevolent Dictator For Life. - - - -Python Software Foundation --------------------------- - -The mission of the Python Software Foundation is to promote, protect, and advance the Python programming language, and to support and facilitate the growth of a diverse and international community of Python programmers. - -`Learn More about the PSF `_. - - -PEPs ----- - -PEPs are *Python Enhancement Proposals*. They describe changes to Python itself, or the standards around it. - -There are three different types of PEPs (as defined by `PEP1 `_): - - **Standards** - Describes a new feature or implementation. - - **Informational** - Describes a design issue, general guidelines, or information to the community. - - **Process** - Describes a process related to Python. - - -Notable PEPs -~~~~~~~~~~~~ - -There are a few PEPs that could be considered required reading: - -- `PEP8 `_: The Python Style Guide. - Read this. All of it. Follow it. - -- `PEP20 `_: The Zen of Python. - A list of 19 statements that briefly explain the philosophy behind Python. - -- `PEP257 `_: Docstring Conventions. - Gives guidelines for semantics and conventions associated with Python docstrings. - -You can read more at `The PEP Index `_. - -Submitting a PEP -~~~~~~~~~~~~~~~~ - - PEPs are peer-reviewed and accepted/rejected after much discussion. Anyone can write and submit a PEP for review. - - Here's an overview of the PEP acceptance workflow: - - .. image:: http://www.python.org/dev/peps/pep-0001/pep-0001-1.png - - -Python Conferences --------------------------- - -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 sibling, EuroPython. - -A comprehensive list of conferences is maintained `at pycon.org `_. - - -Python User Groups --------------------------- - -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 the `Python Software Foundation Wiki `_. diff --git a/docs/_build/html/_sources/intro/documentation.txt b/docs/_build/html/_sources/intro/documentation.txt deleted file mode 100644 index 3359f37..0000000 --- a/docs/_build/html/_sources/intro/documentation.txt +++ /dev/null @@ -1,20 +0,0 @@ -Documentation -============= - -Official Documentation ----------------------- - -The official Python Language and Library documentation can be found here: - - - `Python 2.x `_ - - `Python 3.x `_ - - -Read the Docs -------------- - -Read the Docs is a popular community project, providing a single location for all documentation of popular and even more exotic Python modules. - - `Read the Docs `_ - - diff --git a/docs/_build/html/_sources/intro/duction.txt b/docs/_build/html/_sources/intro/duction.txt deleted file mode 100644 index 0bd99e7..0000000 --- a/docs/_build/html/_sources/intro/duction.txt +++ /dev/null @@ -1,39 +0,0 @@ -Introduction -============ - -.. todo:: write a general blurb introducing the Python language - -.. _about-ref: - -About This Guide ----------------- - -Purpose -~~~~~~~ - -The Hitchhiker's Guide to Python exists to provide both novice and expert -Python developers a best-practice handbook to the installation, configuration, -and usage of Python on a daily basis. - - -By the Community -~~~~~~~~~~~~~~~~ - -This guide is architected and maintained by `Kenneth Reitz -`_ in an open fashion. This is a -community-driven effort that serves one purpose: to serve the community. - -For the Community -~~~~~~~~~~~~~~~~~ - -All contributions to the Guide are welcome, from Pythonistas of all levels. -If you think there's a gap in what the Guide covers, fork the Guide on -GitHub and submit a pull request. Contributions are welcome from everyone, -whether they're an old hand or a first-time Pythonista, and the authors to -the Guide will gladly help if you have any questions about the -appropriateness, completeness, or accuracy of a contribution. - -To get started working on The Hitchhiker's Guide, see -the :doc:`/notes/contribute` page. - - diff --git a/docs/_build/html/_sources/intro/learning.txt b/docs/_build/html/_sources/intro/learning.txt deleted file mode 100644 index ecf3829..0000000 --- a/docs/_build/html/_sources/intro/learning.txt +++ /dev/null @@ -1,67 +0,0 @@ -Learning Python -=============== - -Beginner --------- - -Learn Python Interactive Tutorial -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Learnpython.org is an easy non-intimidating way to get introduced to python. The website takes the same approach used on the popular `Try Ruby `_ website, it has an interactive python interpreter built into the site that allows you to go through the lessons without having to install Python locally. - - `Learn Python `_ - -Learn Python the Hard Way -~~~~~~~~~~~~~~~~~~~~~~~~~ - -This is an excellent beginner programmer's guide to Python. It covers "hello world" from the console to the web. - - `Learn Python the Hard Way `_ - - -Crash into Python -~~~~~~~~~~~~~~~~~ - -Also known as *Python for Programmers with 3 Hours*, this guide gives experienced developers from other languages a crash course on Python. - - `Crash into Python `_ - - -Dive Into Python 3 -~~~~~~~~~~~~~~~~~~ - -Dive Into Python 3 is a good book for those ready to jump in to Python 3. It's a -good read if you are moving from Python 2 to 3 or if you already have some -experience programming in another language. - - `Dive Into Python 3 `_ - -Think Python: How to Think Like a Computer Scientist -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Think Python attempts to give an introduction to basic concepts in computer science through the -use of the python language. The focus was to create a book with plenty of exercises, minimal jargon and -a section in each chapter devoted to the subject of debugging. - -While exploring the various features available in the python language the author weaves in various design -patterns and best practices. - -The book also includes several case studies which have the reader explore the topics discussed in the book -in greater detail by applying those topics to real-world examples. Case studies include assignments in GUI -and Markov Analysis. - - `Think Python `_ - - -Advanced --------- - -Pro Python -~~~~~~~~~~ - -.. todo:: Write about `Pro Python `_ - -Expert Python Programming -~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. todo:: Write about `Expert Python Programming `_ diff --git a/docs/_build/html/_sources/intro/news.txt b/docs/_build/html/_sources/intro/news.txt deleted file mode 100644 index b24fa93..0000000 --- a/docs/_build/html/_sources/intro/news.txt +++ /dev/null @@ -1,25 +0,0 @@ -News -==== - -Planet Python -~~~~~~~~~~~~~ - -This is an aggregate of Python news from a growing number of developers. - - `Planet Python `_ - -/r/python -~~~~~~~~~ - -/r/python is the Reddit Python community where users contribute and vote on -Python-related news. - - `/r/python `_ - -Python Weekly -~~~~~~~~~~~~~ - -Python Weekly is a free weekly newsletter featuring curated news, articles, -new releases, jobs, etc. related to Python. - - `Python Weekly `_ diff --git a/docs/_build/html/_sources/notes/contribute.txt b/docs/_build/html/_sources/notes/contribute.txt deleted file mode 100644 index 0d709f2..0000000 --- a/docs/_build/html/_sources/notes/contribute.txt +++ /dev/null @@ -1,27 +0,0 @@ -Contribute -~~~~~~~~~~ - -Python-guide is under active development, and contributors are welcome. - -If you have a feature request, suggestion, or bug report, please open a new -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 -`Contributors List `_. - -Style Guide ------------ - -For all contributions, please follow the :ref:`guide-style-guide`. - -.. _todo-list-ref: - -Todo List ---------- - -If you'd like to contribute, there's plenty to do. Here's a short todo_ list. - - .. include:: ../../TODO.rst - - -.. _GitHub: http://github.com/kennethreitz/python-guide/ -.. _todo: https://github.com/kennethreitz/python-guide/blob/master/TODO.rst diff --git a/docs/_build/html/_sources/notes/license.txt b/docs/_build/html/_sources/notes/license.txt deleted file mode 100644 index d26b3c7..0000000 --- a/docs/_build/html/_sources/notes/license.txt +++ /dev/null @@ -1,4 +0,0 @@ -License -------- - -.. todo:: Determine License \ No newline at end of file diff --git a/docs/_build/html/_sources/notes/styleguide.txt b/docs/_build/html/_sources/notes/styleguide.txt deleted file mode 100644 index 626d4a8..0000000 --- a/docs/_build/html/_sources/notes/styleguide.txt +++ /dev/null @@ -1,164 +0,0 @@ -.. _guide-style-guide: - -===================== -The Guide Style Guide -===================== - -As with all documentation, having a consistent formating helps make the -document more understandable. In order to make The Guide easier to digest, -all contributions should fit within the rules of this style guide where -approriate. - -The Guide is written as :ref:`restructuredtext-ref`. - -.. note:: Parts of The Guide may not yet match this style guide. Feel free - to update those parts to by in sync with The Guide Style Guide - -.. note:: On any page of the rendered HTML you can click "Show Source" to - see how authors have styled the page. - -Relevancy ---------- - -Stride to keep any contributions relevant to the :ref:`purpose of The Guide -`. - -* Avoid including too much information on subjects that don't directly - relate to Python development. -* Prefer to link to other sources if the information is already out there. - Be sure to describe what and why you are linking. -* `Cite `_ - references where needed. -* If a subject isn't directly relevant to Python, but useful in conjuction - with Python (ex: Git, Github, Databases), reference by linking to useful - resouces and describe why it's useful to Python. -* When in doubt, ask. - -Headings --------- - -Use the following styles for headings. - -Chapter title:: - - ######### - Chapter 1 - ######### - -Page title:: - - =================== - Time is an Illusion - =================== - -Section headings:: - - Lunchtime Doubly So - ------------------- - -Sub section headings:: - - Very Deep - ~~~~~~~~~ - -Prose ------ - -Wrap text lines at 78 characters. Where necessary, lines may exceed 78 -characters, especially if wrapping would make the source text more difficult -to read. - - -Code Examples -------------- - -Wrap all code examples at 70 characters to avoid horizontal scrollbars. - -Command line examples:: - - .. code-block:: console - - $ run command --help - $ ls .. - -Be sure to include the ``$`` prefix before each line. - -Python interpreter examples:: - - Label the example:: - - .. code-block:: python - - >>> import this - -Python examples:: - - Descriptive title:: - - .. code-block:: python - - def get_answer(): - return 42 - -Externally Linking ------------------- - -* Prefer labels for well known subjects (ex: proper nouns) when linking:: - - Sphinx_ is used to document Python. - - .. _Sphinx: http://sphinx.pocoo.org - -* Prefer to use descriptive labels with inline links instead of leaving bare - links:: - - Read the `Sphinx Tutorial `_ - -* Avoid using labels such as "click here", "this", etc. preferring - decriptive labels (SEO worthy) instead. - -Linking to Sections in The Guide --------------------------------- - -To cross-reference other parts of this documentation, use the `:ref: -`_ -keyword and labels. - -To make reference labels more clear and unique, always add a ``-ref`` suffix:: - - .. _some-section-ref: - - Some Section - ------------ - -Notes and Warnings ------------------- - -Make use of the appropriate `admonitions directives -`_ when making notes. - -Notes:: - - .. note:: - The Hitchhiker’s Guide to the Galaxy has a few things to say - on the subject of towels. A towel, it says, is about the most - massively useful thing an interstellar hitch hiker can have. - -Warnings:: - - .. warning:: DON'T PANIC - -TODOs ------ - -Please mark any incomplete areas of The Guide with a `todo directive -`_. To -avoid cluttering the :ref:`todo-list-ref`, use a single ``todo`` for stub -documents or large incomplete sections. - -:: - - .. todo:: - Learn the Ultimate Answer to the Ultimate Question - of Life, The Universe, and Everything - diff --git a/docs/_build/html/_sources/scenarios/admin.txt b/docs/_build/html/_sources/scenarios/admin.txt deleted file mode 100644 index 991cab2..0000000 --- a/docs/_build/html/_sources/scenarios/admin.txt +++ /dev/null @@ -1,87 +0,0 @@ -Systems Administration -====================== - -Fabric ------- - -Fabric is a library for simplifying system administration tasks. While Chef -and Puppet tend to focus on managing servers and system libraries, -fabric is more focused on application level tasks such as deployment. - -Install Fabric: - -.. code-block:: bash - - $ pip install fabric - -The following code will create two tasks that we can use: ``memory_usage`` and -``deploy``. The former will output the memory usage on each machine. The -latter will ssh into each server, cd to our project directory, activate the -virtual environment, pull the newest codebase, and restart the application -server. - -:: - - from fabric.api import cd, env, prefix, run, task - - env.hosts = ['my_server1', 'my_server2'] - - @task - def memory_usage(): - run('free -m') - - @task - def deploy(): - with cd('/var/www/project-env/project'): - with prefix('. ../bin/activate'): - run('git pull') - run('touch app.wsgi') - -With the previous code saved in a file named fabfile.py, we can check memory -usage with: - -.. code-block:: bash - - $ fab memory_usage - [my_server1] Executing task 'memory' - [my_server1] run: free -m - [my_server1] out: total used free shared buffers cached - [my_server1] out: Mem: 6964 1897 5067 0 166 222 - [my_server1] out: -/+ buffers/cache: 1509 5455 - [my_server1] out: Swap: 0 0 0 - - [my_server2] Executing task 'memory' - [my_server2] run: free -m - [my_server2] out: total used free shared buffers cached - [my_server2] out: Mem: 1666 902 764 0 180 572 - [my_server2] out: -/+ buffers/cache: 148 1517 - [my_server2] out: Swap: 895 1 894 - -and we can deploy with: - -.. code-block:: bash - - $ fab deploy - -Additional features include parallel execution, interaction with remote -programs, and host grouping. - -Chef ----- - -.. todo:: Write about Chef - -Puppet ------- - -.. todo:: Write about Puppet - -Blueprint ---------- - -.. todo:: Write about Blueprint - -Buildout --------- - -.. todo:: Write about Buildout \ No newline at end of file diff --git a/docs/_build/html/_sources/scenarios/ci.txt b/docs/_build/html/_sources/scenarios/ci.txt deleted file mode 100644 index d2abfa9..0000000 --- a/docs/_build/html/_sources/scenarios/ci.txt +++ /dev/null @@ -1,37 +0,0 @@ -Continuous Integration -====================== - - -Why? ----- - -Martin Fowler, who first wrote about `Continuous Integration `_ (short: CI) together with Kent Beck, describes the CI as follows: - - Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly. - -Jenkins -------- - -`Jenkins CI `_ is an extensible continuous integration engine. Use it. - - - -Buildbot --------- -`Buildbot `_ is a Python system to automate the compile/test cycle to validate code changes. - - -Mule? ------ - -.. todo:: Write about Mule - -Tox ---- - -`tox `_ is an automation tool providing packaging, testing and deployment of Python software right from the console or CI server. -It is a generic virtualenv management and test command line tool which provides the following features: - -* Checking that packages install correctly with different Python versions and interpreters -* Running tests in each of the environments, configuring your test tool of choice -* Acting as a frontend to Continuous Integration servers, reducing boilerplate and merging CI and shell-based testing. \ No newline at end of file diff --git a/docs/_build/html/_sources/scenarios/cli.txt b/docs/_build/html/_sources/scenarios/cli.txt deleted file mode 100644 index cea7a3f..0000000 --- a/docs/_build/html/_sources/scenarios/cli.txt +++ /dev/null @@ -1,9 +0,0 @@ -Command Line Applications -========================= - -.. todo:: Explain "Command Line Applications" - -Clint ------ - -.. todo:: Write about Clint \ No newline at end of file diff --git a/docs/_build/html/_sources/scenarios/db.txt b/docs/_build/html/_sources/scenarios/db.txt deleted file mode 100644 index 7b6ad95..0000000 --- a/docs/_build/html/_sources/scenarios/db.txt +++ /dev/null @@ -1,28 +0,0 @@ -Databases -========= - -DB-API ------- - -The Python Database API (DB-API) defines a standard interface for Python -database access modules. It's documented in `PEP 249 `_. -Nearly all Python database modules such as `sqlite3`, `psycopg` and -`mysql-python` conform to this interface. - - - -SQLAlchemy ----------- - -`SQLAlchemy `_ is a commonly used database toolkit. Unlike many database libraries -it not only provides an ORM layer but also a generalized API for writing -database-agnostic code without SQL. - -:: - - pip install sqlalchemy - -Django ORM ----------- - -.. todo:: Explain Django ORM \ No newline at end of file diff --git a/docs/_build/html/_sources/scenarios/gui.txt b/docs/_build/html/_sources/scenarios/gui.txt deleted file mode 100644 index 2490d98..0000000 --- a/docs/_build/html/_sources/scenarios/gui.txt +++ /dev/null @@ -1,55 +0,0 @@ -GUI Applications -================ - - -Qt -:: -Qt is a cross-platform application framework that is widely used for developing software with a GUI but can also be used for non-GUI applications. - -PySide ------- -http://developer.qt.nokia.com/wiki/PySideDownloads/ - -PyQt ----- -.. note:: If your software does not fully comply with the GPL you will need a commercial license! - -http://www.riverbankcomputing.co.uk/software/pyqt/download - -Cocoa -::::: -.. note:: The Cocoa framework is only available on Mac OSX. Don't pick this if you're writing a cross-platform application! - -PyObjC ------- -.. note:: Only available on Mac OSX. Don't pick this if you're writing a cross-platform application. - -WXPython -:::::::: - - -Install (Stable) ----------------- -*Go to http://www.wxpython.org/download.php#stable and download the appropriate package for your OS.* - -Gtk -::: -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 -PyGTK only currenty supports the Gtk-2.X API (NOT Gtk-3.0). It is currently -recommended that PyGTK is not used for new projects and existing applications be -ported from PyGTK to PyGObject. - -Tk -:: -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 -convenient and compatible toolkit to program with. - -Both Tk and Tkinter are available on most Unix platforms, as well as on Windows -and Macintosh systems. Starting with the 8.0 release, Tk offers native look and -feel on all platforms. - -There's a good multi-language Tk tutorial with Python examples at -`TkDocs `_. There's more information -available on the `Python Wiki `_. diff --git a/docs/_build/html/_sources/scenarios/scientific.txt b/docs/_build/html/_sources/scenarios/scientific.txt deleted file mode 100644 index 52a1efe..0000000 --- a/docs/_build/html/_sources/scenarios/scientific.txt +++ /dev/null @@ -1,50 +0,0 @@ -======================= -Scientific Applications -======================= - -Context -::::::: - -Python is frequently used for high-performance scientific applications. Python is widely used in academia -and scientific projects because it is easy to write, and it performs really well. - -Due to its high performance nature, scientific computing in python often refers to external libraries, typically -written in faster languages (like C, or FORTRAN for matrix operations). The main libraries used are NumPy and SciPy - -Libraries -::::::::: - -Numpy ------ -`NumPy `_ is a low level library written in C (and FORTRAN) for high level mathematical functions. -NumPy cleverly overcomes the problem of running slower algorithms on Python by using multidimensional arrays and functions that operate on arrays. -Any algorithm can then be expressed as a function on arrays, allowing the algorithms to be run quickly. - - -NumPy is part of the SciPy project, and is released as a separate library so people who only need the basic requirements can just use NumPy. - -NumPy is compatible with Python versions 2.4 through to 2.7.2 and 3.1+. - -SciPy ------ -`SciPy `_ is a library that uses Numpy for more mathematical function. SciPy uses NumPy arrays as its basic data structure. -SciPy comes with modules for various commonly used tasks in scientific programing like linear algebra, integration (calculus), -ordinary differential equation solvers and signal processing. - -Enthought ---------- - -Installing NumPy and SciPy can be a daunting task. Which is why the `Enthought Python distribution `_ was created. With Enthought, -scientific python has never been easier (one click to install about 100 scientific python packages). User beware: Enthought is not free. - -Matplotlib ----------- - -.. todo:: write about matplotlib. - -Resources -::::::::: - -Many people who do scientific computing are on Windows. And yet many of the scientific computing packages are notoriously difficult to build and install. -`Christoph Gohlke `_ however, has compiled a list of Windows binaries for many useful Python packages. -The list of packages has grown from a mainly scientific python resource to a more general list. It might be a good idea to check it out if you're on Windows. \ No newline at end of file diff --git a/docs/_build/html/_sources/scenarios/speed.txt b/docs/_build/html/_sources/scenarios/speed.txt deleted file mode 100644 index bd83cde..0000000 --- a/docs/_build/html/_sources/scenarios/speed.txt +++ /dev/null @@ -1,96 +0,0 @@ -Speed -===== - -CPython, the most commonly used implementation of Python, is slow for CPU bound tasks. `PyPy`_ is fast. - -Using a slightly modified version of `David Beazleys`_ CPU bound test code(added loop for multiple tests), you can see the difference between CPython and PyPy's processing. - -:: - - PyPy - $ ./pypy -V - Python 2.7.1 (7773f8fc4223, Nov 18 2011, 18:47:10) - [PyPy 1.7.0 with GCC 4.4.3] - $ ./pypy measure2.py - 0.0683999061584 - 0.0483210086823 - 0.0388588905334 - 0.0440690517426 - 0.0695300102234 - -:: - - CPython - $ ./python -V - Python 2.7.1 - $ ./python measure2.py - 1.06774401665 - 1.45412397385 - 1.51485204697 - 1.54693889618 - 1.60109114647 - -Context -::::::: - - -The GIL -------- - -`The GIL`_ (Global Interpreter Lock) is how Python allows multiple threads to operate at the same time. Python's -memory management isn't entirely thread-safe, so the GIL is requried to prevents multiple threads from running -the same Python code at once. - -David Beazley has a great `guide`_ on how the GIL operates. He also covers the `new GIL`_ in Python 3.2. His -results show that maximizing performance in a Python application requires a strong understanding of the GIL, -how it affects your specific application, how many cores you have, and where your application bottlenecks are. - -C Extentions ------------- - - -The GIL -------- - -`Special care`_ must be taken when writing C extensions to make sure you register your threads -with the interpreter. - -C Extentions -:::::::::::: - - -Cython ------- - - -Pyrex ------ - - -Shedskin? ---------- - - - -Threading -::::::::: - - -Threading ---------- - - -Spanwing Processes ------------------- - - -Multiprocessing ---------------- - - -.. _`PyPy`: http://pypy.org -.. _`The GIL`: http://wiki.python.org/moin/GlobalInterpreterLock -.. _`guide`: http://www.dabeaz.com/python/UnderstandingGIL.pdf -.. _`New GIL`: http://www.dabeaz.com/python/NewGIL.pdf -.. _`Special care`: http://docs.python.org/c-api/init.html#threads -.. _`David Beazleys`: http://www.dabeaz.com/GIL/gilvis/measure2.py diff --git a/docs/_build/html/_sources/scenarios/web.txt b/docs/_build/html/_sources/scenarios/web.txt deleted file mode 100644 index 04c36e7..0000000 --- a/docs/_build/html/_sources/scenarios/web.txt +++ /dev/null @@ -1,228 +0,0 @@ -================ -Web Applications -================ - - -Context -::::::: - - -WSGI ----- - -The Web Server Gateway Interface (or "WSGI" for short) is a standard -interface between web servers and Python web application frameworks. By -standardizing behavior and communication between web servers and Python web -frameworks, WSGI makes it possible to write portable Python web code that -can be deployed in any :ref:`WSGI-compliant web server `. WSGI is -documented in `PEP-3333 `_. - - -Frameworks -:::::::::: - -Broadly speaking, a web framework is a set of libraries upon which you can -build custom code to implement a web application (i.e. an interactive web -site). Most web frameworks include patterns and utilities to accomplish at -least the following: - -URL Routing - Matches an incoming HTTP request to a particular piece of Python code to - be invoked - -Request and Response Objects - Encapsulate the information received from or sent to a user's browser - -Template Engine - Allows for separating Python code implementing an application's logic from - the HTML (or other) output that it produces - -Development Web Server - Runs an HTTP server on development machines to enable rapid development; - often automatically reloads server-side code when files are updated - - -Django ------- - -`Django `_ is a "batteries included" web -application framework. By providing many utilities and patterns out of the -box, Django aims to make it possible to build complex, database-backed web -applications quickly, while encouraging best practices in code written using -it. - -Django has a large and active community, and many pre-built `re-usable -modules `_ that can be incorporated into a new -project as-is, or customized to fit your needs. - -There are annual Django conferences `in the United States -`_ and `in Europe `_. - - -Flask ------ - -`Flask `_ is a "microframework" for Python. Rather -than aiming to provide everything you could possibly need, Flask implements -the most commonly-used core components of a web application framework, like -URL routing, request and response objects, and templates. As a user of -Flask, it is therefore up to you to choose and integrate other components -you may need, such as database access or form generation and validation. For -many popular modules, `Extensions `_ may -already exist to suit your needs. - -**Support** for flask can best be found in its mailing list. Just shoot an email to -flask@librelist.com and reply to the confirmation email. - - -.. todo:: Explain Pyramid - - -Web Servers -::::::::::: - -.. _nginx-ref: - -Nginx ------ - -`Nginx `_ (pronounced "engine-x") is a web server and -reverse-proxy for HTTP, SMTP and other protocols. It is known for its -high performance, relative simplicity, and compatibility with many -application servers (like WSGI servers). It also includes handy features -like load-balancing, basic authentication, streaming, and others. Designed -to serve high-load websites, Nginx is gradually becoming quite popular. - - -.. _wsgi-servers-ref: - -WSGI Servers -:::::::::::: - -Stand-alone WSGI servers typically use less resources than traditional web -servers and provide top performance [3]_. - -.. _gunicorn-ref: - -Gunicorn --------- - -`Gunicorn `_ (Green Unicorn) is a WSGI server used -to serve Python applications. It is a Python interpretation of the Ruby -`Unicorn `_ server. Unicorn is designed to be -lightweight, easy to use, and uses many UNIX idioms. Gunicorn is not designed -to face the internet, in fact it was designed to run behind Nginx which buffers -slow requests, and takes care of other important considerations. A sample -setup for Nginx + gUnicorn can be found in the -`Gunicorn help `_. - -.. _uwsgi-ref: - - -Server Best Practices -::::::::::::::::::::: - -The majority of self hosted Python applications today are hosted with a WSGI -server such as :ref:`gUnicorn `, either directly or behind a -lightweight web server such as :ref:`nginx `. - -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 -protection, and basic authentication. - -Hosting -::::::: - -Platform-as-a-Service ---------------------- - -Platform-as-a-Service (PaaS) is a type of cloud computing infrastructure -which abstracts and manages infrastructure, routing, and scaling of web -applications. When using PaaS, application developers can focus on writing -application code rather than needing to be concerned with deployment -details. - -Most PaaS services offer a command-line interface that developers can use to -set up and interrogate configuration, and to deploy new releases of an -application to the service. - -PaaS services and their partners offer add-on functionality which is well -integrated into the platform, such as database hosting, email services, -logging, scheduled and background tasks, billing and payment, etc. - - -Heroku -~~~~~~ - -`Heroku `_'s -`Cedar stack `_ offers first class -support for Python 2.7 applications. - -Heroku allows you to run as many Python web applications as you like, 24/7 and free -of charge. Heroku is best described as a horizontal scaling platform. They start -to charge you once you "scale" you application to run on more than one Dyno -(abstacted servers) at a time. - -Heroku publishes `step-by-step instructions -`_ on how to set up your first -application for use in Heroku, and maintains a list of `example applications -`_. - - -DotCloud -~~~~~~~~ - -`DotCloud `_ supports WSGI applications and -background/worker tasks natively on their platform. Web applications running -Python version 2.6, and uses :ref:`nginx ` and :ref:`uWSGI -`, and allows custom configuration of both -for advanced users. - -DotCloud uses a custom command-line API client which can work with -applications managed in git repositories or any other version control -system. - -DotCloud has a free plan with limited database size, and without extra -services (caching…). - -See the `DotCloud documentation on Python -`_ for more information and help -getting started. - - -ep.io -~~~~~ - -`ep.io `_ is a PaaS designed specifically for Python web -applications. It supports Python versions 2.6 and 2.7, and has Pythonic -integrations with a variety of services. - -ep.io has a free plan with bandwidth and disk space limitations. Also, in the -free plan, the web process is only loaded when needed. This means that the -first request after some inactivity may take up to 15 seconds. - -ep.io publishes `step-by-step instructions -`_ on how to get started with their -platform and how to deploy Django, Flask, or generic WSGI applications. - -ep.io is currently in invite-only beta. - - -Gondor -~~~~~~ - -`Gondor `_ is a PaaS specailized for deploying Django -and Pinax applications. Gondor supports Django versions 1.2 and 1.3 on -Python version 2.7, and can automatically configure your Django site if you -use ``local_settings.py`` for site-specific configuration information. - -Gondor publishes guides to deploying `Django projects -`_ and `Pinax projects -`_ on their platform. - - -.. rubric:: References - -.. [1] `The mod_python project is now officially dead `_ -.. [2] `mod_wsgi vs mod_python `_ -.. [3] `Benchmark of Python WSGI Servers `_ diff --git a/docs/_build/html/_sources/shipping/freezing.txt b/docs/_build/html/_sources/shipping/freezing.txt deleted file mode 100644 index b6803af..0000000 --- a/docs/_build/html/_sources/shipping/freezing.txt +++ /dev/null @@ -1,49 +0,0 @@ -Freezing Your Code -================== - -An alternative to shipping your code is freezing it — shipping it as an -executable with a bundled Python interpreter. - -Many applications you use every day do this: - -- Dropbox -- BitTorrent -- - - -.. todo:: Fill in "Freezing Your Code" stub - -Windows -::::::: - - -py2exe ------- - - - -OSX -::: - - -py2app ------- - - - - -PyInstaller ------------ - - - - -Linux -::::: - - -bbFreeze --------- - -PyInstaller ------------ diff --git a/docs/_build/html/_sources/shipping/packaging.txt b/docs/_build/html/_sources/shipping/packaging.txt deleted file mode 100644 index 28762e1..0000000 --- a/docs/_build/html/_sources/shipping/packaging.txt +++ /dev/null @@ -1,69 +0,0 @@ -Packaging Your Code -=================== - -Packaging your code is important. - -.. todo:: Write introduction for "Packaging Your Code" - -For Python Developers -::::::::::::::::::::: - -If you're writing an open source Python module, `PyPI `_, more properly known as *The Cheeseshop*, is the place to host it. - - - -Pip vs. easy_install --------------------- - -Use `pip `_. More details `here `_ - - -Personal PyPI -------------- - -If you want to install packages from a source different from PyPI, (say, if -your packages are *proprietary*), you can do it by hosting a simple http server, -running from the directory which holds those packages which need to be installed. - -**Showing an example is always beneficial** - -Say if you are after installing a package called MyPackage.tar.gz, and assuming this is your directory structure - - -- archive - - MyPackage - - MyPackage.tar.gz - -Go to your command prompt and type: -:: - -$ cd archive -$ python -m SimpleHTTPServer 9000 - -This runs a simple http server running on port 9000 and will list all packages (like **MyPackage**). Now you can install **MyPackage** using any python package installer. Using Pip, you would do it like: -:: - -$ pip install --extra-index-url=http://127.0.0.1:9000/ MyPackage - -Having a folder with the same name as the package name is **crucial** here. -I got fooled by that, one time. But if you feel that creating a folder called -**MyPackage** and keeping **MyPackage.tar.gz** inside that, is *redundant*, you can still install MyPackage using: -:: - -$ pip install http://127.0.0.1:9000/MyPackage.tar.gz - -Chishop -+++++++ - -`Chishop `_ is a simple PyPI server written in django which allows you to register/upload with distutils and install with easy_install/pip. - -For Linux Distributions -:::::::::::::::::::::::: - -.. todo:: Fill in "For Linux Distributions" packaging stub - -Useful Tools ------------- - -- epm -- alien diff --git a/docs/_build/html/_sources/starting/dev-env.txt b/docs/_build/html/_sources/starting/dev-env.txt deleted file mode 100644 index b1f2498..0000000 --- a/docs/_build/html/_sources/starting/dev-env.txt +++ /dev/null @@ -1,137 +0,0 @@ -Your Development Environment -============================ - - -Text Editors -:::::::::::: - - -VIM ---- - - -There exist a couple of plugins and settings for the VIM editor to aid python -development. If you only develop in Python, a good start is to set the default -settings for indentation and linewrapping to values compliant with PEP8:: - - set textwidth=79 - set shiftwidth=4 - set tabstop=4 - set expandtab - set softtabstop=4 - set shiftround - -With these settings newlines are inserted after 79 characters and indentation -is set to 4 spaces per tab. If you also use VIM for other languages, there is a -handy plugin at indent_, which handles indentation settings for python source -files. -Additionally there is also a handy syntax plugin at syntax_ featuring some -improvements over the syntax file included in VIM 6.1. - -These plugins supply you with a basic environment for developing in Python. -However in order to improve the programming flow we also want to continually -check for PEP8 compliance and check syntax. Luckily there exist PEP8_ and -Pyflakes_ to do this for you. If your VIM is compiled with `+python` you can -also utilize some very handy plugins to do these checks from within the editor. -For PEP8 checking install vim-pep8_. Now you can map the vim function -`Pep8()` to any hotkey or action you want. Similarly for pyflakes you can -install vim-pyflakes_. Now you can map `Pyflakes()` like the PEP8 function and -have it called quickly. Both plugins will display errors in a quickfix list and -provide an easy way to jump to the corresponding line. A very handy setting is -calling these functions whenever a buffer is saved. In order to do this, enter -the following lines into your vimrc:: - - autocmd BufWritePost *.py call Pyflakes() - autocmd BufWritePost *.py call Pep8() - - -.. _indent: http://www.vim.org/scripts/script.php?script_id=974 -.. _syntax: http://www.vim.org/scripts/script.php?script_id=790 -.. _Pyflakes: http://pypi.python.org/pypi/pyflakes/ -.. _vim-pyflakes: https://github.com/nvie/vim-pyflakes -.. _PEP8: http://pypi.python.org/pypi/pep8/ -.. _vim-pep8: https://github.com/nvie/vim-pep8 - -.. todo:: add supertab notes - - -IDEs -:::: - -PyCharm / IntelliJ IDEA ------------------------ - -PyCharm is developed by JetBrains, also known for IntelliJ IDEA. Both share the same code base and most of PyCharm's features can be brought to IntelliJ with the free `Python Plug-In `_.. - -Eclipse -------- - -The most popular Eclipse plugin for Python development is Aptana's -`PyDev `_. - - -Komodo IDE ------------ -`Komodo IDE `_ is developed by ActiveState and is a commerical IDE for Windows, Mac -and Linux. - -Spyder ------- - -`Spyder `_ an IDE specifically geared toward working with scientific python libraries (namely `Scipy `_). -Includes integration with `pyflakes `_, `pylint `_, -and `rope `_. - -Spyder is open-source (free), offers code completion, syntax highlighting, class and function browser, and object -inspection - - - -Interpreter Tools -::::::::::::::::: - - -virtualenv ----------- - -Virtualenv is a tool to keep the dependencies required by different projects in separate places, by creating virtual Python environments for them. -It solves the "Project X depends on version 1.x but, Project Y needs 4.x" dilemma and keeps your global site-packages directory clean and manageable. - -virtualenvwrapper ------------------ - -Virtualenvwrapper makes virtualenv a pleasure to use by wrapping the command line API with a nicer CLI. - -:: - - pip install virtualenvwrapper - - -Put this into your `~/.bash_profile` (Linux/Mac) file: - -:: - - export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages' - -This will prevent your virtualenvs from relying on your (global) site packages directory, so that they are completely separate.. - -Other Tools -::::::::::: - -IPython -------- - -:: - - $ pip install ipython - - - -BPython -------- - -:: - - $ pip install bpython - - diff --git a/docs/_build/html/_sources/starting/installation.txt b/docs/_build/html/_sources/starting/installation.txt deleted file mode 100644 index 4b8477c..0000000 --- a/docs/_build/html/_sources/starting/installation.txt +++ /dev/null @@ -1,161 +0,0 @@ -Properly Installing Python -========================== - -Mac OS X -:::::::: - -*Or, "Installing Python 2.7 via Homebrew".* - -Package Manager ---------------- - -While Snow Leopard comes with a large number of UNIX utilities, those -familiar with Linux systems will notice one key component missing: a -package manager. Mxcl's *Homebrew* is the answer. - -To install Homebrew, simply run: :: - - $ ruby -e "$(curl -fsS http://gist.github.com/raw/323731/install_homebrew.rb)" - - -It's basic commands are **update**, **install**, and **remove**. - -.. man brew - - -And we can now install Python 2.7: :: - - $ brew install python --framework - - -The ``--framework`` option tells Homebrew to compile a Framework-style Python build, rather than a UNIX-style build. The outdated version of Python that Snow Leopard comes packaged with -is built as a Framework, so this helps avoid some future module installation -bugs. - -*Don't forget to update your environment PATH.* - - -Building From Source --------------------- - - - - -Distribute & Pip ----------------- - -*Distribute* is a fantastic drop-in replacement for *easy_install* and -*setuptools*. It allows you to install and manage python packages from -pypi.python.org, amongst a few other sources. It also plays well with -*virtualenv* and user-enviornments. - -**easy_install** is considered by many to be a deprecated system, so we -will install it's replacement: **pip**. Pip allows for uninstallation -of packages, and is actively maintained, unlike setuptool's easy_install. - -To install *pip* and Distribute's *easy_install*: - -If you have homebrew: :: - - $ brew install pip - -...And, if you're a masochist: :: - - $ curl -O http://python-distribute.org/distribute_setup.py - $ python distribute_setup.py - - $ easy_install pip - - - -To install ``pip``: :: - -Hopefully you'll never have to use **easy_install** again. - - -Updating Python ---------------- - -Homebrew makes it simple. :: - - $ brew update - $ brew install --force python - - -Windows -::::::: - - - -Prerequisites: --------------- - -* Python2.7 (x86) from Python.org -* Microsoft Visual Studio - - -Step 1: Install Distribute & Pip --------------------------------- - -**Distribute** is a fantastic drop-in replacement for **easy_install** and **setuptools**. It allows you to install and manage python packages from PyPi, amongst a few other sources. - -To install it, run the python script available here: - - -Make sure that ```C:\Python27\```, and ```C:\Python27\Scripts``` are in your PATH. - -**easy_install** is considered by many to be a deprecated system, so we will install it's replacement: **pip**. Pip allows for uninstallation of packages, and is actively maintained, unlike setuptool's easy_install. - -To install pip, simply run: :: - - $ easy_install pip - - -Linux (Ubuntu) -:::::::::::::: - -Oneiric Ocelot, the latest version of Ubuntu, **comes with Python 2.7 out of the box**. Python 3.2 can be installed and run with the following commands:: - - $ sudo apt-get install python3-minimal - $ python3 - -Older versions of Python aren't available from the official repository. However, if it's needed (for example to support legacy code), we can add an unsupported repository and install an older version of Python (2.5 in the example below):: - - $ sudo apt-get install python-software-properties - $ sudo add-apt-repository ppa:fkrull/deadsnakes - $ sudo apt-get update - $ sudo apt-get install python2.5 - -Installing setuptools and pip ------------------------------ - -While Python has an extensive standard library, the set of packages available from the Internet is even more extensive. In order to install them easily, we'll install the ``setuptools`` package and ``pip`` installer:: - -.. XXX: sudo? - - $ wget http://python-distribute.org/distribute_setup.py - $ python distribute_setup.py - $ wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py - $ python get-pip.py - $ rm get-pip.py distribute_setup.py - -Now, most Python packages can be installed using the ``pip`` command. For example, if we wanted to install Django:: - - $ sudo pip install django - -A full list of ``pip``'s capabilities is available by typing ``pip --help``. - -Linux (Manual) --------------- - -While your system will quite likely already have Python installation, you might wish to install a different version. This is done in the typical Linux software source install procedure:: - - $ wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz - $ tar -xvf Python-2.7.2.tgz - $ cd Python-2.7.2 - $ ./configure - $ make - $ make install - - - diff --git a/docs/_build/html/_sources/starting/next.txt b/docs/_build/html/_sources/starting/next.txt deleted file mode 100644 index e69de29..0000000 diff --git a/docs/_build/html/_sources/starting/which-python.txt b/docs/_build/html/_sources/starting/which-python.txt deleted file mode 100644 index 9a22bc4..0000000 --- a/docs/_build/html/_sources/starting/which-python.txt +++ /dev/null @@ -1,97 +0,0 @@ -Picking an Interpreter -====================== - -Which Python to use? - - -2.x vs 3.x -~~~~~~~~~~ - -**tl;dr**: Python 2.x is the status quo, Python 3.x is the shiny new thing. - - -`Further Reading `_ - - -Today ------ - -If you're choosing a Python interpreter to use, I *highly* recommend you Use Python 2.7.x, unless you have a strong reason not to. - - -The Future ----------- - -As more and more modules get ported over to Python3, the easier it will be for -others to use it. - - -Which Python to Support? -~~~~~~~~~~~~~~~~~~~~~~~~ - -If you're starting work on a new Python module, I recommend you write it for -Python 2.5 or 2.6, and add support for Python3 in a later iteration. - -Implementations -~~~~~~~~~~~~~~~ - -There are several popular implementations of the Python programming language on -different back-ends. - -CPython -------- - -`CPython `_ is the reference implementation of Python, -written in C. It compiles Python code to intermediate bytecode which is then -interpreted by a virtual machine. When people speak of *Python* they often mean -not just the language but also this implementation. It provides the highest -level of compatibility with Python packages and C extension modules. - -If you are writing open-source Python code and want to reach the widest possible -audience, targeting CPython is your best bet. If you need to use any packages -that are rely on C extensions for their functionality (eg: numpy) then CPython -is your only choice. - -Being the reference implementation, all versions of the Python language are -available as CPython. Python 3 is only available in a CPython implementation. - -PyPy ----- - -`PyPy `_ is a Python interpreter implemented in a restricted -statically-typed subset of the Python language called RPython. The interpreter -features a just-in-time compiler and supports multiple back-ends (C, CLI, JVM). - -PyPy aims for maximum compatibility with the reference CPython implementation -while improving performance. - -If you are looking to squeeze more performance out of your Python code, it's -worth giving PyPy a try. - -Currently PyPy supports Python 2.7. - -Jython ------- - -`Jython `_ is a Python implementation that compiles -Python code to Java byte code that then executes on a JVM. It has the additional -advantage of being able to import and use any Java class the same as a Python -module. - -If you need to interface with an existing Java codebase or have other reasons to -need to write Python code for the JVM, Jython is the best choice. - -Currently Jython supports up to Python 2.5. - -IronPython ----------- - -`IronPython `_ is an implementation of Python for .NET -framework. It can use both Python and .NET framework libraries, and can also -expose Python code to other .NET languages. - -`Python Tools for Visual Studio `_ integrate -IronPython directly in to the Visual Studio development environment, making it -an ideal choice for Windows developers. - -IronPython supports Python 2.7. diff --git a/docs/_build/html/_sources/writing/documentation.txt b/docs/_build/html/_sources/writing/documentation.txt deleted file mode 100644 index 094a013..0000000 --- a/docs/_build/html/_sources/writing/documentation.txt +++ /dev/null @@ -1,76 +0,0 @@ -Documenting Your Code -===================== - -Documenting your code is extremely important. It is debatebly even -more important than testing. - - -The Basics -:::::::::: - - -Code Comments -------------- -Information regarding code comments is taken from PEP 008 (http://www.python.org/dev/peps/pep-0008/). -Block comment styling should be used when commenting out multiple lines of code.: :: - - Block comments generally apply to some (or all) code that follows them, - and are indented to the same level as that code. Each line of a block - comment starts with a # and a single space (unless it is indented text - inside the comment). - Paragraphs inside a block comment are separated by a line containing a - single #. - -Inline comments are used for individual lines and should be used sparingly.: :: - - An inline comment is a comment on the same line as a statement. Inline - comments should be separated by at least two spaces from the statement. - They should start with a # and a single space. - Inline comments are unnecessary and in fact distracting if they state - the obvious. Don't do this: - x = x + 1 # Increment x - But sometimes, this is useful: :: - x = x + 1 # Compensate for border - -Doc Strings ------------ -PEP 257 is the primary reference for docstrings. (http://www.python.org/dev/peps/pep-0257/) -|There are two types of docstrings, one-line and multi-line. Their names should be fairly self explanatory. -|One-line docstrings: :: - - def kos_root(): - """Return the pathname of the KOS root directory.""" - global _kos_root - if _kos_root: return _kos_root - ... - -Multi-line docstrings: :: - - def complex(real=0.0, imag=0.0): - """Form a complex number. - - Keyword arguments: - real -- the real part (default 0.0) - imag -- the imaginary part (default 0.0) - - """ - if imag == 0.0 and real == 0.0: return complex_zero - ... - -Sphinx ------- -Sphinx (http://sphinx.pocoo.org) is a tool which converts documentation in the reStructured text markup language into a range of output formats including HTML, LaTeX (for printable PDF versions), manual pages and plain text. - - - -Other Tools -::::::::::: - -that old thing --------------- - -pocco / docco / shocco ----------------------- - -Ronn ----- \ No newline at end of file diff --git a/docs/_build/html/_sources/writing/license.txt b/docs/_build/html/_sources/writing/license.txt deleted file mode 100644 index 6d91fea..0000000 --- a/docs/_build/html/_sources/writing/license.txt +++ /dev/null @@ -1,54 +0,0 @@ -Choosing a License -================== - -Open source. - - - - - -Non-Restrictive -::::::::::::::: - -PSFL ----- - - -MIT / BSD / ISC ---------------- - - -MIT (X11) -````````` - -New BSD -``````` - -ISC -``` - -Apache ------- - - -Restrictive -::::::::::: - - -LGPL ----- - - - -GPL ---- - - -GPLv2 -````` - - -GPLv3 -````` - - diff --git a/docs/_build/html/_sources/writing/structure.txt b/docs/_build/html/_sources/writing/structure.txt deleted file mode 100644 index 849bdea..0000000 --- a/docs/_build/html/_sources/writing/structure.txt +++ /dev/null @@ -1,22 +0,0 @@ -Structuring Your Project -======================== - -Structuring your project properly is extremely important. - - -Structure is Key ----------------- - - - -Vendorizing Dependencies ------------------------- - - - -Runners -------- - - -Further Reading ---------------- \ No newline at end of file diff --git a/docs/_build/html/_sources/writing/style.txt b/docs/_build/html/_sources/writing/style.txt deleted file mode 100644 index 216c780..0000000 --- a/docs/_build/html/_sources/writing/style.txt +++ /dev/null @@ -1,54 +0,0 @@ -Code Style -========== - - -Idioms -:::::: - -Idiomatic Python code is often referred to as being *pythonic*. - - -Zen of Python -------------- - -Also known as PEP 20, the guiding principles for Python's design. - -:: - - >>> import this - -See ``_ for some -examples. - -PEP 8 ------ - -PEP 8 is the de-facto code style guide for Python. - - `PEP 8 `_ - -There exists a command-line program, `pep8` that can check your code for -conformance. - -:: - - pip install pep8 - - -Simply run it on a file or series of files and get a report of any -violations - -:: - - $ pep8 optparse.py - optparse.py:69:11: E401 multiple imports on one line - optparse.py:77:1: E302 expected 2 blank lines, found 1 - optparse.py:88:5: E301 expected 1 blank line, found 0 - optparse.py:222:34: W602 deprecated form of raising exception - optparse.py:347:31: E211 whitespace before '(' - optparse.py:357:17: E201 whitespace after '{' - optparse.py:472:29: E221 multiple spaces before operator - optparse.py:544:21: W601 .has_key() is deprecated, use 'in' - -Conforming your style to PEP 8 is generally a good idea and helps make code a lot -more consistent when working on projects with other developers. diff --git a/docs/_build/html/_sources/writing/tests.txt b/docs/_build/html/_sources/writing/tests.txt deleted file mode 100644 index 90a63df..0000000 --- a/docs/_build/html/_sources/writing/tests.txt +++ /dev/null @@ -1,158 +0,0 @@ -Testing Your Code -===================== - -Testing your code is very important. - - -The Basics -:::::::::: - - -Unittest --------- - -Unittest is the batteries-included test module in the Python standard library. -Its API will be familiar to anyone who has used any of the JUnit/nUnit/CppUnit -series of tools. - -Creating testcases is accomplished by subclassing a TestCase base class - -:: - - import unittest - - def fun(x): - return x + 1 - - class MyTest(unittest.TestCase): - def test(self): - self.assertEqual(fun(3), 4) - -As of Python 2.7 unittest also includes its own test discovery mechanisms. - - `unittest in the standard library documentation `_ - - -Doctest -------- - -The doctest module searches for pieces of text that look like interactive Python -sessions, and then executes those sessions to verify that they work exactly as -shown. - - -Tools -::::: - - -py.test -------- - -py.test is a no-boilerplate alternative to Python's standard unittest module. - -:: - - $ pip install pytest - -Despite being a fully-featured and extensible test tool it boasts a simple -syntax. Creating a test suite is as easy as writing a module with a couple of -functions - -:: - - # content of test_sample.py - def func(x): - return x + 1 - - def test_answer(): - assert func(3) == 5 - -and then running the `py.test` command - -:: - - $ py.test - =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.1 - collecting ... collected 1 items - - test_sample.py F - - ================================= FAILURES ================================= - _______________________________ test_answer ________________________________ - - def test_answer(): - > assert func(3) == 5 - E assert 4 == 5 - E + where 4 = func(3) - - test_sample.py:5: AssertionError - ========================= 1 failed in 0.02 seconds ========================= - -far less work than would be required for the equivalent functionality with the -unittest module! - - `py.test `_ - - -Nose ----- - -nose extends unittest to make testing easier. - - -:: - - $ pip install nose - -nose provides automatic test discovery to save you the hassle of manually -creating test suites. It also provides numerous plugins for features such as -xUnit-compatible test output, coverage reporting, and test selection. - - `nose `_ - - -tox ---- - -tox is a tool for automating test environment management and testing against multiple -interpreter configurations - -:: - - $ pip install tox - -tox allows you to configure complicatated multi-parameter test matrices via a -simple ini-style configuration file. - - `tox `_ - -Unittest2 ---------- - -unittest2 is a a backport of Python 2.7's unittest module which has an improved -API and better assertions over the one available in previous versions of Python. - -If you're using Python 2.6 or below, you can install it with pip - -:: - - $ pip install unittest2 - -You may want to import the module under the name unittest to make porting code -to newer versions of the module easier in the future - -:: - - import unittest2 as unittest - - class MyTest(unittest.TestCase): - ... - -This way if you ever switch to a newer python version and no longer need the -unittest2 module, you can simply change the import in your test module without -the need to change any other code. - - `unittest2 `_ - - diff --git a/docs/_build/html/_static/basic.css b/docs/_build/html/_static/basic.css index f0379f3..43e8baf 100644 --- a/docs/_build/html/_static/basic.css +++ b/docs/_build/html/_static/basic.css @@ -79,11 +79,11 @@ div.sphinxsidebar input { font-size: 1em; } -div.sphinxsidebar input[type="text"] { +div.sphinxsidebar #searchbox input[type="text"] { width: 170px; } -div.sphinxsidebar input[type="submit"] { +div.sphinxsidebar #searchbox input[type="submit"] { width: 30px; } diff --git a/docs/_build/html/_static/doctools.js b/docs/_build/html/_static/doctools.js index bd1b44e..d4619fd 100644 --- a/docs/_build/html/_static/doctools.js +++ b/docs/_build/html/_static/doctools.js @@ -2,7 +2,7 @@ * doctools.js * ~~~~~~~~~~~ * - * Sphinx JavaScript utilties for all documentation. + * Sphinx JavaScript utilities for all documentation. * * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. diff --git a/docs/_build/html/_static/flasky.css b/docs/_build/html/_static/flasky.css index f26bb1a..1d8aa4b 100644 --- a/docs/_build/html/_static/flasky.css +++ b/docs/_build/html/_static/flasky.css @@ -528,41 +528,6 @@ a:hover tt { } } - -/* scrollbars */ - -::-webkit-scrollbar { - width: 6px; - height: 6px; -} - -::-webkit-scrollbar-button:start:decrement, -::-webkit-scrollbar-button:end:increment { - display: block; - height: 10px; -} - -::-webkit-scrollbar-button:vertical:increment { - background-color: #fff; -} - -::-webkit-scrollbar-track-piece { - background-color: #eee; - -webkit-border-radius: 3px; -} - -::-webkit-scrollbar-thumb:vertical { - height: 50px; - background-color: #ccc; - -webkit-border-radius: 3px; -} - -::-webkit-scrollbar-thumb:horizontal { - width: 50px; - background-color: #ccc; - -webkit-border-radius: 3px; -} - /* misc. */ .revsys-inline { diff --git a/docs/_build/html/_themes/README.html b/docs/_build/html/_themes/README.html index 4fcf881..8d9f146 100644 --- a/docs/_build/html/_themes/README.html +++ b/docs/_build/html/_themes/README.html @@ -78,9 +78,19 @@ you can also use git submodules to check out the contents there.

-

Python Guide

+

Python Guide.

This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. +

+ +

Donate

+

+ If you enjoy this guide, consider supporting the author on Gittip: +

+

+

Related Topics

  • Documentation overview
      @@ -111,32 +121,25 @@ you can also use git submodules to check out the contents there.

      - + Fork me on GitHub - - + - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Your Development Environment

      -
      -

      Text Editors

      -

      Just about anything which can edit plain text will work for writing Python code, -however, using a more powerful editor may make your life a bit easier.

      -
      -

      VIM

      -

      There exist a couple of plugins and settings for the VIM editor to aid python -development. If you only develop in Python, a good start is to set the default -settings for indentation and linewrapping to values compliant with PEP8:

      -
      set textwidth=79
      -set shiftwidth=4
      -set tabstop=4
      -set expandtab
      -set softtabstop=4
      -set shiftround
      -
      -

      With these settings newlines are inserted after 79 characters and indentation -is set to 4 spaces per tab. If you also use VIM for other languages, there is a -handy plugin at indent, which handles indentation settings for python source -files. -Additionally there is also a handy syntax plugin at syntax featuring some -improvements over the syntax file included in VIM 6.1.

      -

      These plugins supply you with a basic environment for developing in Python. -However in order to improve the programming flow we also want to continually -check for PEP8 compliance and check syntax. Luckily there exist PEP8 and -Pyflakes to do this for you. If your VIM is compiled with +python you can -also utilize some very handy plugins to do these checks from within the editor. -For PEP8 checking install vim-pep8. Now you can map the vim function -Pep8() to any hotkey or action you want. Similarly for pyflakes you can -install vim-pyflakes. Now you can map Pyflakes() like the PEP8 function and -have it called quickly. Both plugins will display errors in a quickfix list and -provide an easy way to jump to the corresponding line. A very handy setting is -calling these functions whenever a buffer is saved. In order to do this, enter -the following lines into your vimrc:

      -
      autocmd BufWritePost *.py call Pyflakes()
      -autocmd BufWritePost *.py call Pep8()
      -
      -
      -

      Todo

      -

      add supertab notes

      -
      -
      -
      -

      TextMate

      -

      TextMate brings Apple’s approach to operating systems into the world of text editors. By bridging UNIX underpinnings and GUI, TextMate cherry-picks the best of both worlds to the benefit of expert scripters and novice users alike.”

      -
      -
      -

      Sublime Text

      -

      Sublime Text is a sophisticated text editor -for code, html and prose. You’ll love the slick user interface and -extraordinary features.”

      -

      Sublime Text has excellent support for editing Python code and uses Python for -its plugin API.

      -

      Sublime Text 2 is currently in beta.

      -
      -
      -
      -

      IDEs

      -
      -

      PyCharm / IntelliJ IDEA

      -

      PyCharm is developed by JetBrains, also known for IntelliJ IDEA. Both share the same code base and most of PyCharm’s features can be brought to IntelliJ with the free Python Plug-In.

      -
      -
      -

      Eclipse

      -

      The most popular Eclipse plugin for Python development is Aptana’s -PyDev.

      -
      -
      -

      Komodo IDE

      -

      Komodo IDE is developed by ActiveState and is a commerical IDE for Windows, Mac -and Linux.

      -
      -
      -

      Spyder

      -

      Spyder an IDE specifically geared toward working with scientific python libraries (namely Scipy). -Includes integration with pyflakes, pylint, -and rope.

      -

      Spyder is open-source (free), offers code completion, syntax highlighting, class and function browser, and object inspection.

      -
      -
      -
      -

      Interpreter Tools

      -
      -

      virtualenv

      -

      Virtualenv is a tool to keep the dependencies required by different projects in separate places, by creating virtual Python environments for them. -It solves the “Project X depends on version 1.x but, Project Y needs 4.x” dilemma and keeps your global site-packages directory clean and manageable.

      -

      virtualenv creates -a folder which contains all the necessary executables to contain the -packages that a Python project would need. An example workflow is given.

      -

      Install virtualenv:

      -
      $ pip install virtualenv
      -
      -

      Create a virtual environment for a project:

      -
      $ cd my_project
      -$ virtualenv venv
      -
      -

      virtualenv venv will create a folder in the currect directory -which will contain the Python executable files, and a copy of the pip -library which you can use to install other packages. The name of the -virtual environment (in this case, it was venv) can be anything; -omitting the name will place the files in the current directory instead.

      -

      In order the start using the virtual environment, run:

      -
      $ source venv/bin/activate
      -
      -

      The name of the current virtual environment will now appear on the left -of the prompt (e.g. (venv)Your-Computer:your_project UserName$) to -let you know that it’s active. From now on, any package that you install -using pip will be placed in the venv folder, isolated from the global -Python installation. Install packages as usual:

      -
      $ pip install requests
      -
      -

      To stop using an environment simply type deactivate. To remove the -environment, just remove the directory it was installed into. (In this -case, it would be rm -rf venv).

      -
      -

      Other Notes

      -

      Running virtualenv with the option --no-site-packages will not -include the packages that are installed globally. This can be useful -for keeping the package list clean in case it needs to be accessed later.

      -

      In order to keep your environment consistent, it’s a good idea to “freeze” -the current state of the environment packages. To do this, run

      -
      $ pip freeze > requirements.txt
      -
      -

      This will create a requirements.txt file, which contains a simple -list of all the packages in the current environment, and their respective -versions. Later, when a different developer (or you, if you need to re- -create the environment) can install the same packages, with the same -versions by running

      -
      $ pip install -r requirements.txt
      -
      -

      This can help ensure consistency across installations, across deployments, -and across developers.

      -

      Lastly, remember to exclude the virtual environment folder from source -control by adding it to the ignore list.

      -
      -
      -
      -

      virtualenvwrapper

      -

      Virtualenvwrapper makes virtualenv a pleasure to use by wrapping the command line API with a nicer CLI.

      -
      $ pip install virtualenvwrapper
      -
      -

      Put this into your ~/.bash_profile (Linux/Mac) file:

      -
      $ export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
      -
      -

      This will prevent your virtualenvs from relying on your (global) site packages directory, so that they are completely separate..

      -
      -
      -
      -

      Other Tools

      -
      -

      IPython

      -

      IPython provides a rich toolkit to help you make the most out of using Python interactively. Its main components are:

      -
        -
      • Powerful Python shells (terminal- and Qt-based).
      • -
      • A web-based notebook with the same core features but support for rich media, text, code, mathematical expressions and inline plots.
      • -
      • Support for interactive data visualization and use of GUI toolkits.
      • -
      • Flexible, embeddable interpreters to load into your own projects.
      • -
      • Tools for high level and interactive parallel computing.
      • -
      -
      $ pip install ipython
      -
      -
      -
      -

      BPython

      -

      bpython is an alternative interface to the Python interpreter for Unix-like operating systems. It has the following features:

      -
        -
      • In-line syntax highlighting.
      • -
      • Readline-like autocomplete with suggestions displayed as you type.
      • -
      • Expected parameter list for any Python function.
      • -
      • “Rewind” function to pop the last line of code from memory and re-evaluate.
      • -
      • Send entered code off to a pastebin.
      • -
      • Save entered code to a file.
      • -
      • Auto-indentation.
      • -
      • Python 3 support.
      • -
      -
      $ pip install bpython
      -
      -
      -
      -
      - - -
      -
      -
      -
      -

      Python Guide

      -

      - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

      -

      Table Of Contents

      - -

      Related Topics

      - -

      This Page

      - - - -
      -
      -
      -
      - - - Fork me on GitHub - - - - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/dev/virtualenvs.html b/docs/_build/html/dev/virtualenvs.html deleted file mode 100644 index 811f1e3..0000000 --- a/docs/_build/html/dev/virtualenvs.html +++ /dev/null @@ -1,263 +0,0 @@ - - - - - - - - - Virtual Environments — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
      -
      -
      -
      - -
      -

      Virtual Environments

      -

      A Virtual Environment, put simply, is an isolated working copy of Python which -allows you to work on a specific project without worry of affecting other -projects.

      -

      For example, you can work on a project which requires Django 1.3 while also -maintaining a project which requires Django 1.0.

      -
      -

      virtualenv

      -

      virtualenv is a tool to create -isolated Python environments.

      -

      Install it via pip:

      -
      $ pip install virtualenv
      -
      -
      -
      -

      Basic Usage

      -
        -
      1. Create a virtual environment:
      2. -
      -
      $ virtualenv venv
      -
      -
      -

      This creates a copy of Python in whichever directory you ran the command in, -placing it in a folder named venv.

      -
        -
      1. To begin using the virtual environment, it needs to be activated:
      2. -
      -
      $ source venv/bin/activate
      -
      -
      -

      You can then begin installing any new modules without affecting the system -default Python or other virtual environments.

      -
        -
      1. If you are done working in the virtual environment for the moment, you can -deactivate it:
      2. -
      -
      $ deactivate
      -
      -
      -

      This puts you back to the system’s default Python interpreter with all its -installed libraries.

      -

      To delete a virtual environment, just delete its folder.

      -

      After a while, though, you might end up with a lot of virtual environments -littered across your system, and its possible you’ll forget their names or -where they were placed.

      -
      -
      -
      -

      virtualenvwrapper

      -

      virtualenvwrapper -provides a set of commands which makes working with virtual environments much -more pleasant. It also places all your virtual environments in one place.

      -

      To install (make sure virtualenv is already installed):

      -
      $ pip install virtualenvwrapper
      -$ export WORKON_HOME=~/Envs
      -$ source /usr/local/bin/virtualenvwrapper.sh
      -
      -
      -

      (Full virtualenvwrapper install instructions.)

      -
      -

      Basic Usage

      -
        -
      1. Create a virtual environment:
      2. -
      -
      $ mkvirtualenv venv
      -
      -
      -

      This creates the venv folder inside ~/Envs.

      -
        -
      1. Work on a virtual environment:
      2. -
      -
      $ workon venv
      -
      -
      -

      virtualenvwrapper provides tab-completion on environment names. It really -helps when you have a lot of environments and have trouble remembering their -names. -workon also deactivates whatever environment you are currently in, so you -can quickly switch between environments.

      -
        -
      1. Deactivating is still the same:
      2. -
      -
      $ deactivate
      -
      -
      -
        -
      1. To delete:
      2. -
      -
      $ rmvirtualenv venv
      -
      -
      -
      -
      -

      Other useful commands

      -
      -
      lsvirtualenv
      -
      List all of the environments.
      -
      cdvirtualenv
      -
      Navigate into the directory of the currently activated virtual environment, -so you can browse its site-packages, for example.
      -
      cdsitepackages
      -
      Like the above, but directly into site-packages directory.
      -
      lssitepackages
      -
      Shows contents of site-packages directory.
      -
      -

      Full list of virtualenvwrapper commands.

      -
      -
      -
      - - -
      -
      -
      -
      -

      Python Guide

      -

      - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

      -

      Table Of Contents

      - -

      Related Topics

      - -

      This Page

      - - - -
      -
      -
      -
      - - - Fork me on GitHub - - - - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/genindex.html b/docs/_build/html/genindex.html index 66dd936..b809096 100644 --- a/docs/_build/html/genindex.html +++ b/docs/_build/html/genindex.html @@ -60,9 +60,19 @@
-

About This Guide

+

Python Guide.

This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. +

+ +

Donate

+

+ If you enjoy this guide, consider supporting the author on Gittip: +

+

+

Related Topics

- + Fork me on GitHub - - var _gaq2 = _gaq2 || []; - _gaq2.push(['_setAccount', 'UA-8742933-10']); - _gaq2.push(['_setDomainName', 'none']); - _gaq2.push(['_setAllowLinker', true]); - _gaq2.push(['_trackPageview']); - - (function() { - var ga2 = document.createElement('script'); ga.type = 'text/javascript'; ga2.async = true; - ga2.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; - var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga2, s); - })(); - - - - - @@ -38,9 +37,6 @@
  • index
  • -
  • - next |
  • pythonguide 0.0.1 documentation »
  • @@ -50,233 +46,15 @@
    -
    -

    The Hitchhiker’s Guide to Python!

    -

    Welcome to The Hitchhiker’s Guide to Python. DON’T PANIC!

    -

    This guide is currently under heavy development, and is mostly a skeleton at the moment. If you’d like to help, fork us on GitHub!

    -

    This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis.

    -
    -

    Getting Started

    -

    This part of the guide focuses on setting up your Python environment.

    - -
      -
    • Properly Install Python
    • -
    -
    -
    -
    -
    - -
    -

    Writing Great Code

    -

    This part of the guide focuses on best practices for writing Python code.

    - -
    - -
    -

    Shipping Great Code

    -

    This part of the guide focuses on deploying your Python code.

    - -
    -
    -

    Additional Notes

    -

    This part of the guide, which is mostly prose, begins with some -background information about Python, then focuses on next steps.

    - -
    -

    Contibution notes and legal information are here (for those interested).

    - -
    +
    +

    The Conduct of Code

    +

    Welcome to The Hitchhiker’s Guide to Python. DON’T PANIC!

    +

    This guide is currently under heavy development, and is mostly a skeleton at +the moment. If you’d like to help, fork us on GitHub!

    +

    This opinionated guide exists to provide both novice and expert Python +developers a best-practice handbook to the installation, configuration, and +usage of Python on a daily basis.

    +

    stuff.

    @@ -284,11 +62,21 @@ background information about Python, then focuses on next steps.

    -

    Python Guide

    +

    Conduct of Code.

    This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis.

    +

    Donate

    +

    + If you enjoy this guide, consider supporting the author on Gittip: +

    +

    + +

    +

    Feedback

    Feedback is greatly appreciated. If you have any questions, comments, @@ -328,32 +116,25 @@ background information about Python, then focuses on next steps.

    - + Fork me on GitHub - - + - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    The Community

    -
    -

    BDFL

    -

    Guido van Rossum, the creator of Python, is often referred to as the BDFL — the Benevolent Dictator For Life.

    -
    -
    -

    Python Software Foundation

    -

    The mission of the Python Software Foundation is to promote, protect, and advance the Python programming language, and to support and facilitate the growth of a diverse and international community of Python programmers.

    -

    Learn More about the PSF.

    -
    -
    -

    PEPs

    -

    PEPs are Python Enhancement Proposals. They describe changes to Python itself, or the standards around it.

    -

    There are three different types of PEPs (as defined by PEP1):

    -
    -
    -
    Standards
    -
    Describes a new feature or implementation.
    -
    Informational
    -
    Describes a design issue, general guidelines, or information to the community.
    -
    Process
    -
    Describes a process related to Python.
    -
    -
    -
    -

    Notable PEPs

    -

    There are a few PEPs that could be considered required reading:

    -
      -
    • -
      PEP8: The Python Style Guide.
      -

      Read this. All of it. Follow it.

      -
      -
      -
    • -
    • -
      PEP20: The Zen of Python.
      -

      A list of 19 statements that briefly explain the philosophy behind Python.

      -
      -
      -
    • -
    • -
      PEP257: Docstring Conventions.
      -

      Gives guidelines for semantics and conventions associated with Python docstrings.

      -
      -
      -
    • -
    -

    You can read more at The PEP Index.

    -
    -
    -

    Submitting a PEP

    -
    -

    PEPs are peer-reviewed and accepted/rejected after much discussion. Anyone can write and submit a PEP for review.

    -

    Here’s an overview of the PEP acceptance workflow:

    -http://www.python.org/dev/peps/pep-0001/pep-0001-1.png -
    -
    -
    -
    -

    Python Conferences

    -

    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 sibling, EuroPython.

    -

    A comprehensive list of conferences is maintained at pycon.org.

    -
    -
    -

    Python User Groups

    -

    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 the Python Software Foundation Wiki.

    -
    -
    - - -
    -
    -
    -
    -

    Python Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/intro/documentation.html b/docs/_build/html/intro/documentation.html deleted file mode 100644 index b1c4b4d..0000000 --- a/docs/_build/html/intro/documentation.html +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - - - Documentation — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Documentation

    -
    -

    Official Documentation

    -

    The official Python Language and Library documentation can be found here:

    -
    -
    -
    -
    -

    Read the Docs

    -

    Read the Docs is a popular community project, providing a single location for all documentation of popular and even more exotic Python modules.

    -
    -
    -
    -
    - - -
    -
    -
    -
    -

    Python Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/intro/duction.html b/docs/_build/html/intro/duction.html deleted file mode 100644 index cdca1f7..0000000 --- a/docs/_build/html/intro/duction.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - - - Introduction — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Introduction

    -
    -

    Todo

    -

    write a general blurb introducing the Python language

    -
    -
    -

    About This Guide

    -
    -

    Purpose

    -

    The Hitchhiker’s Guide to Python exists to provide both novice and expert -Python developers a best-practice handbook to the installation, configuration, -and usage of Python on a daily basis.

    -
    -
    -

    By the Community

    -

    This guide is architected and maintained by Kenneth Reitz in an open fashion. This is a -community-driven effort that serves one purpose: to serve the community.

    -
    -
    -

    For the Community

    -

    All contributions to the Guide are welcome, from Pythonistas of all levels. -If you think there’s a gap in what the Guide covers, fork the Guide on -GitHub and submit a pull request. Contributions are welcome from everyone, -whether they’re an old hand or a first-time Pythonista, and the authors to -the Guide will gladly help if you have any questions about the -appropriateness, completeness, or accuracy of a contribution.

    -

    To get started working on The Hitchhiker’s Guide, see -the Contribute page.

    -
    -
    -
    - - -
    -
    -
    -
    -

    Python Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/intro/learning.html b/docs/_build/html/intro/learning.html deleted file mode 100644 index 78ebe7c..0000000 --- a/docs/_build/html/intro/learning.html +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - - - - Learning Python — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Learning Python

    -
    -

    Beginner

    -
    -

    Learn Python Interactive Tutorial

    -

    Learnpython.org is an easy non-intimidating way to get introduced to python. The website takes the same approach used on the popular Try Ruby website, it has an interactive python interpreter built into the site that allows you to go through the lessons without having to install Python locally.

    -
    -
    -
    -
    -

    Learn Python the Hard Way

    -

    This is an excellent beginner programmer’s guide to Python. It covers “hello world” from the console to the web.

    -
    -
    -
    -
    -

    Crash into Python

    -

    Also known as Python for Programmers with 3 Hours, this guide gives experienced developers from other languages a crash course on Python.

    -
    -
    -
    -
    -

    Dive Into Python 3

    -

    Dive Into Python 3 is a good book for those ready to jump in to Python 3. It’s a -good read if you are moving from Python 2 to 3 or if you already have some -experience programming in another language.

    -
    -
    -
    -
    -

    Think Python: How to Think Like a Computer Scientist

    -

    Think Python attempts to give an introduction to basic concepts in computer science through the -use of the python language. The focus was to create a book with plenty of exercises, minimal jargon and -a section in each chapter devoted to the subject of debugging.

    -

    While exploring the various features available in the python language the author weaves in various design -patterns and best practices.

    -

    The book also includes several case studies which have the reader explore the topics discussed in the book -in greater detail by applying those topics to real-world examples. Case studies include assignments in GUI -and Markov Analysis.

    -
    -
    -
    -
    -
    -

    Advanced

    -
    -

    Pro Python

    -
    -

    Todo

    -

    Write about Pro Python

    -
    -
    -
    -

    Expert Python Programming

    -
    -

    Todo

    -

    Write about Expert Python Programming

    -
    -
    -
    -
    - - -
    -
    -
    -
    -

    Python Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/intro/news.html b/docs/_build/html/intro/news.html deleted file mode 100644 index 854c0b4..0000000 --- a/docs/_build/html/intro/news.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - News — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    News

    -
    -

    Planet Python

    -

    This is an aggregate of Python news from a growing number of developers.

    -
    -
    -
    -
    -

    /r/python

    -

    /r/python is the Reddit Python community where users contribute and vote on -Python-related news.

    -
    -
    -
    -
    -

    Python Weekly

    -

    Python Weekly is a free weekly newsletter featuring curated news, articles, -new releases, jobs, etc. related to Python.

    -
    -
    -
    -
    - - -
    -
    -
    -
    -

    Python Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/notes/contribute.html b/docs/_build/html/notes/contribute.html deleted file mode 100644 index 7a51854..0000000 --- a/docs/_build/html/notes/contribute.html +++ /dev/null @@ -1,272 +0,0 @@ - - - - - - - - - Contribute — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Contribute

    -

    Python-guide is under active development, and contributors are welcome.

    -

    If you have a feature request, suggestion, or bug report, please open a new -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 -Contributors List.

    -
    -

    Style Guide

    -

    For all contributions, please follow the The Guide Style Guide.

    -
    -
    -

    Todo List

    -

    If you’d like to contribute, there’s plenty to do. Here’s a short todo list.

    -
    -
      -
    • Establish “use this” vs “alternatives are....” recommendations
    • -
    -
    -

    Todo

    -

    add supertab notes

    -
    -

    (The original entry is located in /Users/kreitz/repos/public/python-guide/docs/dev/env.rst, line 58.)

    -
    -

    Todo

    -

    write a general blurb introducing the Python language

    -
    -

    (The original entry is located in /Users/kreitz/repos/public/python-guide/docs/intro/duction.rst, line 4.)

    -
    -

    Todo

    -

    Write about Pro Python

    -
    -

    (The original entry is located in /Users/kreitz/repos/public/python-guide/docs/intro/learning.rst, line 62.)

    -
    -

    Todo

    -

    Write about Expert Python Programming

    -
    -

    (The original entry is located in /Users/kreitz/repos/public/python-guide/docs/intro/learning.rst, line 67.)

    -
    -

    Todo

    -

    Determine License

    -
    -

    (The original entry is located in /Users/kreitz/repos/public/python-guide/docs/notes/license.rst, line 4.)

    -
    -

    Todo

    -

    Write about Chef

    -
    -

    (The original entry is located in /Users/kreitz/repos/public/python-guide/docs/scenarios/admin.rst, line 72.)

    -
    -

    Todo

    -

    Write about Puppet

    -
    -

    (The original entry is located in /Users/kreitz/repos/public/python-guide/docs/scenarios/admin.rst, line 77.)

    -
    -

    Todo

    -

    Write about Blueprint

    -
    -

    (The original entry is located in /Users/kreitz/repos/public/python-guide/docs/scenarios/admin.rst, line 82.)

    -
    -

    Todo

    -

    Write about Buildout

    -
    -

    (The original entry is located in /Users/kreitz/repos/public/python-guide/docs/scenarios/admin.rst, line 87.)

    -
    -

    Todo

    -

    Write about Mule

    -
    -

    (The original entry is located in /Users/kreitz/repos/public/python-guide/docs/scenarios/ci.rst, line 27.)

    -
    -

    Todo

    -

    Explain “Command Line Applications”

    -
    -

    (The original entry is located in /Users/kreitz/repos/public/python-guide/docs/scenarios/cli.rst, line 4.)

    -
    -

    Todo

    -

    Write about Clint

    -
    -

    (The original entry is located in /Users/kreitz/repos/public/python-guide/docs/scenarios/cli.rst, line 9.)

    -
    -

    Todo

    -

    Explain Django ORM

    -
    -

    (The original entry is located in /Users/kreitz/repos/public/python-guide/docs/scenarios/db.rst, line 28.)

    -
    -

    Todo

    -

    write about matplotlib.

    -
    -

    (The original entry is located in /Users/kreitz/repos/public/python-guide/docs/scenarios/scientific.rst, line 43.)

    -
    -

    Todo

    -

    Explain Pyramid

    -
    -

    (The original entry is located in /Users/kreitz/repos/public/python-guide/docs/scenarios/web.rst, line 78.)

    -
    -

    Todo

    -

    Fill in “Freezing Your Code” stub

    -
    -

    (The original entry is located in /Users/kreitz/repos/public/python-guide/docs/shipping/freezing.rst, line 14.)

    -
    -

    Todo

    -

    Write introduction for “Packaging Your Code”

    -
    -

    (The original entry is located in /Users/kreitz/repos/public/python-guide/docs/shipping/packaging.rst, line 6.)

    -
    -

    Todo

    -

    Fill in “For Linux Distributions” packaging stub

    -
    -

    (The original entry is located in /Users/kreitz/repos/public/python-guide/docs/shipping/packaging.rst, line 63.)

    -
    -

    Todo

    -

    Write “Building From Source”

    -
    -

    (The original entry is located in /Users/kreitz/repos/public/python-guide/docs/starting/installation.rst, line 40.)

    -
    -

    Todo

    -

    Fill in License stub

    -
    -

    (The original entry is located in /Users/kreitz/repos/public/python-guide/docs/writing/license.rst, line 7.)

    -
    -

    Todo

    -

    Fill in “Structuring Your Project” stub

    -
    -

    (The original entry is located in /Users/kreitz/repos/public/python-guide/docs/writing/structure.rst, line 6.)

    -
    -
    -
    - - -
    -
    -
    -
    -

    Python Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/notes/license.html b/docs/_build/html/notes/license.html deleted file mode 100644 index 5fa570c..0000000 --- a/docs/_build/html/notes/license.html +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - - - License — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    License

    -
    -

    Todo

    -

    Determine License

    -
    -
    - - -
    -
    -
    -
    -

    Python Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/notes/styleguide.html b/docs/_build/html/notes/styleguide.html deleted file mode 100644 index 6aee7da..0000000 --- a/docs/_build/html/notes/styleguide.html +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - - The Guide Style Guide — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    The Guide Style Guide

    -

    As with all documentation, having a consistent formating helps make the -document more understandable. In order to make The Guide easier to digest, -all contributions should fit within the rules of this style guide where -approriate.

    -

    The Guide is written as reStructuredText.

    -
    -

    Note

    -

    Parts of The Guide may not yet match this style guide. Feel free -to update those parts to by in sync with The Guide Style Guide

    -
    -
    -

    Note

    -

    On any page of the rendered HTML you can click “Show Source” to -see how authors have styled the page.

    -
    -
    -

    Relevancy

    -

    Stride to keep any contributions relevant to the purpose of The Guide.

    -
      -
    • Avoid including too much information on subjects that don’t directly -relate to Python development.
    • -
    • Prefer to link to other sources if the information is already out there. -Be sure to describe what and why you are linking.
    • -
    • Cite -references where needed.
    • -
    • If a subject isn’t directly relevant to Python, but useful in conjuction -with Python (ex: Git, Github, Databases), reference by linking to useful -resouces and describe why it’s useful to Python.
    • -
    • When in doubt, ask.
    • -
    -
    -
    -

    Headings

    -

    Use the following styles for headings.

    -

    Chapter title:

    -
    #########
    -Chapter 1
    -#########
    -
    -

    Page title:

    -
    ===================
    -Time is an Illusion
    -===================
    -
    -

    Section headings:

    -
    Lunchtime Doubly So
    --------------------
    -
    -

    Sub section headings:

    -
    Very Deep
    -~~~~~~~~~
    -
    -
    -
    -

    Prose

    -

    Wrap text lines at 78 characters. Where necessary, lines may exceed 78 -characters, especially if wrapping would make the source text more difficult -to read.

    -
    -
    -

    Code Examples

    -

    Wrap all code examples at 70 characters to avoid horizontal scrollbars.

    -

    Command line examples:

    -
    .. code-block:: console
    -
    -    $ run command --help
    -    $ ls ..
    -
    -

    Be sure to include the $ prefix before each line.

    -

    Python interpreter examples:

    -
    Label the example::
    -
    -.. code-block:: python
    -
    -    >>> import this
    -
    -

    Python examples:

    -
    Descriptive title::
    -
    -.. code-block:: python
    -
    -    def get_answer():
    -        return 42
    -
    -
    -
    -

    Externally Linking

    -
      -
    • Prefer labels for well known subjects (ex: proper nouns) when linking:

      -
      Sphinx_ is used to document Python.
      -
      -.. _Sphinx: http://sphinx.pocoo.org
      -
      -
    • -
    • Prefer to use descriptive labels with inline links instead of leaving bare -links:

      -
      Read the `Sphinx Tutorial <http://sphinx.pocoo.org/tutorial.html>`_
      -
      -
    • -
    • Avoid using labels such as “click here”, “this”, etc. preferring -decriptive labels (SEO worthy) instead.

      -
    • -
    -
    -
    -

    Linking to Sections in The Guide

    -

    To cross-reference other parts of this documentation, use the :ref: -keyword and labels.

    -

    To make reference labels more clear and unique, always add a -ref suffix:

    -
    .. _some-section-ref:
    -
    -Some Section
    -------------
    -
    -
    -
    -

    Notes and Warnings

    -

    Make use of the appropriate admonitions directives when making notes.

    -

    Notes:

    -
    .. note::
    -    The Hitchhiker’s Guide to the Galaxy has a few things to say
    -    on the subject of towels. A towel, it says, is about the most
    -    massively useful thing an interstellar hitch hiker can have.
    -
    -

    Warnings:

    -
    .. warning:: DON'T PANIC
    -
    -
    -
    -

    TODOs

    -

    Please mark any incomplete areas of The Guide with a todo directive. To -avoid cluttering the Todo List, use a single todo for stub -documents or large incomplete sections.

    -
    .. todo::
    -    Learn the Ultimate Answer to the Ultimate Question
    -    of Life, The Universe, and Everything
    -
    -
    -
    - - -
    -
    -
    -
    -

    Python Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/scenarios/admin.html b/docs/_build/html/scenarios/admin.html deleted file mode 100644 index 48c0f37..0000000 --- a/docs/_build/html/scenarios/admin.html +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - - - - Systems Administration — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Systems Administration

    -
    -

    Fabric

    -

    Fabric is a library for simplifying system administration tasks. While Chef -and Puppet tend to focus on managing servers and system libraries, -fabric is more focused on application level tasks such as deployment.

    -

    Install Fabric:

    -
    $ pip install fabric
    -
    -
    -

    The following code will create two tasks that we can use: memory_usage and -deploy. The former will output the memory usage on each machine. The -latter will ssh into each server, cd to our project directory, activate the -virtual environment, pull the newest codebase, and restart the application -server.

    -
    from fabric.api import cd, env, prefix, run, task
    -
    -env.hosts = ['my_server1', 'my_server2']
    -
    -@task
    -def memory_usage():
    -    run('free -m')
    -
    -@task
    -def deploy():
    -    with cd('/var/www/project-env/project'):
    -        with prefix('. ../bin/activate'):
    -            run('git pull')
    -            run('touch app.wsgi')
    -
    -
    -

    With the previous code saved in a file named fabfile.py, we can check memory -usage with:

    -
    $ fab memory_usage
    -[my_server1] Executing task 'memory'
    -[my_server1] run: free -m
    -[my_server1] out:              total     used     free   shared  buffers   cached
    -[my_server1] out: Mem:          6964     1897     5067        0      166      222
    -[my_server1] out: -/+ buffers/cache:     1509     5455
    -[my_server1] out: Swap:            0        0        0
    -
    -[my_server2] Executing task 'memory'
    -[my_server2] run: free -m
    -[my_server2] out:              total     used     free   shared  buffers   cached
    -[my_server2] out: Mem:          1666      902      764        0      180      572
    -[my_server2] out: -/+ buffers/cache:      148     1517
    -[my_server2] out: Swap:          895        1      894
    -
    -
    -

    and we can deploy with:

    -
    $ fab deploy
    -
    -
    -

    Additional features include parallel execution, interaction with remote -programs, and host grouping.

    -
    -
    -

    Chef

    -
    -

    Todo

    -

    Write about Chef

    -
    -
    -
    -

    Puppet

    -
    -

    Todo

    -

    Write about Puppet

    -
    -
    -
    -

    Blueprint

    -
    -

    Todo

    -

    Write about Blueprint

    -
    -
    -
    -

    Buildout

    -
    -

    Todo

    -

    Write about Buildout

    -
    -
    -
    - - -
    -
    -
    -
    -

    Python Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/scenarios/ci.html b/docs/_build/html/scenarios/ci.html deleted file mode 100644 index 7d98f46..0000000 --- a/docs/_build/html/scenarios/ci.html +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - - - - Continuous Integration — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Continuous Integration

    -
    -

    Why?

    -

    Martin Fowler, who first wrote about Continuous Integration (short: CI) together with Kent Beck, describes the CI as follows:

    -
    -
    Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly.
    -
    -
    -

    Jenkins

    -

    Jenkins CI is an extensible continuous integration engine. Use it.

    -
    -
    -

    Buildbot

    -

    Buildbot is a Python system to automate the compile/test cycle to validate code changes.

    -
    -
    -

    Mule?

    -
    -

    Todo

    -

    Write about Mule

    -
    -
    -
    -

    Tox

    -

    tox is an automation tool providing packaging, testing and deployment of Python software right from the console or CI server. -It is a generic virtualenv management and test command line tool which provides the following features:

    -
      -
    • Checking that packages install correctly with different Python versions and interpreters
    • -
    • Running tests in each of the environments, configuring your test tool of choice
    • -
    • Acting as a frontend to Continuous Integration servers, reducing boilerplate and merging CI and shell-based testing.
    • -
    -
    -
    - - -
    -
    -
    -
    -

    Python Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/scenarios/cli.html b/docs/_build/html/scenarios/cli.html deleted file mode 100644 index ca26a66..0000000 --- a/docs/_build/html/scenarios/cli.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - Command Line Applications — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Command Line Applications

    -
    -

    Todo

    -

    Explain “Command Line Applications”

    -
    -
    -

    Clint

    -
    -

    Todo

    -

    Write about Clint

    -
    -
    -
    - - -
    -
    -
    -
    -

    Python Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/scenarios/db.html b/docs/_build/html/scenarios/db.html deleted file mode 100644 index 29e7711..0000000 --- a/docs/_build/html/scenarios/db.html +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - - - - Databases — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Databases

    -
    -

    DB-API

    -

    The Python Database API (DB-API) defines a standard interface for Python -database access modules. It’s documented in PEP 249. -Nearly all Python database modules such as sqlite3, psycopg and -mysql-python conform to this interface.

    -
    -
    -

    SQLAlchemy

    -

    SQLAlchemy is a commonly used database toolkit. Unlike many database libraries -it not only provides an ORM layer but also a generalized API for writing -database-agnostic code without SQL.

    -
    pip install sqlalchemy
    -
    -
    -
    -

    Django ORM

    -
    -

    Todo

    -

    Explain Django ORM

    -
    -
    -
    - - -
    -
    -
    -
    -

    Python Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/scenarios/gui.html b/docs/_build/html/scenarios/gui.html deleted file mode 100644 index d421558..0000000 --- a/docs/_build/html/scenarios/gui.html +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - - - - GUI Applications — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    GUI Applications

    -
    -

    Qt

    -

    Qt is a cross-platform application framework that is widely used for developing software with a GUI but can also be used for non-GUI applications.

    - -
    -

    PyQt

    -
    -

    Note

    -

    If your software does not fully comply with the GPL you will need a commercial license!

    -
    -

    http://www.riverbankcomputing.co.uk/software/pyqt/download

    -
    -
    -
    -

    Cocoa

    -
    -

    Note

    -

    The Cocoa framework is only available on Mac OSX. Don’t pick this if you’re writing a cross-platform application!

    -
    -
    -

    PyObjC

    -
    -

    Note

    -

    Only available on Mac OSX. Don’t pick this if you’re writing a cross-platform application.

    -
    -
    -
    -
    -

    WXPython

    -
    -

    Install (Stable)

    -

    Go to http://www.wxpython.org/download.php#stable and download the appropriate package for your OS.

    -
    -
    -
    -

    Gtk

    -

    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 -PyGTK only currenty supports the Gtk-2.X API (NOT Gtk-3.0). It is currently -recommended that PyGTK is not used for new projects and existing applications be -ported from PyGTK to PyGObject.

    -
    -
    -

    Tk

    -

    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 -convenient and compatible toolkit to program with.

    -

    Both Tk and Tkinter are available on most Unix platforms, as well as on Windows -and Macintosh systems. Starting with the 8.0 release, Tk offers native look and -feel on all platforms.

    -

    There’s a good multi-language Tk tutorial with Python examples at -TkDocs. There’s more information -available on the Python Wiki.

    -
    -
    - - -
    -
    -
    -
    -

    Python Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/scenarios/scientific.html b/docs/_build/html/scenarios/scientific.html deleted file mode 100644 index 7f513f3..0000000 --- a/docs/_build/html/scenarios/scientific.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - - - Scientific Applications — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Scientific Applications

    -
    -

    Context

    -

    Python is frequently used for high-performance scientific applications. Python is widely used in academia -and scientific projects because it is easy to write, and it performs really well.

    -

    Due to its high performance nature, scientific computing in python often refers to external libraries, typically -written in faster languages (like C, or FORTRAN for matrix operations). The main libraries used are NumPy and SciPy

    -
    -
    -

    Libraries

    -
    -

    Numpy

    -

    NumPy is a low level library written in C (and FORTRAN) for high level mathematical functions. -NumPy cleverly overcomes the problem of running slower algorithms on Python by using multidimensional arrays and functions that operate on arrays. -Any algorithm can then be expressed as a function on arrays, allowing the algorithms to be run quickly.

    -

    NumPy is part of the SciPy project, and is released as a separate library so people who only need the basic requirements can just use NumPy.

    -

    NumPy is compatible with Python versions 2.4 through to 2.7.2 and 3.1+.

    -
    -
    -

    SciPy

    -

    SciPy is a library that uses Numpy for more mathematical function. SciPy uses NumPy arrays as its basic data structure. -SciPy comes with modules for various commonly used tasks in scientific programing like linear algebra, integration (calculus), -ordinary differential equation solvers and signal processing.

    -
    -
    -

    Enthought

    -

    Installing NumPy and SciPy can be a daunting task. Which is why the Enthought Python distribution was created. With Enthought, -scientific python has never been easier (one click to install about 100 scientific python packages). User beware: Enthought is not free.

    -
    -
    -

    Matplotlib

    -
    -

    Todo

    -

    write about matplotlib.

    -
    -
    -
    -
    -

    Resources

    -

    Many people who do scientific computing are on Windows. And yet many of the scientific computing packages are notoriously difficult to build and install. -Christoph Gohlke however, has compiled a list of Windows binaries for many useful Python packages. -The list of packages has grown from a mainly scientific python resource to a more general list. It might be a good idea to check it out if you’re on Windows.

    -
    -
    - - -
    -
    -
    -
    -

    Python Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/scenarios/speed.html b/docs/_build/html/scenarios/speed.html deleted file mode 100644 index ac7d08d..0000000 --- a/docs/_build/html/scenarios/speed.html +++ /dev/null @@ -1,232 +0,0 @@ - - - - - - - - - Speed — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Speed

    -

    CPython, the most commonly used implementation of Python, is slow for CPU bound tasks. PyPy is fast.

    -

    Using a slightly modified version of David Beazleys CPU bound test code(added loop for multiple tests), you can see the difference between CPython and PyPy’s processing.

    -
    PyPy
    -$ ./pypy -V
    -Python 2.7.1 (7773f8fc4223, Nov 18 2011, 18:47:10)
    -[PyPy 1.7.0 with GCC 4.4.3]
    -$ ./pypy measure2.py
    -0.0683999061584
    -0.0483210086823
    -0.0388588905334
    -0.0440690517426
    -0.0695300102234
    -
    -
    CPython
    -$ ./python -V
    -Python 2.7.1
    -$ ./python measure2.py
    -1.06774401665
    -1.45412397385
    -1.51485204697
    -1.54693889618
    -1.60109114647
    -
    -
    -

    Context

    -
    -

    The GIL

    -

    The GIL (Global Interpreter Lock) is how Python allows multiple threads to operate at the same time. Python’s -memory management isn’t entirely thread-safe, so the GIL is requried to prevents multiple threads from running -the same Python code at once.

    -

    David Beazley has a great guide on how the GIL operates. He also covers the new GIL in Python 3.2. His -results show that maximizing performance in a Python application requires a strong understanding of the GIL, -how it affects your specific application, how many cores you have, and where your application bottlenecks are.

    -
    -
    -

    C Extentions

    -
    -
    -

    The GIL

    -

    Special care must be taken when writing C extensions to make sure you register your threads -with the interpreter.

    -
    -
    -
    -

    C Extentions

    -
    -

    Cython

    -
    -
    -

    Pyrex

    -
    -
    -

    Shedskin?

    -
    -
    -
    -

    Threading

    -
    -

    Threading

    -
    -
    -

    Spanwing Processes

    -
    -
    -

    Multiprocessing

    -
    -
    -
    - - -
    -
    -
    -
    -

    Python Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/scenarios/web.html b/docs/_build/html/scenarios/web.html deleted file mode 100644 index 9fd72e1..0000000 --- a/docs/_build/html/scenarios/web.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - - - - - - Web Applications — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Web Applications

    -
    -

    Context

    -
    -

    WSGI

    -

    The Web Server Gateway Interface (or “WSGI” for short) is a standard -interface between web servers and Python web application frameworks. By -standardizing behavior and communication between web servers and Python web -frameworks, WSGI makes it possible to write portable Python web code that -can be deployed in any WSGI-compliant web server. WSGI is -documented in PEP-3333.

    -
    -
    -
    -

    Frameworks

    -

    Broadly speaking, a web framework is a set of libraries upon which you can -build custom code to implement a web application (i.e. an interactive web -site). Most web frameworks include patterns and utilities to accomplish at -least the following:

    -
    -
    URL Routing
    -
    Matches an incoming HTTP request to a particular piece of Python code to -be invoked
    -
    Request and Response Objects
    -
    Encapsulate the information received from or sent to a user’s browser
    -
    Template Engine
    -
    Allows for separating Python code implementing an application’s logic from -the HTML (or other) output that it produces
    -
    Development Web Server
    -
    Runs an HTTP server on development machines to enable rapid development; -often automatically reloads server-side code when files are updated
    -
    -
    -

    Django

    -

    Django is a “batteries included” web -application framework. By providing many utilities and patterns out of the -box, Django aims to make it possible to build complex, database-backed web -applications quickly, while encouraging best practices in code written using -it.

    -

    Django has a large and active community, and many pre-built re-usable -modules that can be incorporated into a new -project as-is, or customized to fit your needs.

    -

    There are annual Django conferences in the United States and in Europe.

    -
    -
    -

    Flask

    -

    Flask is a “microframework” for Python. Rather -than aiming to provide everything you could possibly need, Flask implements -the most commonly-used core components of a web application framework, like -URL routing, request and response objects, and templates. As a user of -Flask, it is therefore up to you to choose and integrate other components -you may need, such as database access or form generation and validation. For -many popular modules, Extensions may -already exist to suit your needs.

    -

    Support for flask can best be found in its mailing list. Just shoot an email to -flask@librelist.com and reply to the confirmation email.

    -
    -

    Todo

    -

    Explain Pyramid

    -
    -
    -
    -
    -

    Web Servers

    -
    -

    Nginx

    -

    Nginx (pronounced “engine-x”) is a web server and -reverse-proxy for HTTP, SMTP and other protocols. It is known for its -high performance, relative simplicity, and compatibility with many -application servers (like WSGI servers). It also includes handy features -like load-balancing, basic authentication, streaming, and others. Designed -to serve high-load websites, Nginx is gradually becoming quite popular.

    -
    -
    -
    -

    WSGI Servers

    -

    Stand-alone WSGI servers typically use less resources than traditional web -servers and provide top performance [3].

    -
    -

    Gunicorn

    -

    Gunicorn (Green Unicorn) is a WSGI server used -to serve Python applications. It is a Python interpretation of the Ruby -Unicorn server. Unicorn is designed to be -lightweight, easy to use, and uses many UNIX idioms. Gunicorn is not designed -to face the internet, in fact it was designed to run behind Nginx which buffers -slow requests, and takes care of other important considerations. A sample -setup for Nginx + gUnicorn can be found in the -Gunicorn help.

    -
    -
    -
    -

    Server Best Practices

    -

    The majority of self hosted Python applications today are hosted with a WSGI -server such as gUnicorn, either directly or behind a -lightweight web server such as nginx.

    -

    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 -protection, and basic authentication.

    -
    -
    -

    Hosting

    -
    -

    Platform-as-a-Service

    -

    Platform-as-a-Service (PaaS) is a type of cloud computing infrastructure -which abstracts and manages infrastructure, routing, and scaling of web -applications. When using PaaS, application developers can focus on writing -application code rather than needing to be concerned with deployment -details.

    -

    Most PaaS services offer a command-line interface that developers can use to -set up and interrogate configuration, and to deploy new releases of an -application to the service.

    -

    PaaS services and their partners offer add-on functionality which is well -integrated into the platform, such as database hosting, email services, -logging, scheduled and background tasks, billing and payment, etc.

    -
    -

    Heroku

    -

    Heroku‘s -Cedar stack offers first class -support for Python 2.7 applications.

    -

    Heroku allows you to run as many Python web applications as you like, 24/7 and free -of charge. Heroku is best described as a horizontal scaling platform. They start -to charge you once you “scale” you application to run on more than one Dyno -(abstacted servers) at a time.

    -

    Heroku publishes step-by-step instructions on how to set up your first -application for use in Heroku, and maintains a list of example applications.

    -
    -
    -

    DotCloud

    -

    DotCloud supports WSGI applications and -background/worker tasks natively on their platform. Web applications running -Python version 2.6, and uses nginx and uWSGI, and allows custom configuration of both -for advanced users.

    -

    DotCloud uses a custom command-line API client which can work with -applications managed in git repositories or any other version control -system.

    -

    DotCloud has a free plan with limited database size, and without extra -services (caching…).

    -

    See the DotCloud documentation on Python for more information and help -getting started.

    -
    -
    -

    ep.io

    -

    ep.io is a PaaS designed specifically for Python web -applications. It supports Python versions 2.6 and 2.7, and has Pythonic -integrations with a variety of services.

    -

    ep.io has a free plan with bandwidth and disk space limitations. Also, in the -free plan, the web process is only loaded when needed. This means that the -first request after some inactivity may take up to 15 seconds.

    -

    ep.io publishes step-by-step instructions on how to get started with their -platform and how to deploy Django, Flask, or generic WSGI applications.

    -

    ep.io is currently in invite-only beta.

    -
    -
    -

    Gondor

    -

    Gondor is a PaaS specailized for deploying Django -and Pinax applications. Gondor supports Django versions 1.2 and 1.3 on -Python version 2.7, and can automatically configure your Django site if you -use local_settings.py for site-specific configuration information.

    -

    Gondor publishes guides to deploying Django projects and Pinax projects on their platform.

    -

    References

    - - - - - -
    [1]The mod_python project is now officially dead
    - - - - - -
    [2]mod_wsgi vs mod_python
    - - - - - -
    [3]Benchmark of Python WSGI Servers
    -
    -
    -
    -
    - - -
    -
    -
    -
    -

    Python Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/search.html b/docs/_build/html/search.html index dc74614..5eabfee 100644 --- a/docs/_build/html/search.html +++ b/docs/_build/html/search.html @@ -80,9 +80,19 @@
    -

    About This Guide

    +

    Python Guide.

    This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. +

    + +

    Donate

    +

    + If you enjoy this guide, consider supporting the author on Gittip: +

    +

    +

    Related Topics

    - + Fork me on GitHub - - var _gaq2 = _gaq2 || []; - _gaq2.push(['_setAccount', 'UA-8742933-10']); - _gaq2.push(['_setDomainName', 'none']); - _gaq2.push(['_setAllowLinker', true]); - _gaq2.push(['_trackPageview']); - - (function() { - var ga2 = document.createElement('script'); ga.type = 'text/javascript'; ga2.async = true; - ga2.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; - var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga2, s); - })(); - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Freezing Your Code

    -

    An alternative to shipping your code is freezing it — shipping it as an -executable with a bundled Python interpreter.

    -

    Many applications you use every day do this:

    -
      -
    • Dropbox
    • -
    • BitTorrent
    • -
    • -
    -
    -

    Todo

    -

    Fill in “Freezing Your Code” stub

    -
    -
    -

    Windows

    -
    -

    py2exe

    -
    -
    -
    -

    OSX

    -
    -

    py2app

    -
    -
    -

    PyInstaller

    -
    -
    -
    -

    Linux

    -
    -

    bbFreeze

    -
    -
    -

    PyInstaller

    -
    -
    -
    - - -
    -
    -
    -
    -

    Python Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/shipping/packaging.html b/docs/_build/html/shipping/packaging.html deleted file mode 100644 index 54f5989..0000000 --- a/docs/_build/html/shipping/packaging.html +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - - - - Packaging Your Code — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Packaging Your Code

    -

    Packaging your code is important.

    -
    -

    Todo

    -

    Write introduction for “Packaging Your Code”

    -
    -
    -

    For Python Developers

    -

    If you’re writing an open source Python module, PyPI, more properly known as The Cheeseshop, is the place to host it.

    -
    -

    Pip vs. easy_install

    -

    Use pip. More details here

    -
    -
    -

    Personal PyPI

    -

    If you want to install packages from a source different from PyPI, (say, if -your packages are proprietary), you can do it by hosting a simple http server, -running from the directory which holds those packages which need to be installed.

    -

    Showing an example is always beneficial

    -

    Say if you are after installing a package called MyPackage.tar.gz, and assuming this is your directory structure

    -
      -
    • -
      archive
      -
        -
      • -
        MyPackage
        -
          -
        • MyPackage.tar.gz
        • -
        -
        -
        -
      • -
      -
      -
      -
    • -
    -

    Go to your command prompt and type:

    -
    $ cd archive
    -$ python -m SimpleHTTPServer 9000
    -
    -

    This runs a simple http server running on port 9000 and will list all packages (like MyPackage). Now you can install MyPackage using any python package installer. Using Pip, you would do it like:

    -
    $ pip install --extra-index-url=http://127.0.0.1:9000/ MyPackage
    -
    -

    Having a folder with the same name as the package name is crucial here. -I got fooled by that, one time. But if you feel that creating a folder called -MyPackage and keeping MyPackage.tar.gz inside that, is redundant, you can still install MyPackage using:

    -
    $ pip install  http://127.0.0.1:9000/MyPackage.tar.gz
    -
    -
    -

    Chishop

    -

    Chishop is a simple PyPI server written in django which allows you to register/upload with distutils and install with easy_install/pip.

    -
    -
    -
    -
    -

    For Linux Distributions

    -
    -

    Todo

    -

    Fill in “For Linux Distributions” packaging stub

    -
    -
    -

    Useful Tools

    -
      -
    • epm
    • -
    • alien
    • -
    -
    -
    -
    - - -
    -
    -
    -
    -

    Python Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/starting/dev-env.html b/docs/_build/html/starting/dev-env.html deleted file mode 100644 index 8cfd0ff..0000000 --- a/docs/_build/html/starting/dev-env.html +++ /dev/null @@ -1,256 +0,0 @@ - - - - - - - - - Your Development Environment — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Your Development Environment

    -
    -

    Text Editors

    -
    -

    VIM

    -

    There exist a couple of plugins and settings for the VIM editor to aid python -development. If you only develop in Python, a good start is to set the default -settings for indentation and linewrapping to values compliant with PEP8:

    -
    set textwidth=79
    -set shiftwidth=4
    -set tabstop=4
    -set expandtab
    -set softtabstop=4
    -set shiftround
    -
    -

    With these settings newlines are inserted after 79 characters and indentation -is set to 4 spaces per tab. If you also use VIM for other languages, there is a -handy plugin at indent, which handles indentation settings for python source -files. -Additionally there is also a handy syntax plugin at syntax featuring some -improvements over the syntax file included in VIM 6.1.

    -

    These plugins supply you with a basic environment for developing in Python. -However in order to improve the programming flow we also want to continually -check for PEP8 compliance and check syntax. Luckily there exist PEP8 and -Pyflakes_ to do this for you. If your VIM is compiled with +python you can -also utilize some very handy plugins to do these checks from within the editor. -For PEP8 checking install vim-pep8. Now you can map the vim function -Pep8() to any hotkey or action you want. Similarly for pyflakes you can -install vim-pyflakes. Now you can map Pyflakes() like the PEP8 function and -have it called quickly. Both plugins will display errors in a quickfix list and -provide an easy way to jump to the corresponding line. A very handy setting is -calling these functions whenever a buffer is saved. In order to do this, enter -the following lines into your vimrc:

    -
    autocmd BufWritePost *.py call Pyflakes()
    -autocmd BufWritePost *.py call Pep8()
    -
    -
    -
    -
    -

    IDEs

    -
    -

    PyCharm / IntelliJ IDEA

    -

    PyCharm is developed by JetBrains, also known for IntelliJ IDEA. Both share the same code base and most of PyCharm’s features can be brought to IntelliJ with the free Python Plug-In..

    -
    -
    -

    Eclipse

    -

    The most popular Eclipse plugin for Python development is Aptana’s -PyDev.

    -
    -
    -

    Komodo IDE

    -

    Komodo IDE is developed by ActiveState and is a commerical IDE for Windows, Mac -and Linux.

    -
    -
    -

    Spyder

    -

    Spyder an IDE specifically geared toward working with scientific python libraries (namely Scipy). -Includes integration with pyflakes, pylint, -and rope.

    -

    Spyder is open-source (free), offers code completion, syntax highlighting, class and function browser, and object -inspection

    -
    -
    -
    -

    Interpreter Tools

    -
    -

    virtualenv

    -

    Virtualenv is a tool to keep the dependencies required by different projects in separate places, by creating virtual Python environments for them. -It solves the “Project X depends on version 1.x but, Project Y needs 4.x” dilemma and keeps your global site-packages directory clean and manageable.

    -
    -
    -

    virtualenvwrapper

    -

    Virtualenvwrapper makes virtualenv a pleasure to use by wrapping the command line API with a nicer CLI.

    -
    pip install virtualenvwrapper
    -
    -

    Put this into your ~/.bash_profile (Linux/Mac) file:

    -
    export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
    -
    -

    This will prevent your virtualenvs from relying on your (global) site packages directory, so that they are completely separate..

    -
    -
    -
    -

    Other Tools

    -
    -

    IPython

    -
    $ pip install ipython
    -
    -
    -
    -

    BPython

    -
    $ pip install bpython
    -
    -
    -
    -
    - - -
    -
    -
    -
    -

    About This Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/starting/installation.html b/docs/_build/html/starting/installation.html deleted file mode 100644 index af6dc72..0000000 --- a/docs/_build/html/starting/installation.html +++ /dev/null @@ -1,275 +0,0 @@ - - - - - - - - - Properly Installing Python — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Properly Installing Python

    -
    -

    Mac OS X

    -

    Or, “Installing Python 2.7 via Homebrew”.

    -
    -

    Package Manager

    -

    While Snow Leopard comes with a large number of UNIX utilities, those -familiar with Linux systems will notice one key component missing: a -package manager. Mxcl’s Homebrew is the answer.

    -

    To install Homebrew, simply run:

    -
    $ ruby -e "$(curl -fsS http://gist.github.com/raw/323731/install_homebrew.rb)"
    -
    -

    It’s basic commands are update, install, and remove.

    -

    And we can now install Python 2.7:

    -
    $ brew install python --framework
    -
    -

    The --framework option tells Homebrew to compile a Framework-style Python build, rather than a UNIX-style build. The outdated version of Python that Snow Leopard comes packaged with -is built as a Framework, so this helps avoid some future module installation -bugs.

    -

    Don’t forget to update your environment PATH.

    -
    -
    -

    Building From Source

    -
    -
    -

    Distribute & Pip

    -

    Distribute is a fantastic drop-in replacement for easy_install and -setuptools. It allows you to install and manage python packages from -pypi.python.org, amongst a few other sources. It also plays well with -virtualenv and user-enviornments.

    -

    easy_install is considered by many to be a deprecated system, so we -will install it’s replacement: pip. Pip allows for uninstallation -of packages, and is actively maintained, unlike setuptool’s easy_install.

    -

    To install pip and Distribute’s easy_install:

    -

    If you have homebrew:

    -
    $ brew install pip
    -
    -

    ...And, if you’re a masochist:

    -
    $ curl -O http://python-distribute.org/distribute_setup.py
    -$ python distribute_setup.py
    -
    -$ easy_install pip
    -
    -

    To install pip:

    -

    Hopefully you’ll never have to use easy_install again.

    -
    -
    -

    Updating Python

    -

    Homebrew makes it simple.

    -
    $ brew update
    -$ brew install --force python
    -
    -
    -
    -
    -

    Windows

    -
    -

    Prerequisites:

    -
      -
    • Python2.7 (x86) from Python.org
    • -
    • Microsoft Visual Studio
    • -
    -
    -
    -

    Step 1: Install Distribute & Pip

    -

    Distribute is a fantastic drop-in replacement for easy_install and setuptools. It allows you to install and manage python packages from PyPi, amongst a few other sources.

    -
    -
    To install it, run the python script available here:
    -
    <http://python-distribute.org/distribute_setup.py>
    -
    -

    Make sure that `C:\Python27\`, and `C:\Python27\Scripts` are in your PATH.

    -

    easy_install is considered by many to be a deprecated system, so we will install it’s replacement: pip. Pip allows for uninstallation of packages, and is actively maintained, unlike setuptool’s easy_install.

    -

    To install pip, simply run:

    -
    $ easy_install pip
    -
    -
    -
    -
    -

    Linux (Ubuntu)

    -

    Oneiric Ocelot, the latest version of Ubuntu, comes with Python 2.7 out of the box. Python 3.2 can be installed and run with the following commands:

    -
    $ sudo apt-get install python3-minimal
    -$ python3
    -
    -

    Older versions of Python aren’t available from the official repository. However, if it’s needed (for example to support legacy code), we can add an unsupported repository and install an older version of Python (2.5 in the example below):

    -
    $ sudo apt-get install python-software-properties
    -$ sudo add-apt-repository ppa:fkrull/deadsnakes
    -$ sudo apt-get update
    -$ sudo apt-get install python2.5
    -
    -
    -

    Installing setuptools and pip

    -

    While Python has an extensive standard library, the set of packages available from the Internet is even more extensive. In order to install them easily, we’ll install the setuptools package and pip installer:

    -
    .. XXX: sudo?
    -
    -
    -
    $ wget http://python-distribute.org/distribute_setup.py -$ python distribute_setup.py -$ wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py -$ python get-pip.py -$ rm get-pip.py distribute_setup.py
    -

    Now, most Python packages can be installed using the pip command. For example, if we wanted to install Django:

    -
    $ sudo pip install django
    -
    -

    A full list of pip‘s capabilities is available by typing pip --help.

    -
    -
    -

    Linux (Manual)

    -

    While your system will quite likely already have Python installation, you might wish to install a different version. This is done in the typical Linux software source install procedure:

    -
    $ wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz
    -$ tar -xvf Python-2.7.2.tgz
    -$ cd Python-2.7.2
    -$ ./configure
    -$ make
    -$ make install
    -
    -
    -
    -
    - - -
    -
    -
    -
    -

    About This Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/starting/next.html b/docs/_build/html/starting/next.html deleted file mode 100644 index 18386b4..0000000 --- a/docs/_build/html/starting/next.html +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - <no title> — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - - - -
    -
    -
    -
    -

    About This Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/starting/which-python.html b/docs/_build/html/starting/which-python.html deleted file mode 100644 index 052936f..0000000 --- a/docs/_build/html/starting/which-python.html +++ /dev/null @@ -1,225 +0,0 @@ - - - - - - - - - Picking an Interpreter — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Picking an Interpreter

    -

    Which Python to use?

    -
    -

    2.x vs 3.x

    -

    tl;dr: Python 2.x is the status quo, Python 3.x is the shiny new thing.

    -

    Further Reading

    -
    -

    Today

    -

    If you’re choosing a Python interpreter to use, I highly recommend you Use Python 2.7.x, unless you have a strong reason not to.

    -
    -
    -

    The Future

    -

    As more and more modules get ported over to Python3, the easier it will be for -others to use it.

    -
    -
    -
    -

    Which Python to Support?

    -

    If you’re starting work on a new Python module, I recommend you write it for -Python 2.5 or 2.6, and add support for Python3 in a later iteration.

    -
    -
    -

    Implementations

    -

    There are several popular implementations of the Python programming language on -different back-ends.

    -
    -

    CPython

    -

    CPython is the reference implementation of Python, -written in C. It compiles Python code to intermediate bytecode which is then -interpreted by a virtual machine. When people speak of Python they often mean -not just the language but also this implementation. It provides the highest -level of compatibility with Python packages and C extension modules.

    -

    If you are writing open-source Python code and want to reach the widest possible -audience, targeting CPython is your best bet. If you need to use any packages -that are rely on C extensions for their functionality (eg: numpy) then CPython -is your only choice.

    -

    Being the reference implementation, all versions of the Python language are -available as CPython. Python 3 is only available in a CPython implementation.

    -
    -
    -

    PyPy

    -

    PyPy is a Python interpreter implemented in a restricted -statically-typed subset of the Python language called RPython. The interpreter -features a just-in-time compiler and supports multiple back-ends (C, CLI, JVM).

    -

    PyPy aims for maximum compatibility with the reference CPython implementation -while improving performance.

    -

    If you are looking to squeeze more performance out of your Python code, it’s -worth giving PyPy a try.

    -

    Currently PyPy supports Python 2.7.

    -
    -
    -

    Jython

    -

    Jython is a Python implementation that compiles -Python code to Java byte code that then executes on a JVM. It has the additional -advantage of being able to import and use any Java class the same as a Python -module.

    -

    If you need to interface with an existing Java codebase or have other reasons to -need to write Python code for the JVM, Jython is the best choice.

    -

    Currently Jython supports up to Python 2.5.

    -
    -
    -

    IronPython

    -

    IronPython is an implementation of Python for .NET -framework. It can use both Python and .NET framework libraries, and can also -expose Python code to other .NET languages.

    -

    Python Tools for Visual Studio integrate -IronPython directly in to the Visual Studio development environment, making it -an ideal choice for Windows developers.

    -

    IronPython supports Python 2.7.

    -
    -
    -
    - - -
    -
    -
    -
    -

    About This Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/writing/documentation.html b/docs/_build/html/writing/documentation.html deleted file mode 100644 index 87c9763..0000000 --- a/docs/_build/html/writing/documentation.html +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - - - - Documenting Your Code — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Documenting Your Code

    -

    Documenting your code is extremely important. It is debatebly even -more important than testing.

    -
    -

    The Basics

    -
    -

    Code Comments

    -

    Information regarding code comments is taken from PEP 008 (http://www.python.org/dev/peps/pep-0008/). -Block comment styling should be used when commenting out multiple lines of code.:

    -
    Block comments generally apply to some (or all) code that follows them,
    -and are indented to the same level as that code.  Each line of a block
    -comment starts with a # and a single space (unless it is indented text
    -inside the comment).
    -Paragraphs inside a block comment are separated by a line containing a
    -single #.
    -
    -

    Inline comments are used for individual lines and should be used sparingly.:

    -
    An inline comment is a comment on the same line as a statement.  Inline
    -comments should be separated by at least two spaces from the statement.
    -They should start with a # and a single space.
    -Inline comments are unnecessary and in fact distracting if they state
    -the obvious.  Don't do this:
    -    x = x + 1                 # Increment x
    -But sometimes, this is useful: ::
    -    x = x + 1                 # Compensate for border
    -
    -
    -
    -

    Doc Strings

    -

    PEP 257 is the primary reference for docstrings. (http://www.python.org/dev/peps/pep-0257/) -|There are two types of docstrings, one-line and multi-line. Their names should be fairly self explanatory. -|One-line docstrings:

    -
    def kos_root():
    -    """Return the pathname of the KOS root directory."""
    -    global _kos_root
    -    if _kos_root: return _kos_root
    -    ...
    -
    -
    -

    Multi-line docstrings:

    -
    def complex(real=0.0, imag=0.0):
    -    """Form a complex number.
    -
    -    Keyword arguments:
    -    real -- the real part (default 0.0)
    -    imag -- the imaginary part (default 0.0)
    -
    -    """
    -    if imag == 0.0 and real == 0.0: return complex_zero
    -    ...
    -
    -
    -
    -
    -

    Sphinx

    -

    Sphinx (http://sphinx.pocoo.org) is a tool which converts documentation in the reStructured text markup language into a range of output formats including HTML, LaTeX (for printable PDF versions), manual pages and plain text.

    -
    -
    -
    -

    Other Tools

    -
    -

    that old thing

    -
    -
    -

    pocco / docco / shocco

    -
    -
    -

    Ronn

    -
    -
    -
    - - -
    -
    -
    -
    -

    About This Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/writing/license.html b/docs/_build/html/writing/license.html deleted file mode 100644 index 3a11fbf..0000000 --- a/docs/_build/html/writing/license.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - - Choosing a License — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Choosing a License

    -

    Open source.

    -
    -

    Non-Restrictive

    -
    -

    PSFL

    -
    -
    -

    MIT / BSD / ISC

    -
    -

    MIT (X11)

    -
    -
    -

    New BSD

    -
    -
    -

    ISC

    -
    -
    -
    -

    Apache

    -
    -
    -
    -

    Restrictive

    -
    -

    LGPL

    -
    -
    -

    GPL

    -
    -

    GPLv2

    -
    -
    -

    GPLv3

    -
    -
    -
    -
    - - -
    -
    -
    -
    -

    About This Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/writing/structure.html b/docs/_build/html/writing/structure.html deleted file mode 100644 index d336946..0000000 --- a/docs/_build/html/writing/structure.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - Structuring Your Project — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Structuring Your Project

    -

    Structuring your project properly is extremely important.

    -
    -

    Structure is Key

    -
    -
    -

    Vendorizing Dependencies

    -
    -
    -

    Runners

    -
    -
    -

    Further Reading

    -
    -
    - - -
    -
    -
    -
    -

    About This Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/writing/style.html b/docs/_build/html/writing/style.html deleted file mode 100644 index dc3677b..0000000 --- a/docs/_build/html/writing/style.html +++ /dev/null @@ -1,184 +0,0 @@ - - - - - - - - - Code Style — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Code Style

    -
    -

    Idioms

    -

    Idiomatic Python code is often referred to as being pythonic.

    -
    -

    Zen of Python

    -

    Also known as PEP 20, the guiding principles for Python’s design.

    -
    >>> import this
    -
    -
    -

    See http://stackoverflow.com/questions/228181/the-zen-of-python for some -examples.

    -
    -
    -

    PEP 8

    -

    PEP 8 is the de-facto code style guide for Python.

    -
    -
    -

    There exists a command-line program, pep8 that can check your code for -conformance.

    -
    pip install pep8
    -
    -

    Simply run it on a file or series of files and get a report of any -violations

    -
    $ pep8 optparse.py
    -optparse.py:69:11: E401 multiple imports on one line
    -optparse.py:77:1: E302 expected 2 blank lines, found 1
    -optparse.py:88:5: E301 expected 1 blank line, found 0
    -optparse.py:222:34: W602 deprecated form of raising exception
    -optparse.py:347:31: E211 whitespace before '('
    -optparse.py:357:17: E201 whitespace after '{'
    -optparse.py:472:29: E221 multiple spaces before operator
    -optparse.py:544:21: W601 .has_key() is deprecated, use 'in'
    -
    -

    Conforming your style to PEP 8 is generally a good idea and helps make code a lot -more consistent when working on projects with other developers.

    -
    -
    -
    - - -
    -
    -
    -
    -

    About This Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - \ No newline at end of file diff --git a/docs/_build/html/writing/tests.html b/docs/_build/html/writing/tests.html deleted file mode 100644 index 7c779ec..0000000 --- a/docs/_build/html/writing/tests.html +++ /dev/null @@ -1,270 +0,0 @@ - - - - - - - - - Testing Your Code — pythonguide 0.0.1 documentation - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    -

    Testing Your Code

    -

    Testing your code is very important.

    -
    -

    The Basics

    -
    -

    Unittest

    -

    Unittest is the batteries-included test module in the Python standard library. -Its API will be familiar to anyone who has used any of the JUnit/nUnit/CppUnit -series of tools.

    -

    Creating testcases is accomplished by subclassing a TestCase base class

    -
    import unittest
    -
    -def fun(x):
    -    return x + 1
    -
    -class MyTest(unittest.TestCase):
    -    def test(self):
    -        self.assertEqual(fun(3), 4)
    -
    -
    -

    As of Python 2.7 unittest also includes its own test discovery mechanisms.

    -
    -
    -
    -
    -

    Doctest

    -

    The doctest module searches for pieces of text that look like interactive Python -sessions, and then executes those sessions to verify that they work exactly as -shown.

    -
    -
    -
    -

    Tools

    -
    -

    py.test

    -

    py.test is a no-boilerplate alternative to Python’s standard unittest module.

    -
    $ pip install pytest
    -
    -

    Despite being a fully-featured and extensible test tool it boasts a simple -syntax. Creating a test suite is as easy as writing a module with a couple of -functions

    -
    # content of test_sample.py
    -def func(x):
    -    return x + 1
    -
    -def test_answer():
    -    assert func(3) == 5
    -
    -
    -

    and then running the py.test command

    -
    $ py.test
    -=========================== test session starts ============================
    -platform darwin -- Python 2.7.1 -- pytest-2.2.1
    -collecting ... collected 1 items
    -
    -test_sample.py F
    -
    -================================= FAILURES =================================
    -_______________________________ test_answer ________________________________
    -
    -    def test_answer():
    ->       assert func(3) == 5
    -E       assert 4 == 5
    -E        +  where 4 = func(3)
    -
    -test_sample.py:5: AssertionError
    -========================= 1 failed in 0.02 seconds =========================
    -
    -

    far less work than would be required for the equivalent functionality with the -unittest module!

    -
    -
    -
    -
    -

    Nose

    -

    nose extends unittest to make testing easier.

    -
    $ pip install nose
    -
    -

    nose provides automatic test discovery to save you the hassle of manually -creating test suites. It also provides numerous plugins for features such as -xUnit-compatible test output, coverage reporting, and test selection.

    -
    -
    -
    -
    -

    tox

    -

    tox is a tool for automating test environment management and testing against multiple -interpreter configurations

    -
    $ pip install tox
    -
    -

    tox allows you to configure complicatated multi-parameter test matrices via a -simple ini-style configuration file.

    -
    -
    -
    -
    -

    Unittest2

    -

    unittest2 is a a backport of Python 2.7’s unittest module which has an improved -API and better assertions over the one available in previous versions of Python.

    -

    If you’re using Python 2.6 or below, you can install it with pip

    -
    $ pip install unittest2
    -
    -

    You may want to import the module under the name unittest to make porting code -to newer versions of the module easier in the future

    -
    import unittest2 as unittest
    -
    -class MyTest(unittest.TestCase):
    -    ...
    -
    -
    -

    This way if you ever switch to a newer python version and no longer need the -unittest2 module, you can simply change the import in your test module without -the need to change any other code.

    -
    -
    -
    -
    -
    - - -
    -
    -
    -
    -

    About This Guide

    -

    - This opinionated guide exists to provide both novice and expert Python developers a best-practice handbook to the installation, configuration, and usage of Python on a daily basis. -

    -

    Table Of Contents

    - -

    Related Topics

    - -

    This Page

    - - - -
    -
    -
    -
    - - - Fork me on GitHub - - - - - - - \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index 90cda08..3b32cbd 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,10 +1,5 @@ -.. osxpython documentation master file, created by - sphinx-quickstart on Wed Aug 4 22:51:11 2010. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -The Hitchhiker's Guide to Python! -================================= +The Conduct of Code +=================== Welcome to The Hitchhiker's Guide to Python. `DON'T PANIC! `_