mirror of
https://github.com/kennethreitz/python-guide.git
synced 2026-06-05 14:50:19 +00:00
Vendored
+5
-5
@@ -59,8 +59,8 @@
|
||||
<h3>Useful Links</h3>
|
||||
<ul>
|
||||
<li><a href="https://docs.python-guide.org/">The Guide Website</a></li>
|
||||
<li><a href="http://github.com/realpython/python-guide">The Guide @ GitHub</a></li>
|
||||
<li><a href="http://github.com/realpython/python-guide/issues">Issue Tracker</a></li>
|
||||
<li><a href="https://github.com/realpython/python-guide">The Guide @ GitHub</a></li>
|
||||
<li><a href="https://github.com/realpython/python-guide/issues">Issue Tracker</a></li>
|
||||
<li><a href="https://media.readthedocs.org/pdf/python-guide/latest/python-guide.pdf">The Guide as a PDF</a></li>
|
||||
</ul>
|
||||
|
||||
@@ -69,8 +69,8 @@
|
||||
<li><a href="https://docs.python-guide.org/">English</a></li>
|
||||
<li><a href="https://python-guide-fr.readthedocs.io/fr/latest/">French</a></li>
|
||||
<li><a href="https://pythonguidecn.readthedocs.io/zh/latest/">Chinese</a></li>
|
||||
<li><a href="http://python-guideja.readthedocs.io/ja/latest/">Japanese</a></li>
|
||||
<li><a href="https://python-guideja.readthedocs.io/ja/latest/">Japanese</a></li>
|
||||
<li><a href="https://python-guide-kr.readthedocs.io/ko/latest/">Korean</a></li>
|
||||
<li><a href="http://python-guide-fil.readthedocs.io/en/latest/">Filipino</a></li>
|
||||
<li><a href="http://python-guide-pt-br.readthedocs.io/pt_BR/latest/">Brazilian Portuguese</a></li>
|
||||
<li><a href="https://python-guide-fil.readthedocs.io/en/latest/">Filipino</a></li>
|
||||
<li><a href="https://python-guide-pt-br.readthedocs.io/pt_BR/latest/">Brazilian Portuguese</a></li>
|
||||
</ul>
|
||||
|
||||
+8
-3
@@ -11,7 +11,9 @@
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
import sys, os
|
||||
import datetime
|
||||
import os
|
||||
import sys
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
@@ -45,8 +47,11 @@ source_suffix = '.rst'
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
current_year = datetime.datetime.now().year
|
||||
project = u'pythonguide'
|
||||
copyright = u'2011–2018 <a href="http://kennethreitz.com/pages/open-projects.html">Kenneth Reitz</a> & <a href="https://realpython.com">Real Python</a>. <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">CC BY-NC-SA 3.0</a>'
|
||||
copyright = (u'2011-{} <a href="http://kennethreitz.com/pages/open-projects.html">Kenneth Reitz</a>'
|
||||
' & <a href="https://realpython.com">Real Python</a>.'
|
||||
' <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">CC BY-NC-SA 3.0</a>').format(current_year)
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
@@ -241,7 +246,7 @@ man_pages = [
|
||||
epub_title = u'pythonguide'
|
||||
epub_author = u'Kenneth Reitz'
|
||||
epub_publisher = u'Kenneth Reitz'
|
||||
epub_copyright = u'2011–2018, Kenneth Reitz & Real Python'
|
||||
epub_copyright = u'2011–{}, Kenneth Reitz & Real Python'.format(current_year)
|
||||
|
||||
# The language of the text. It defaults to the language option
|
||||
# or en if the language is not set.
|
||||
|
||||
+17
-17
@@ -87,10 +87,10 @@ using ``<Tab>`` key or any other customized keys.
|
||||
|
||||
.. _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/
|
||||
.. _pycodestyle: https://pypi.python.org/pypi/pycodestyle/
|
||||
.. _syntastic: https://github.com/scrooloose/syntastic
|
||||
.. _Python-mode: https://github.com/klen/python-mode
|
||||
.. _Pyflakes: http://pypi.org/project/pyflakes/
|
||||
.. _pycodestyle: https://pypi.org/project/pycodestyle/
|
||||
.. _syntastic: https://github.com/vim-syntastic/syntastic
|
||||
.. _Python-mode: https://github.com/python-mode/python-mode
|
||||
.. _SuperTab: http://www.vim.org/scripts/script.php?script_id=1643
|
||||
.. _vim-flake8: https://github.com/nvie/vim-flake8
|
||||
|
||||
@@ -103,7 +103,7 @@ Emacs user is `Python Programming in Emacs`_ at EmacsWiki.
|
||||
|
||||
1. Emacs itself comes with a Python mode.
|
||||
|
||||
.. _Python Programming in Emacs: http://emacswiki.org/emacs/PythonProgrammingInEmacs
|
||||
.. _Python Programming in Emacs: https://www.emacswiki.org/emacs/PythonProgrammingInEmacs
|
||||
|
||||
TextMate
|
||||
--------
|
||||
@@ -135,7 +135,7 @@ Atom
|
||||
Atom is web native (HTML, CSS, JS), focusing on modular design and easy plugin
|
||||
development. It comes with native package control and a plethora of packages.
|
||||
Recommended for Python development is
|
||||
`Linter <https://github.com/AtomLinter/Linter>`_ combined with
|
||||
`Linter <https://github.com/steelbrain/linter>`_ combined with
|
||||
`linter-flake8 <https://github.com/AtomLinter/linter-flake8>`_.
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ MIT licensed.
|
||||
|
||||
Enthought Canopy
|
||||
----------------
|
||||
`Enthought Canopy <https://www.enthought.com/products/canopy/>`_ is a Python
|
||||
`Enthought Canopy <https://www.enthought.com/product/canopy/>`_ is a Python
|
||||
IDE which is focused towards Scientists and Engineers as it provides pre
|
||||
installed libraries for data analysis.
|
||||
|
||||
@@ -171,13 +171,13 @@ Eclipse
|
||||
-------
|
||||
|
||||
The most popular Eclipse plugin for Python development is Aptana's
|
||||
`PyDev <http://pydev.org>`_.
|
||||
`PyDev <https://pydev.org>`_.
|
||||
|
||||
|
||||
Komodo IDE
|
||||
----------
|
||||
|
||||
`Komodo IDE <http://www.activestate.com/komodo-ide>`_ is developed by
|
||||
`Komodo IDE <https://www.activestate.com/products/komodo-ide/>`_ is developed by
|
||||
ActiveState and is a commercial IDE for Windows, Mac, and Linux.
|
||||
`KomodoEdit <https://github.com/Komodo/KomodoEdit>`_ is the open source
|
||||
alternative.
|
||||
@@ -188,8 +188,8 @@ Spyder
|
||||
|
||||
`Spyder <https://github.com/spyder-ide/spyder>`_ is an IDE specifically geared
|
||||
toward working with scientific Python libraries (namely
|
||||
`SciPy <http://www.scipy.org/>`_). It includes integration with pyflakes_,
|
||||
`pylint <http://www.logilab.org/857>`_ and
|
||||
`SciPy <https://www.scipy.org/>`_). It includes integration with pyflakes_,
|
||||
`pylint <https://www.logilab.org/857>`_ and
|
||||
`rope <https://github.com/python-rope/rope>`_.
|
||||
|
||||
Spyder is open source (free), offers code completion, syntax highlighting,
|
||||
@@ -242,13 +242,13 @@ Virtual Environments
|
||||
Virtual Environments provide a powerful way to isolate project package dependencies. This means that you can use packages particular to a Python project without installing them system wide and thus avoiding potential version conflicts.
|
||||
|
||||
To start using and see more information:
|
||||
`Virtual Environments <http://github.com/kennethreitz/python-guide/blob/master/docs/dev/virtualenvs.rst>`_ docs.
|
||||
`Virtual Environments <https://github.com/kennethreitz/python-guide/blob/master/docs/dev/virtualenvs.rst>`_ docs.
|
||||
|
||||
|
||||
pyenv
|
||||
-----
|
||||
|
||||
`pyenv <https://github.com/yyuu/pyenv>`_ is a tool to allow multiple versions
|
||||
`pyenv <https://github.com/pyenv/pyenv-virtualenv>`_ is a tool to allow multiple versions
|
||||
of the Python interpreter to be installed at the same time. This solves the
|
||||
problem of having different projects requiring different versions of Python.
|
||||
For example, it becomes very easy to install Python 2.7 for compatibility in
|
||||
@@ -264,7 +264,7 @@ pyenv. pyenv then works out which version of Python should be run based on
|
||||
environment variables, ``.python-version`` files, and the global default.
|
||||
|
||||
pyenv isn't a tool for managing virtual environments, but there is the plugin
|
||||
`pyenv-virtualenv <https://github.com/yyuu/pyenv-virtualenv>`_ which automates
|
||||
`pyenv-virtualenv <https://github.com/pyenv/pyenv-virtualenv>`_ which automates
|
||||
the creation of different environments, and also makes it possible to use the
|
||||
existing pyenv tools to switch to different environments based on environment
|
||||
variables or ``.python-version`` files.
|
||||
@@ -314,7 +314,7 @@ To download and install IPython with all its optional dependencies for the noteb
|
||||
BPython
|
||||
-------
|
||||
|
||||
`bpython <http://bpython-interpreter.org/>`_ is an alternative interface to the
|
||||
`bpython <https://bpython-interpreter.org/>`_ is an alternative interface to the
|
||||
Python interpreter for Unix-like operating systems. It has the following
|
||||
features:
|
||||
|
||||
@@ -334,8 +334,8 @@ features:
|
||||
ptpython
|
||||
--------
|
||||
|
||||
`ptpython <https://github.com/jonathanslenders/ptpython/>`_ is a REPL build
|
||||
on top of the `prompt_toolkit <http://github.com/jonathanslenders/python-prompt-toolkit>`_
|
||||
`ptpython <https://github.com/prompt-toolkit/ptpython>`_ is a REPL build
|
||||
on top of the `prompt_toolkit <https://github.com/prompt-toolkit/python-prompt-toolkit>`_
|
||||
library. It is considered to be an alternative to BPython_. Features include:
|
||||
|
||||
* Syntax highlighting
|
||||
|
||||
+17
-17
@@ -118,7 +118,7 @@ tutorial) and run:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ cd myproject
|
||||
$ cd project_folder
|
||||
$ pipenv install requests
|
||||
|
||||
Pipenv will install the excellent `Requests`_ library and create a ``Pipfile``
|
||||
@@ -156,7 +156,7 @@ when you share your project with others. You should get output similar to this
|
||||
Adding requests to Pipfile's [packages]...
|
||||
P.S. You have excellent taste! ✨ 🍰 ✨
|
||||
|
||||
.. _Requests: https://python-requests.org
|
||||
.. _Requests: http://docs.python-requests.org/en/master/
|
||||
|
||||
|
||||
Using installed packages
|
||||
@@ -200,7 +200,7 @@ Congratulations, you now know how to install and use Python packages! ✨ 🍰
|
||||
Lower level: virtualenv
|
||||
=======================
|
||||
|
||||
`virtualenv <http://pypi.python.org/pypi/virtualenv>`_ is a tool to create
|
||||
`virtualenv <http://pypi.org/project/virtualenv>`_ is a tool to create
|
||||
isolated Python environments. virtualenv creates a folder which contains all the
|
||||
necessary executables to use the packages that a Python project would need.
|
||||
|
||||
@@ -225,7 +225,7 @@ Basic Usage
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ cd my_project_folder
|
||||
$ cd project_folder
|
||||
$ virtualenv venv
|
||||
|
||||
``virtualenv venv`` will create a folder in the current directory which will
|
||||
@@ -260,19 +260,19 @@ or change the interpreter globally with an env variable in ``~/.bashrc``:
|
||||
$ 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
|
||||
the prompt (e.g. ``(venv)Your-Computer:project_folder 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.
|
||||
|
||||
For Windows, same command which is mentioned in step 1 can be used for creation of virtual environment. But, to activate, we use the following command.
|
||||
For Windows, the same command mentioned in step 1 can be used to create a virtual environment. However, activating the environment requires a slightly different command.
|
||||
|
||||
Assuming that you are in project directory:
|
||||
Assuming that you are in your project directory:
|
||||
|
||||
.. code-block:: powershell
|
||||
.. code-block:: console
|
||||
|
||||
PS C:\Users\suryav> \venv\Scripts\activate
|
||||
C:\Users\SomeUser\project_folder> venv\Scripts\activate
|
||||
|
||||
Install packages as usual, for example:
|
||||
Install packages using the ``pip`` command:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
@@ -283,13 +283,13 @@ Install packages as usual, for example:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ deactivate
|
||||
$ 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. (In this case,
|
||||
it would be ``rm -rf my_project``.)
|
||||
it would be ``rm -rf project_folder``.)
|
||||
|
||||
After a while, though, you might end up with a lot of virtual environments
|
||||
littered across your system, and it's possible you'll forget their names or
|
||||
@@ -366,23 +366,23 @@ Basic Usage
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ mkvirtualenv my_project
|
||||
$ mkvirtualenv project_folder
|
||||
|
||||
This creates the :file:`my_project` folder inside :file:`~/Envs`.
|
||||
This creates the :file:`project_folder` folder inside :file:`~/Envs`.
|
||||
|
||||
2. Work on a virtual environment:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ workon my_project
|
||||
$ workon project_folder
|
||||
|
||||
Alternatively, you can make a project, which creates the virtual environment,
|
||||
and also a project directory inside ``$WORKON_HOME``, which is ``cd``-ed into
|
||||
when you ``workon myproject``.
|
||||
when you ``workon project_folder``.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ mkproject myproject
|
||||
$ mkproject project_folder
|
||||
|
||||
**virtualenvwrapper** provides tab-completion on environment names. It really
|
||||
helps when you have a lot of environments and have trouble remembering their
|
||||
|
||||
@@ -28,11 +28,11 @@ include:
|
||||
object serialization, and much more.
|
||||
|
||||
Additionally, the
|
||||
`Python Package Index <http://pypi.python.org/pypi/>`_ is available
|
||||
`Python Package Index <https://pypi.org>`_ is available
|
||||
for users to submit their packages for widespread use, similar to
|
||||
Perl's `CPAN <http://www.cpan.org>`_. There is a thriving community
|
||||
Perl's `CPAN <https://www.cpan.org>`_. There is a thriving community
|
||||
of very powerful Python frameworks and tools like
|
||||
the `Django <http://www.djangoproject.com>`_ web framework and the
|
||||
the `Django <https://www.djangoproject.com>`_ web framework and the
|
||||
`NumPy <http://numpy.scipy.org>`_ set of math routines.
|
||||
|
||||
* **integration with other systems**
|
||||
|
||||
+19
-17
@@ -41,14 +41,14 @@ thepythonguru.com is a tutorial focused on beginner programmers. It covers many
|
||||
in depth. It also teaches you some advanced constructs of Python like lambda expressions and regular expressions.
|
||||
And last it finishes off with the tutorial "How to access MySQL db using Python"
|
||||
|
||||
`Python for Beginners <http://thepythonguru.com/>`_
|
||||
`Python for Beginners <https://thepythonguru.com/>`_
|
||||
|
||||
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 <http://tryruby.org/>`_ website. It has an interactive Python
|
||||
`Try Ruby <https://ruby.github.io/TryRuby>`_ 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.
|
||||
|
||||
@@ -65,9 +65,9 @@ resource for learning all aspects of the language.
|
||||
Learn Python Step by Step
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Techbeamers.com provides step-by-step tutorials to teach Python. Each tutorial is supplemented with logically added coding snippets and equips with a follow-up quiz on the subject learned. There is a section for `Python interview questions <http://www.techbeamers.com/python-interview-questions-programmers>`_ to help job seekers. You can also read essential `Python tips <http://www.techbeamers.com/essential-python-tips-tricks-programmers>`_ and learn `best coding practices <http://www.techbeamers.com/python-code-optimization-tips-tricks>`_ for writing quality code. Here, you'll get the right platform to learn Python quickly.
|
||||
Techbeamers.com provides step-by-step tutorials to teach Python. Each tutorial is supplemented with logically added coding snippets and equips with a follow-up quiz on the subject learned. There is a section for `Python interview questions <https://www.techbeamers.com/python-interview-questions-programmers>`_ to help job seekers. You can also read essential `Python tips <https://www.techbeamers.com/essential-python-tips-tricks-programmers>`_ and learn `best coding practices <https://www.techbeamers.com/python-code-optimization-tips-tricks>`_ for writing quality code. Here, you'll get the right platform to learn Python quickly.
|
||||
|
||||
`Learn Python Basic to Advanced <http://www.techbeamers.com/python-tutorial-step-by-step>`_
|
||||
`Learn Python Basic to Advanced <https://www.techbeamers.com/python-tutorial-step-by-step>`_
|
||||
|
||||
|
||||
Online Python Tutor
|
||||
@@ -108,7 +108,7 @@ 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 <http://learnpythonthehardway.org/book/>`_
|
||||
`Learn Python the Hard Way <https://learnpythonthehardway.org/book/>`_
|
||||
|
||||
|
||||
Crash into Python
|
||||
@@ -117,7 +117,7 @@ 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 <http://stephensugden.com/crash_into_python/>`_
|
||||
`Crash into Python <https://stephensugden.com/crash_into_python/>`_
|
||||
|
||||
|
||||
Dive Into Python 3
|
||||
@@ -161,11 +161,11 @@ For those used to languages and figuring out puzzles on their own, this can be
|
||||
a fun, attractive option. For those new to Python and programming, having an
|
||||
additional resource or reference will be helpful.
|
||||
|
||||
`Python Koans <http://bitbucket.org/gregmalcolm/python_koans>`_
|
||||
`Python Koans <https://bitbucket.org/gregmalcolm/python_koans>`_
|
||||
|
||||
More information about test driven development can be found at these resources:
|
||||
|
||||
`Test Driven Development <http://en.wikipedia.org/wiki/Test-driven_development>`_
|
||||
`Test Driven Development <https://en.wikipedia.org/wiki/Test-driven_development>`_
|
||||
|
||||
|
||||
A Byte of Python
|
||||
@@ -178,13 +178,15 @@ no previous programming experience.
|
||||
`A Byte of Python for Python 3.x <https://python.swaroopch.com/>`_
|
||||
|
||||
|
||||
Learn to Program in Python with Codeacademy
|
||||
Computer Science Path on Codecademy
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
A Codeacademy course for the absolute Python beginner. This free and interactive course provides and teaches the basics (and beyond) of Python programming while testing the user's knowledge in between progress.
|
||||
A Codeacademy course for the absolute Python beginner. This free and interactive
|
||||
course provides and teaches the basics (and beyond) of Python programming while
|
||||
testing the user's knowledge in between progress.
|
||||
This course also features a built-in interpreter for receiving instant feedback on your learning.
|
||||
|
||||
`Learn to Program in Python with Codeacademy <http://www.codecademy.com/en/tracks/python>`_
|
||||
`Computer Science Path on Codecademy <https://www.codecademy.com/learn/paths/computer-science>`_
|
||||
|
||||
|
||||
Code the blocks
|
||||
@@ -220,7 +222,7 @@ pages, it is a very brief overview of some of the most common adapations
|
||||
programmers need to make to become efficient intermediate level Python
|
||||
programmers.
|
||||
|
||||
`Effective Python <http://www.effectivepython.com/>`_
|
||||
`Effective Python <https://effectivepython.com/>`_
|
||||
|
||||
|
||||
********
|
||||
@@ -251,7 +253,7 @@ and eventually an application, including a chapter on using zc.buildout. Later
|
||||
chapters detail best practices such as writing documentation, test-driven
|
||||
development, version control, optimization, and profiling.
|
||||
|
||||
`Expert Python Programming <http://www.packtpub.com/expert-python-programming/book>`_
|
||||
`Expert Python Programming <https://www.packtpub.com/application-development/expert-python-programming>`_
|
||||
|
||||
|
||||
A Guide to Python's Magic Methods
|
||||
@@ -278,7 +280,7 @@ A Primer on Scientific Programming with Python, written by Hans Petter
|
||||
Langtangen, mainly covers Python's usage in the scientific field. In the book,
|
||||
examples are chosen from mathematics and the natural sciences.
|
||||
|
||||
`A Primer on Scientific Programming with Python <http://www.springer.com/mathematics/computational+science+%26+engineering/book/978-3-642-30292-3>`_
|
||||
`A Primer on Scientific Programming with Python <https://www.springer.com/us/book/9783642302930#otherversion=9783642302923>`_
|
||||
|
||||
Numerical Methods in Engineering with Python
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -286,7 +288,7 @@ Numerical Methods in Engineering with Python
|
||||
Numerical Methods in Engineering with Python, written by Jaan Kiusalaas,
|
||||
puts the emphasis on numerical methods and how to implement them in Python.
|
||||
|
||||
`Numerical Methods in Engineering with Python <http://www.cambridge.org/us/academic/subjects/engineering/engineering-mathematics-and-programming/numerical-methods-engineering-python-2nd-edition>`_
|
||||
`Numerical Methods in Engineering with Python <https://www.cambridge.org/us/academic/subjects/engineering/engineering-mathematics-and-programming/numerical-methods-engineering-python-2nd-edition>`_
|
||||
|
||||
|
||||
********************
|
||||
@@ -405,6 +407,6 @@ some commonly used piece of code, followed by an explanation of why the idiom
|
||||
is important. It also contains two code samples for each idiom: the "Harmful"
|
||||
way to write it and the "Idiomatic" way.
|
||||
|
||||
`For Python 2.7.3+ <http://www.amazon.com/Writing-Idiomatic-Python-2-7-3-Knupp/dp/1482372177/>`_
|
||||
`For Python 2.7.3+ <https://www.amazon.com/Writing-Idiomatic-Python-Jeff-Knupp-ebook/dp/B00B5KG0F8/>`_
|
||||
|
||||
`For Python 3.3+ <http://www.amazon.com/Writing-Idiomatic-Python-Jeff-Knupp-ebook/dp/B00B5VXMRG/>`_
|
||||
`For Python 3.3+ <https://www.amazon.com/Writing-Idiomatic-Python-Jeff-Knupp-ebook/dp/B00B5VXMRG/>`_
|
||||
|
||||
+4
-4
@@ -32,7 +32,7 @@ Planet Python
|
||||
|
||||
This is an aggregate of Python news from a growing number of developers.
|
||||
|
||||
`Planet Python <http://planet.python.org>`_
|
||||
`Planet Python <https://planetpython.org>`_
|
||||
|
||||
|
||||
*********
|
||||
@@ -42,7 +42,7 @@ This is an aggregate of Python news from a growing number of developers.
|
||||
/r/python is the Reddit Python community where users contribute and vote on
|
||||
Python-related news.
|
||||
|
||||
`/r/python <http://reddit.com/r/python>`_
|
||||
`/r/python <https://reddit.com/r/python>`_
|
||||
|
||||
|
||||
*******************
|
||||
@@ -70,7 +70,7 @@ Python Weekly
|
||||
Python Weekly is a free weekly newsletter featuring curated news, articles,
|
||||
new releases, jobs, etc. related to Python.
|
||||
|
||||
`Python Weekly <http://www.pythonweekly.com/>`_
|
||||
`Python Weekly <https://www.pythonweekly.com/>`_
|
||||
|
||||
|
||||
***********
|
||||
@@ -80,7 +80,7 @@ Python News
|
||||
Python News is the news section in the official Python web site
|
||||
(www.python.org). It briefly highlights the news from the Python community.
|
||||
|
||||
`Python News <http://www.python.org/news/>`_
|
||||
`Python News <http://www.python.org/blogs/>`_
|
||||
|
||||
|
||||
********************
|
||||
|
||||
@@ -30,5 +30,5 @@ 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/
|
||||
.. _GitHub: https://github.com/kennethreitz/python-guide/
|
||||
.. _todo: https://github.com/kennethreitz/python-guide/blob/master/TODO.rst
|
||||
|
||||
@@ -109,7 +109,10 @@ Command line examples:
|
||||
$ run command --help
|
||||
$ ls ..
|
||||
|
||||
Be sure to include the ``$`` prefix before each line.
|
||||
Be sure to include the ``$`` prefix before each line for Unix console examples.
|
||||
|
||||
For Windows console examples, use ``doscon`` or ``powershell`` instead of
|
||||
``console``, and omit the ``$`` prefix.
|
||||
|
||||
Python interpreter examples:
|
||||
|
||||
|
||||
@@ -392,10 +392,11 @@ Buildout
|
||||
|
||||
`Buildout <http://www.buildout.org>`_ is an open source software build tool.
|
||||
Buildout is created using the Python programming language. It implements a
|
||||
principle of separation of configuration from the scripts that do the setting up.
|
||||
Buildout is primarily used to download and set up dependencies in Python eggs
|
||||
format of the software being developed or deployed. Recipes for build tasks in any
|
||||
environment can be created, and many are already available.
|
||||
principle of separation of configuration from the scripts that do the setting
|
||||
up. Buildout is primarily used to download and set up dependencies in `Python
|
||||
eggs <https://stackoverflow.com/questions/2051192/what-is-a-python-egg>`_
|
||||
format of the software being developed or deployed. Recipes for build tasks in
|
||||
any environment can be created, and many are already available.
|
||||
|
||||
|
||||
*******
|
||||
|
||||
+18
-19
@@ -5,13 +5,12 @@ Command-line Applications
|
||||
|
||||
.. image:: /_static/photos/34435690330_11930b5987_k_d.jpg
|
||||
|
||||
Command-line applications, also referred to as
|
||||
`Console Applications <http://en.wikipedia.org/wiki/Console_application>`_,
|
||||
are computer programs designed to be used from a text interface, such as a
|
||||
`shell <http://en.wikipedia.org/wiki/Shell_(computing)>`_. Command-line
|
||||
applications usually accept various inputs as arguments, often referred to as
|
||||
parameters or sub-commands, as well as options, often referred to as flags or
|
||||
switches.
|
||||
Command-line applications, also referred to as `Console Applications
|
||||
<http://en.wikipedia.org/wiki/Console_application>`_, are computer programs
|
||||
designed to be used from a text interface, such as a `shell
|
||||
<http://en.wikipedia.org/wiki/Shell_(computing)>`_. Command-line applications
|
||||
usually accept various inputs as arguments, often referred to as parameters or
|
||||
sub-commands, as well as options, often referred to as flags or switches.
|
||||
|
||||
Some popular command-line applications include:
|
||||
|
||||
@@ -29,9 +28,9 @@ Click
|
||||
*****
|
||||
|
||||
`click <http://click.pocoo.org/>`_ is a Python package for creating
|
||||
command-line interfaces in a composable way with as little code as
|
||||
possible. This “Command-Line Interface Creation Kit” is highly
|
||||
configurable but comes with good defaults out of the box.
|
||||
command-line interfaces in a composable way with as little code as possible.
|
||||
This “Command-Line Interface Creation Kit” is highly configurable but comes
|
||||
with good defaults out of the box.
|
||||
|
||||
|
||||
******
|
||||
@@ -47,11 +46,11 @@ POSIX-style usage instructions.
|
||||
Plac
|
||||
****
|
||||
|
||||
`Plac <https://pypi.python.org/pypi/plac>`_ is a simple wrapper
|
||||
`Plac <https://pypi.org/project/plac>`_ is a simple wrapper
|
||||
over the Python standard library `argparse <http://docs.python.org/2/library/argparse.html>`_,
|
||||
which hides most of its complexity by using a declarative interface: the
|
||||
argument parser is inferred rather than written down by imperatively. This
|
||||
module targets especially unsophisticated users, programmers, sysadmins,
|
||||
argument parser is inferred rather than written down imperatively. This
|
||||
module targets unsophisticated users, programmers, sysadmins,
|
||||
scientists, and in general people writing throw-away scripts for themselves,
|
||||
who choose to create a command-line interface because it is quick and simple.
|
||||
|
||||
@@ -72,12 +71,12 @@ sub-command to do the work.
|
||||
Cement
|
||||
******
|
||||
|
||||
`Cement <http://builtoncement.com/>`_ is an advanced CLI Application Framework.
|
||||
Its goal is to introduce a standard and feature-full platform
|
||||
for both simple and complex command line applications as well
|
||||
as support rapid development needs without sacrificing quality.
|
||||
Cement is flexible, and its use cases span from the simplicity of a micro-framework
|
||||
to the complexity of a mega-framework.
|
||||
`Cement <http://builtoncement.com/>`_ is an advanced CLI Application
|
||||
Framework. Its goal is to introduce a standard and feature-full platform for
|
||||
both simple and complex command line applications as well as support rapid
|
||||
development needs without sacrificing quality. Cement is flexible, and its use
|
||||
cases span from the simplicity of a micro-framework to the complexity of a
|
||||
mega-framework.
|
||||
|
||||
|
||||
***********
|
||||
|
||||
@@ -12,9 +12,9 @@ C Foreign Function Interface
|
||||
|
||||
`CFFI <https://cffi.readthedocs.io/en/latest/>`_ provides a simple to use
|
||||
mechanism for interfacing with C from both CPython and PyPy. It supports two
|
||||
modes: an inline ABI compatibility mode (example provided below), which allows
|
||||
modes: an inline `ABI <https://stackoverflow.com/questions/2171177/what-is-an-application-binary-interface-abi>`_ compatibility mode (example provided below), which allows
|
||||
you to dynamically load and run functions from executable modules (essentially
|
||||
exposing the same functionality as LoadLibrary or dlopen), and an API mode,
|
||||
exposing the same functionality as `LoadLibrary <https://docs.microsoft.com/en-us/windows/desktop/api/libloaderapi/nf-libloaderapi-loadlibrarya>`_ or `dlopen <https://www.tldp.org/HOWTO/C++-dlopen/index.html>`_), and an API mode,
|
||||
which allows you to build C extension modules.
|
||||
|
||||
ABI Interaction
|
||||
@@ -41,13 +41,13 @@ library for interfacing with C/C++ from CPython, and it provides not only
|
||||
full access to the native C interface of most major operating systems (e.g.,
|
||||
kernel32 on Windows, or libc on \*nix), but also provides support for loading
|
||||
and interfacing with dynamic libraries, such as DLLs or shared objects, at
|
||||
runtime. It does bring along with it a whole host of types for interacting
|
||||
runtime. It brings along with it a whole host of types for interacting
|
||||
with system APIs, and allows you to rather easily define your own complex
|
||||
types, such as structs and unions, and allows you to modify things such as
|
||||
padding and alignment, if needed. It can be a bit crufty to use, but in
|
||||
conjunction with the `struct <https://docs.python.org/3.5/library/struct.html>`_
|
||||
conjunction with the `struct <https://docs.python.org/3/library/struct.html>`_
|
||||
module, you are essentially provided full control over how your data types get
|
||||
translated into something usable by a pure C(++) method.
|
||||
translated into something usable by a pure C/C++ method.
|
||||
|
||||
Struct Equivalents
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -29,7 +29,7 @@ pooling are 100% automatic, powered by urllib3, which is embedded within
|
||||
Requests.
|
||||
|
||||
- `Documentation <http://docs.python-requests.org/en/latest/index.html>`_
|
||||
- `PyPi <http://pypi.python.org/pypi/requests>`_
|
||||
- `PyPi <http://pypi.org/project/requests>`_
|
||||
- `GitHub <https://github.com/kennethreitz/requests>`_
|
||||
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ Also included is a command-line tool for exporting SQL data.
|
||||
Django ORM
|
||||
**********
|
||||
|
||||
The Django ORM is the interface used by `Django <http://www.djangoproject.com>`_
|
||||
The Django ORM is the interface used by `Django <https://www.djangoproject.com>`_
|
||||
to provide database access.
|
||||
|
||||
It's based on the idea of
|
||||
|
||||
+38
-37
@@ -14,8 +14,8 @@ Camelot
|
||||
*******
|
||||
|
||||
`Camelot <http://www.python-camelot.com>`_ provides components for building
|
||||
applications on top of Python, SQLAlchemy, and Qt. It is inspired by
|
||||
the Django admin interface.
|
||||
applications on top of Python, SQLAlchemy, and Qt. It is inspired by the Django
|
||||
admin interface.
|
||||
|
||||
The main resource for information is the website:
|
||||
http://www.python-camelot.com
|
||||
@@ -33,19 +33,17 @@ Cocoa
|
||||
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 currently supports the Gtk-2.X API (NOT Gtk-3.0). It is currently
|
||||
recommended that PyGTK not be used for new projects and that existing
|
||||
applications be ported from PyGTK to PyGObject.
|
||||
.. note:: PyGTK provides Python bindings for the GTK+ toolkit. However, it has been superseded by PyGObject. PyGTK should not be used for new projects and existing projects should be ported to PyGObject.
|
||||
|
||||
|
||||
********************
|
||||
PyGObject aka (PyGi)
|
||||
********************
|
||||
|
||||
`PyGObject <https://wiki.gnome.org/Projects/PyGObject>`_ provides Python bindings which gives access to the entire GNOME software platform.
|
||||
It is fully compatible with GTK+ 3. Here is a tutorial to get started with `Python GTK+ 3 Tutorial <https://python-gtk-3-tutorial.readthedocs.io/en/latest/>`_.
|
||||
`PyGObject <https://wiki.gnome.org/Projects/PyGObject>`_ provides Python
|
||||
bindings which gives access to the entire GNOME software platform. It is fully
|
||||
compatible with GTK+ 3. Here is a tutorial to get started with `Python GTK+ 3
|
||||
Tutorial <https://python-gtk-3-tutorial.readthedocs.io/en/latest/>`_.
|
||||
|
||||
`API Reference <http://lazka.github.io/pgi-docs/>`_
|
||||
|
||||
@@ -56,8 +54,8 @@ Kivy
|
||||
|
||||
`Kivy <http://kivy.org>`_ is a Python library for development of multi-touch
|
||||
enabled media rich applications. The aim is to allow for quick and easy
|
||||
interaction design and rapid prototyping, while making your code reusable
|
||||
and deployable.
|
||||
interaction design and rapid prototyping, while making your code reusable and
|
||||
deployable.
|
||||
|
||||
Kivy is written in Python, based on OpenGL, and supports different input devices
|
||||
such as: Mouse, Dual Mouse, TUIO, WiiMote, WM_TOUCH, HIDtouch, Apple's products,
|
||||
@@ -101,52 +99,55 @@ http://www.riverbankcomputing.co.uk/software/pyqt/download
|
||||
|
||||
|
||||
*****************************
|
||||
PyjamasDesktop (pyjs Desktop)
|
||||
Pyjs Desktop (formerly Pyjamas Desktop)
|
||||
*****************************
|
||||
|
||||
PyjamasDesktop is a port of Pyjamas. PyjamasDesktop is application widget set
|
||||
for desktop and a cross-platform framework. (After release v0.6 PyjamasDesktop
|
||||
is a part of Pyjamas (Pyjs)). Briefly, it allows the exact same Python web
|
||||
application source code to be executed as a standalone desktop application.
|
||||
Pyjs Desktop is a application widget set for desktop and a cross-platform
|
||||
framework. It allows the exact same Python web application source code to be
|
||||
executed as a standalone desktop application.
|
||||
|
||||
`Python Wiki for PyjamasDesktop <http://wiki.python.org/moin/PyjamasDesktop>`_.
|
||||
|
||||
The main website: `pyjs Desktop <http://pyjs.org/>`_.
|
||||
The main website: `pyjs <http://pyjs.org/>`_.
|
||||
|
||||
|
||||
**
|
||||
Qt
|
||||
**
|
||||
|
||||
`Qt <http://qt-project.org/>`_ is a cross-platform application framework that
|
||||
is widely used for developing software with a GUI but can also be used for
|
||||
non-GUI applications.
|
||||
`Qt <http://qt-project.org/>`_ is a cross-platform application framework that is
|
||||
widely used for developing software with a GUI but can also be used for non-GUI
|
||||
applications.
|
||||
|
||||
|
||||
***********
|
||||
PySimpleGUI
|
||||
***********
|
||||
|
||||
`PySimpleGUI <https://pysimplegui.readthedocs.io/>`_ is a wrapper for Tkinter and Qt (others on the way). The amount of code required to implement custom GUIs is much shorter using PySimpleGUI than if the same GUI were written directly using Tkinter or Qt. PySimpleGUI code can be "ported" between GUI frameworks by changing import statements.
|
||||
`PySimpleGUI <https://pysimplegui.readthedocs.io/>`_ is a wrapper for Tkinter
|
||||
and Qt (others on the way). The amount of code required to implement custom
|
||||
GUIs is much shorter using PySimpleGUI than if the same GUI were written
|
||||
directly using Tkinter or Qt. PySimpleGUI code can be "ported" between GUI
|
||||
frameworks by changing import statements.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ pip install pysimplegui
|
||||
|
||||
PySimpleGUI is contained in a single PySimpleGUI.py file. Should pip installation be impossible, copying the PySimpleGUI.py file into a project's folder is all that's required to import and begin using.
|
||||
PySimpleGUI is contained in a single PySimpleGUI.py file. Should pip
|
||||
installation be impossible, copying the PySimpleGUI.py file into a project's
|
||||
folder is all that's required to import and begin using.
|
||||
|
||||
|
||||
****
|
||||
Toga
|
||||
****
|
||||
|
||||
`Toga <https://toga.readthedocs.io/en/latest/>`_ is a Python native, OS
|
||||
native, cross platform GUI toolkit. Toga consists of a library of base
|
||||
components with a shared interface to simplify platform-agnostic GUI
|
||||
development.
|
||||
`Toga <https://toga.readthedocs.io/en/latest/>`_ is a Python native, OS native,
|
||||
cross platform GUI toolkit. Toga consists of a library of base components with a
|
||||
shared interface to simplify platform-agnostic GUI development.
|
||||
|
||||
Toga is available on mOS, Windows, Linux (GTK), and mobile platforms such
|
||||
as Android and iOS.
|
||||
Toga is available on mOS, Windows, Linux (GTK), and mobile platforms such as
|
||||
Android and iOS.
|
||||
|
||||
|
||||
**
|
||||
@@ -161,8 +162,8 @@ 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 <http://www.tkdocs.com/tutorial/index.html>`_. There's more information
|
||||
There's a good multi-language Tk tutorial with Python examples at `TkDocs
|
||||
<http://www.tkdocs.com/tutorial/index.html>`_. There's more information
|
||||
available on the `Python Wiki <http://wiki.python.org/moin/TkInter>`_.
|
||||
|
||||
|
||||
@@ -170,12 +171,12 @@ available on the `Python Wiki <http://wiki.python.org/moin/TkInter>`_.
|
||||
wxPython
|
||||
********
|
||||
|
||||
wxPython is a GUI toolkit for the Python programming language. It allows
|
||||
Python programmers to create programs with a robust, highly functional
|
||||
graphical user interface, simply and easily. It is implemented as a Python
|
||||
extension module (native code) that wraps the popular wxWidgets cross platform
|
||||
GUI library, which is written in C++.
|
||||
wxPython is a GUI toolkit for the Python programming language. It allows Python
|
||||
programmers to create programs with a robust, highly functional graphical user
|
||||
interface, simply and easily. It is implemented as a Python extension module
|
||||
(native code) that wraps the popular wxWidgets cross platform GUI library, which
|
||||
is written in C++.
|
||||
|
||||
**Install (Stable) wxPython**
|
||||
*go to http://www.wxpython.org/download.php#stable and download the appropriate
|
||||
*go to https://www.wxpython.org/pages/downloads/ and download the appropriate
|
||||
package for your OS.*
|
||||
|
||||
@@ -10,19 +10,19 @@ Networking
|
||||
Twisted
|
||||
*******
|
||||
|
||||
`Twisted <http://twistedmatrix.com/trac/>`_ is an event-driven networking
|
||||
`Twisted <https://twistedmatrix.com/trac/>`_ is an event-driven networking
|
||||
engine. It can be used to build applications around many different networking
|
||||
protocols, including HTTP servers and clients, applications using SMTP, POP3,
|
||||
IMAP, or SSH protocols, instant messaging,
|
||||
and `much more <http://twistedmatrix.com/trac/wiki/Documentation>`_.
|
||||
and `much more <https://twistedmatrix.com/trac/wiki/Documentation>`_.
|
||||
|
||||
|
||||
*****
|
||||
PyZMQ
|
||||
*****
|
||||
|
||||
`PyZMQ <http://zeromq.github.com/pyzmq/>`_ is the Python binding for
|
||||
`ZeroMQ <http://www.zeromq.org/>`_, which is a high-performance asynchronous
|
||||
`PyZMQ <https://zeromq.github.com/pyzmq/>`_ is the Python binding for
|
||||
`ZeroMQ <http://zeromq.org/>`_, which is a high-performance asynchronous
|
||||
messaging library. One great advantage of ZeroMQ is that it can be used for
|
||||
message queuing without a message broker. The basic patterns for this are:
|
||||
|
||||
|
||||
@@ -91,13 +91,24 @@ are available in the `matplotlib gallery
|
||||
Pandas
|
||||
------
|
||||
|
||||
`Pandas <http://pandas.pydata.org/>`_ is data manipulation library
|
||||
`Pandas <http://pandas.pydata.org/>`_ is a data manipulation library
|
||||
based on NumPy which provides many useful functions for accessing,
|
||||
indexing, merging, and grouping data easily. The main data structure (DataFrame)
|
||||
is close to what could be found in the R statistical package; that is,
|
||||
heterogeneous data tables with name indexing, time series operations, and
|
||||
auto-alignment of data.
|
||||
|
||||
xarray
|
||||
------
|
||||
|
||||
`xarray <http://xarray.pydata.org/en/stable/>`_ is similar to Pandas, but it
|
||||
is intended for wrapping multidimensional scientific data. By labelling the
|
||||
data with dimensions, coordinates, and attributes, it makes complex
|
||||
multidimensional operations clearer and more intuitive. It also wraps
|
||||
matplotlib for quick plotting, and can apply most operations in parallel using
|
||||
`dask <http://xarray.pydata.org/en/stable/dask.html>`_.
|
||||
|
||||
|
||||
Rpy2
|
||||
----
|
||||
|
||||
@@ -149,7 +160,7 @@ add-ons are available for academics and researchers.
|
||||
Canopy
|
||||
------
|
||||
|
||||
`Canopy <https://www.enthought.com/products/canopy/>`_ is another scientific
|
||||
`Canopy <https://www.enthought.com/product/canopy/>`_ is another scientific
|
||||
Python distribution, produced by `Enthought <https://www.enthought.com/>`_.
|
||||
A limited 'Canopy Express' variant is available for free, but Enthought
|
||||
charges for the full distribution. Free licenses are available for academics.
|
||||
|
||||
@@ -76,7 +76,7 @@ C Extensions
|
||||
Cython
|
||||
------
|
||||
|
||||
`Cython <http://cython.org/>`_ implements a superset of the Python language
|
||||
`Cython <https://cython.org/>`_ implements a superset of the Python language
|
||||
with which you are able to write C and C++ modules for Python. Cython also
|
||||
allows you to call functions from compiled C libraries. Using Cython allows
|
||||
you to take advantage of Python's strong typing of variables and operations.
|
||||
@@ -448,14 +448,14 @@ Multiprocessing
|
||||
|
||||
|
||||
.. _`PyPy`: http://pypy.org
|
||||
.. _`The GIL`: http://wiki.python.org/moin/GlobalInterpreterLock
|
||||
.. _`The GIL`: https://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
|
||||
.. _`Special care`: https://docs.python.org/c-api/init.html#threads
|
||||
.. _`David Beazley's`: http://www.dabeaz.com/GIL/gilvis/measure2.py
|
||||
.. _`concurrent.futures`: https://docs.python.org/3/library/concurrent.futures.html
|
||||
.. _`Future`: https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future
|
||||
.. _`threading`: https://docs.python.org/3/library/threading.html
|
||||
.. _`stackoverflow post`: http://stackoverflow.com/questions/26688424/python-threads-are-printing-at-the-same-time-messing-up-the-text-output
|
||||
.. _`stackoverflow post`: https://stackoverflow.com/questions/26688424/python-threads-are-printing-at-the-same-time-messing-up-the-text-output
|
||||
.. _`data race`: https://en.wikipedia.org/wiki/Race_condition
|
||||
.. _`Lock`: https://docs.python.org/3/library/threading.html#lock-objects
|
||||
|
||||
@@ -43,7 +43,7 @@ untangle also supports loading XML from a string or a URL.
|
||||
xmltodict
|
||||
*********
|
||||
|
||||
`xmltodict <http://github.com/martinblech/xmltodict>`_ is another simple
|
||||
`xmltodict <https://github.com/martinblech/xmltodict>`_ is another simple
|
||||
library that aims at making XML feel like working with JSON.
|
||||
|
||||
An XML file like this:
|
||||
|
||||
@@ -61,7 +61,7 @@ py2app no no yes yes MIT no yes yes
|
||||
.. note::
|
||||
Freezing Python code on Linux into a Windows executable was only once
|
||||
supported in PyInstaller `and later dropped
|
||||
<http://stackoverflow.com/questions/2950971/cross-compiling-a-python-script-on-linux-into-a-windows-executable#comment11890276_2951046>`_.
|
||||
<https://stackoverflow.com/questions/2950971/cross-compiling-a-python-script-on-linux-into-a-windows-executable#comment11890276_2951046>`_.
|
||||
|
||||
.. note::
|
||||
All solutions need a Microsoft Visual C++ to be installed on the target machine, except py2app.
|
||||
@@ -139,7 +139,7 @@ Prerequisite is to install :ref:`Python on Windows <install-windows>`. The last
|
||||
|
||||
3. (Optionally) `include icon <http://www.py2exe.org/index.cgi/CustomIcons>`_
|
||||
|
||||
4. (Optionally) `one-file mode <http://stackoverflow.com/questions/112698/py2exe-generate-single-executable-file#113014>`_
|
||||
4. (Optionally) `one-file mode <https://stackoverflow.com/questions/112698/py2exe-generate-single-executable-file#113014>`_
|
||||
|
||||
5. Generate :file:`.exe` into :file:`dist` directory:
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ On Linux, you may also want to consider
|
||||
For Python Developers
|
||||
*********************
|
||||
|
||||
If you're writing an open source Python module, `PyPI <http://pypi.python.org>`_
|
||||
If you're writing an open source Python module, `PyPI <http://pypi.org>`_
|
||||
, more properly known as *The Cheeseshop*, is the place to host it.
|
||||
|
||||
|
||||
@@ -56,8 +56,8 @@ If you're writing an open source Python module, `PyPI <http://pypi.python.org>`_
|
||||
Pip vs. easy_install
|
||||
--------------------
|
||||
|
||||
Use `pip <http://pypi.python.org/pypi/pip>`_. More details
|
||||
`here <http://stackoverflow.com/questions/3220404/why-use-pip-over-easy-install>`_.
|
||||
Use `pip <http://pypi.org/project/pip>`_. More details
|
||||
`here <https://stackoverflow.com/questions/3220404/why-use-pip-over-easy-install>`_.
|
||||
|
||||
|
||||
Personal PyPI
|
||||
@@ -105,7 +105,7 @@ I got fooled by that, one time. But if you feel that creating a folder called
|
||||
pypiserver
|
||||
++++++++++
|
||||
|
||||
`pypiserver <https://pypi.python.org/pypi/pypiserver>`_ is a minimal PyPI
|
||||
`pypiserver <https://pypi.org/project/pypiserver>`_ is a minimal PyPI
|
||||
compatible server. It can be used to serve a set of packages to easy_install
|
||||
or pip. It includes helpful features like an administrative command
|
||||
(``-U``) which will update all its packages to their latest versions
|
||||
|
||||
@@ -38,7 +38,7 @@ it makes it much easier for you to use other third-party Python libraries.
|
||||
Setuptools & Pip
|
||||
****************
|
||||
|
||||
The two most crucial third-party Python packages are `setuptools <https://pypi.python.org/pypi/setuptools>`_ and `pip <https://pip.pypa.io/en/stable/>`_.
|
||||
The two most crucial third-party Python packages are `setuptools <https://pypi.org/project/setuptools>`_ and `pip <https://pip.pypa.io/en/stable/>`_.
|
||||
|
||||
Once installed, you can download, install and uninstall any compliant Python software
|
||||
product with a single command. It also enables you to add this network installation
|
||||
@@ -75,6 +75,5 @@ manage your virtual environments.
|
||||
|
||||
--------------------------------
|
||||
|
||||
This page is a remixed version of `another guide <http://www.stuartellis.eu/articles/python-development-windows/>`_,
|
||||
This page is a remixed version of `another guide <https://www.stuartellis.name/articles/python-development-windows/>`_,
|
||||
which is available under the same license.
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ Installing Python 2 on Mac OS X
|
||||
.. note::
|
||||
Check out our :ref:`guide for installing Python 3 on OS X<install3-osx>`.
|
||||
|
||||
The latest version of Mac OS X, High Sierra, **comes with Python 2.7 out of the box**.
|
||||
**Mac OS X comes with Python 2.7 out of the box.**
|
||||
|
||||
You do not need to install or configure anything else to use Python. Having said
|
||||
that, I would strongly recommend that you install the tools and libraries
|
||||
@@ -33,7 +33,7 @@ Let's install a real version of Python.
|
||||
Before installing Python, you'll need to install a C compiler. The fastest way
|
||||
is to install the Xcode Command Line Tools by running
|
||||
``xcode-select --install``. You can also download the full version of
|
||||
`Xcode <http://developer.apple.com/xcode/>`_ from the Mac App Store, or the
|
||||
`Xcode <https://developer.apple.com/xcode/>`_ from the Mac App Store, or the
|
||||
minimal but unofficial
|
||||
`OSX-GCC-Installer <https://github.com/kennethreitz/osx-gcc-installer#readme>`_
|
||||
package.
|
||||
@@ -50,9 +50,9 @@ package.
|
||||
|
||||
While OS X comes with a large number of Unix utilities, those familiar with
|
||||
Linux systems will notice one key component missing: a decent package manager.
|
||||
`Homebrew <http://brew.sh>`_ fills this void.
|
||||
`Homebrew <https://brew.sh>`_ fills this void.
|
||||
|
||||
To `install Homebrew <http://brew.sh/#install>`_, open :file:`Terminal` or
|
||||
To `install Homebrew <https://brew.sh/#install>`_, open :file:`Terminal` or
|
||||
your favorite OS X terminal emulator and run
|
||||
|
||||
.. code-block:: console
|
||||
@@ -129,5 +129,5 @@ To start using this and see more information: :ref:`Virtual Environments <virtua
|
||||
|
||||
--------------------------------
|
||||
|
||||
This page is a remixed version of `another guide <http://www.stuartellis.eu/articles/python-development-windows/>`_,
|
||||
This page is a remixed version of `another guide <https://www.stuartellis.name/articles/python-development-windows/>`_,
|
||||
which is available under the same license.
|
||||
|
||||
@@ -13,7 +13,7 @@ Installing Python 2 on Windows
|
||||
First, download the `latest version <https://www.python.org/ftp/python/2.7.15/python-2.7.15.msi>`_
|
||||
of Python 2.7 from the official website. If you want to be sure you are installing a fully
|
||||
up-to-date version, click the Downloads > Windows link from the home page of the
|
||||
`Python.org web site <http://python.org>`_ .
|
||||
`Python.org web site <https://python.org>`_ .
|
||||
|
||||
The Windows version is provided as an MSI package. To install it manually, just
|
||||
double-click the file. The MSI package format allows Windows administrators to
|
||||
@@ -32,13 +32,13 @@ tedious, so add the directories for your default Python version to the :envvar:`
|
||||
Assuming that your Python installation is in :file:`C:\\Python27\\`, add this to your
|
||||
:envvar:`PATH`:
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: doscon
|
||||
|
||||
C:\Python27\;C:\Python27\Scripts\
|
||||
|
||||
You can do this easily by running the following in ``powershell``:
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: powershell
|
||||
|
||||
[Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27\;C:\Python27\Scripts\", "User")
|
||||
|
||||
@@ -57,7 +57,7 @@ makes it much easier for you to use other third-party Python libraries.
|
||||
Setuptools + Pip
|
||||
****************
|
||||
|
||||
The two most crucial third-party Python packages are `setuptools <https://pypi.python.org/pypi/setuptools>`_ and `pip <https://pip.pypa.io/en/stable/>`_.
|
||||
The two most crucial third-party Python packages are `setuptools <https://pypi.org/project/setuptools>`_ and `pip <https://pip.pypa.io/en/stable/>`_.
|
||||
|
||||
Once installed, you can download, install and uninstall any compliant Python software
|
||||
product with a single command. It also enables you to add this network installation
|
||||
@@ -68,9 +68,9 @@ pip by default.
|
||||
|
||||
To see if pip is installed, open a command prompt and run
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: doscon
|
||||
|
||||
$ command -v pip
|
||||
command -v pip
|
||||
|
||||
To install pip, `follow the official pip installation guide <https://pip.pypa.io/en/latest/installing/>`_ - this will automatically install the latest version of setuptools.
|
||||
|
||||
@@ -92,5 +92,5 @@ To start using this and see more information: :ref:`Virtual Environments <virtua
|
||||
|
||||
--------------------------------
|
||||
|
||||
This page is a remixed version of `another guide <http://www.stuartellis.eu/articles/python-development-windows/>`_,
|
||||
This page is a remixed version of `another guide <https://www.stuartellis.name/articles/python-development-windows/>`_,
|
||||
which is available under the same license.
|
||||
|
||||
@@ -67,7 +67,7 @@ This will launch the Python 3 interpreter.
|
||||
Setuptools & Pip
|
||||
****************
|
||||
|
||||
The two most crucial third-party Python packages are `setuptools <https://pypi.python.org/pypi/setuptools>`_ and `pip <https://pip.pypa.io/en/stable/>`_.
|
||||
The two most crucial third-party Python packages are `setuptools <https://pypi.org/project/setuptools>`_ and `pip <https://pip.pypa.io/en/stable/>`_.
|
||||
|
||||
Once installed, you can download, install and uninstall any compliant Python software
|
||||
product with a single command. It also enables you to add this network installation
|
||||
@@ -113,6 +113,5 @@ So, onward! To the :ref:`Pipenv & Virtual Environments <virtualenvironments-ref>
|
||||
|
||||
--------------------------------
|
||||
|
||||
This page is a remixed version of `another guide <http://www.stuartellis.eu/articles/python-development-windows/>`_,
|
||||
This page is a remixed version of `another guide <https://www.stuartellis.name/articles/python-development-windows/>`_,
|
||||
which is available under the same license.
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ Installing Python 3 on Mac OS X
|
||||
|
||||
.. image:: /_static/photos/34435689480_2e6f358510_k_d.jpg
|
||||
|
||||
The latest version of Mac OS X, High Sierra, **comes with Python 2.7 out of the box**.
|
||||
**Mac OS X comes with Python 2.7 out of the box.**
|
||||
|
||||
You do not need to install or configure anything else to use Python 2. These
|
||||
instructions document the installation of Python 3.
|
||||
@@ -27,7 +27,7 @@ Doing it Right
|
||||
Let's install a real version of Python.
|
||||
|
||||
Before installing Python, you'll need to install GCC. GCC can be obtained
|
||||
by downloading `Xcode <http://developer.apple.com/xcode/>`_, the smaller
|
||||
by downloading `Xcode <https://developer.apple.com/xcode/>`_, the smaller
|
||||
`Command Line Tools <https://developer.apple.com/downloads/>`_ (must have an
|
||||
Apple account) or the even smaller `OSX-GCC-Installer <https://github.com/kennethreitz/osx-gcc-installer#readme>`_
|
||||
package.
|
||||
@@ -43,9 +43,9 @@ package.
|
||||
|
||||
While OS X comes with a large number of Unix utilities, those familiar with
|
||||
Linux systems will notice one key component missing: a package manager.
|
||||
`Homebrew <http://brew.sh>`_ fills this void.
|
||||
`Homebrew <https://brew.sh>`_ fills this void.
|
||||
|
||||
To `install Homebrew <http://brew.sh/#install>`_, open :file:`Terminal` or
|
||||
To `install Homebrew <https://brew.sh/#install>`_, open :file:`Terminal` or
|
||||
your favorite OS X terminal emulator and run
|
||||
|
||||
.. code-block:: console
|
||||
@@ -139,5 +139,5 @@ So, onward! To the :ref:`Pipenv & Virtual Environments <virtualenvironments-ref>
|
||||
|
||||
--------------------------------
|
||||
|
||||
This page is a remixed version of `another guide <http://www.stuartellis.eu/articles/python-development-windows/>`_,
|
||||
This page is a remixed version of `another guide <https://www.stuartellis.name/articles/python-development-windows/>`_,
|
||||
which is available under the same license.
|
||||
|
||||
@@ -12,7 +12,7 @@ It's a community system packager manager for Windows 7+. (It's very much like Ho
|
||||
|
||||
Once done, installing Python 3 is very simple, because Chocolatey pushes Python 3 as the default.
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: doscon
|
||||
|
||||
choco install python
|
||||
|
||||
@@ -24,12 +24,14 @@ Once you've run this command, you should be able to launch Python directly from
|
||||
Setuptools + Pip
|
||||
****************
|
||||
|
||||
The two most crucial third-party Python packages are `setuptools <https://pypi.python.org/pypi/setuptools>`_ and `pip <https://pip.pypa.io/en/stable/>`_,
|
||||
The two most crucial third-party Python packages are `setuptools <https://pypi.org/project/setuptools>`_ and `pip <https://pip.pypa.io/en/stable/>`_,
|
||||
which let you download, install and uninstall any compliant Python software
|
||||
product with a single command. It also enables you to add this network installation
|
||||
capability to your own Python software with very little work.
|
||||
|
||||
All supported versions of Python 3 include pip, so just make sure it's up to date::
|
||||
All supported versions of Python 3 include pip, so just make sure it's up to date:
|
||||
|
||||
.. code-block:: doscon
|
||||
|
||||
python -m pip install -U pip
|
||||
|
||||
@@ -52,5 +54,5 @@ So, onward! To the :ref:`Pipenv & Virtual Environments <virtualenvironments-ref>
|
||||
|
||||
--------------------------------
|
||||
|
||||
This page is a remixed version of `another guide <http://www.stuartellis.eu/articles/python-development-windows/>`_,
|
||||
This page is a remixed version of `another guide <https://www.stuartellis.name/articles/python-development-windows/>`_,
|
||||
which is available under the same license.
|
||||
|
||||
@@ -70,9 +70,9 @@ this in your ``__init__.py``:
|
||||
Logging in an Application
|
||||
*************************
|
||||
|
||||
The `twelve factor app <http://12factor.net>`_, an authoritative reference
|
||||
The `twelve factor app <https://12factor.net>`_, an authoritative reference
|
||||
for good practice in application development, contains a section on
|
||||
`logging best practice <http://12factor.net/logs>`_. It emphatically
|
||||
`logging best practice <https://12factor.net/logs>`_. It emphatically
|
||||
advocates for treating log events as an event stream, and for
|
||||
sending that event stream to standard output to be handled by the
|
||||
application environment.
|
||||
@@ -192,9 +192,9 @@ Example Configuration Directly in Code
|
||||
logger.debug('often makes a very good meal of %s', 'visiting tourists')
|
||||
|
||||
|
||||
.. _basic logging tutorial: http://docs.python.org/howto/logging.html#logging-basic-tutorial
|
||||
.. _logging configuration: https://docs.python.org/howto/logging.html#configuring-logging
|
||||
.. _logging tutorial: http://docs.python.org/howto/logging.html
|
||||
.. _configuring logging for a library: https://docs.python.org/howto/logging.html#configuring-logging-for-a-library
|
||||
.. _log record: https://docs.python.org/library/logging.html#logrecord-attributes
|
||||
.. _basic logging tutorial: http://docs.python.org/3/howto/logging.html#logging-basic-tutorial
|
||||
.. _logging configuration: https://docs.python.org/3/howto/logging.html#configuring-logging
|
||||
.. _logging tutorial: http://docs.python.org/3/howto/logging.html
|
||||
.. _configuring logging for a library: https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library
|
||||
.. _log record: https://docs.python.org/3/library/logging.html#logrecord-attributes
|
||||
.. _requests source: https://github.com/kennethreitz/requests
|
||||
|
||||
@@ -675,7 +675,7 @@ by the ``with`` statement. CustomOpen is first instantiated and then its
|
||||
is finished executing, the ``__exit__`` method is then called.
|
||||
|
||||
And now the generator approach using Python's own
|
||||
`contextlib <https://docs.python.org/2/library/contextlib.html>`_:
|
||||
`contextlib <https://docs.python.org/3/library/contextlib.html>`_:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -890,5 +890,5 @@ Runners
|
||||
Further Reading
|
||||
***************
|
||||
|
||||
- http://docs.python.org/2/library/
|
||||
- http://www.diveintopython.net/toc/index.html
|
||||
- http://docs.python.org/3/library/
|
||||
- https://www.diveinto.org/python3/
|
||||
|
||||
@@ -271,7 +271,7 @@ Idioms
|
||||
|
||||
A programming idiom, put simply, is a *way* to write code. The notion of
|
||||
programming idioms is discussed amply at `c2 <http://c2.com/cgi/wiki?ProgrammingIdiom>`_
|
||||
and at `Stack Overflow <http://stackoverflow.com/questions/302459/what-is-a-programming-idiom>`_.
|
||||
and at `Stack Overflow <https://stackoverflow.com/questions/302459/what-is-a-programming-idiom>`_.
|
||||
|
||||
Idiomatic Python code is often referred to as being *Pythonic*.
|
||||
|
||||
@@ -403,7 +403,7 @@ hand, the hash of the item will tell Python where in the set to look for
|
||||
a matching item. As a result, the search can be done quickly, even if the
|
||||
set is large. Searching in dictionaries works the same way. For
|
||||
more information see this
|
||||
`StackOverflow <http://stackoverflow.com/questions/513882/python-list-vs-dict-for-look-up-table>`_
|
||||
`StackOverflow <https://stackoverflow.com/questions/513882/python-list-vs-dict-for-look-up-table>`_
|
||||
page. For detailed information on the amount of time various common operations
|
||||
take on each of these data structures, see
|
||||
`this page <https://wiki.python.org/moin/TimeComplexity?>`_.
|
||||
@@ -496,7 +496,7 @@ Then run it on a file or series of files to get a report of any violations.
|
||||
optparse.py:472:29: E221 multiple spaces before operator
|
||||
optparse.py:544:21: W601 .has_key() is deprecated, use 'in'
|
||||
|
||||
The program `autopep8 <https://pypi.python.org/pypi/autopep8/>`_ can be used to
|
||||
The program `autopep8 <https://pypi.org/project/autopep8/>`_ can be used to
|
||||
automatically reformat code in the PEP 8 style. Install the program with:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
@@ -274,7 +274,7 @@ 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 <http://pypi.python.org/pypi/unittest2>`_
|
||||
`unittest2 <http://pypi.org/project/unittest2>`_
|
||||
|
||||
|
||||
mock
|
||||
|
||||
Reference in New Issue
Block a user