Skip to content

Commit 6092a1a

Browse files
authored
Merge pull request realpython#867 from kennethreitz/master
Added in speed section
2 parents 4a7336f + d626196 commit 6092a1a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1105
-247
lines changed

CODE_OF_CONDUCT.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Be cordial or be on your way.
2+
3+
https://www.kennethreitz.org/essays/be-cordial-or-be-on-your-way

Readme.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ Hitchhiker's Guide to Python
33

44
**Python Best Practices Guidebook**
55

6+
.. image:: https://farm1.staticflickr.com/628/33173824932_58add34581_k_d.jpg
7+
68
-----------
79

810
**Work in progress. If you'd like to help, please do. There's a lot of work to
@@ -16,7 +18,7 @@ basis.
1618

1719
Topics include:
1820

19-
- Platform- and version-specific installations
21+
- Platform and version-specific installations
2022
- Py2app, Py2exe, bbfreeze, pyInstaller
2123
- Pip
2224
- Numpy, scipy, statpy, pyplot, matplotlib

docs/_static/ad.png

83.2 KB
Loading

docs/_templates/hacks.html

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
<!-- Alabaster (krTheme++) Hacks -->
2+
<aside id="python27">
3+
Python 3, the new best practice, is here to stay.
4+
Python 2 will retire in only <time></time> months!
5+
</aside>
6+
7+
<!-- Python 2 Death Clock™ -->
8+
<style type="text/css">
9+
body { margin-top: 4em; }
10+
#python27 {
11+
position: fixed;
12+
top: 0;
13+
left: 0; right: 0;
14+
height: auto;
15+
text-align: center;
16+
color: white;
17+
background-color: black;
18+
font-size: larger;
19+
line-height: 3;
20+
}
21+
22+
</style>
23+
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
24+
<script>
25+
var death = new Date('2020-04-12');
26+
27+
var diff = moment.duration(death - moment());
28+
29+
document.querySelector('#python27 time').innerText = (diff.years() * 12) + diff.months();
30+
</script>
31+
132
<script type="text/javascript">
233
var _gauges = _gauges || [];
334
(function() {

docs/_templates/sidebarintro.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ <h3>Stay Informed</h3>
1919
<p><a href="https://twitter.com/kennethreitz" class="twitter-follow-button" data-show-count="false">Follow @kennethreitz</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script></p>
2020

2121
<p><a href="http://tinyletter.com/kennethreitz">Join Mailing List</a>.</p>
22+
<p><a href="https://saythanks.io/to/kennethreitz">Say Thanks!</a></p>
23+
24+
<a href="http://www.dataquest.io/?utm_source=hitchhikersguide&utm_medium=ad">
25+
<img src="{{ pathto('_static/ad.png', 1) }}" alt="">
26+
</a>
27+
28+
<hr>
2229

2330
<h3>O'Reilly Book</h3>
2431

@@ -32,12 +39,15 @@ <h3>Other Projects</h3>
3239

3340
<p>More <a href="http://kennethreitz.org/">Kenneth Reitz</a> projects:</p>
3441
<ul>
42+
<li><a href="http://wsl-guide.org/">wsl-guide.org</a></li>
43+
<li><a href="http://edmsynths.com/">edmsynths.com</a></li>
44+
<li><a href="http://pipenv.org/">pipenv</a></li>
3545
<li><a href="http://pep8.org/">pep8.org</a></li>
3646
<li><a href="http://python-requests.org">Requests: HTTP for Humans</a></li>
47+
<li><a href="https://github.com/kennethreitz/maya">Maya: Datetimes for Humans</a></li>
3748
<li><a href="https://github.com/kennethreitz/records">Records: SQL for Humans</a></li>
3849
<li><a href="http://www.git-legit.org">Legit: Git for Humans</a></li>
3950
<li><a href="http://docs.python-tablib.org/en/latest/">Tablib: Tabular Datasets</a></li>
40-
<li><a href="http://markdownplease.com">Markdown, Please!</a></li>
4151
</ul>
4252

4353
<h3>Contributors</h3>
@@ -62,6 +72,7 @@ <h3>Translations</h3>
6272
<li><a href="http://docs.python-guide.org/en/latest/">English</a></li>
6373
<li><a href="https://python-guide-fr.readthedocs.io/fr/latest/">French</a></li>
6474
<li><a href="https://pythonguidecn.readthedocs.io/zh/latest/">Chinese</a></li>
65-
<li><a href="https://python-guide-ja.readthedocs.io/en/latest/">Japanese</a></li>
75+
<li><a href="http://python-guideja.readthedocs.io/ja/latest/">Japanese</a></li>
6676
<li><a href="https://python-guide-kr.readthedocs.io/ko/latest/">Korean</a></li>
77+
<li><a href="http://python-guide-pt-br.readthedocs.io/pt_BR/latest/">Brazilian Portuguese</a></li>
6778
</ul>

docs/_templates/sidebarlogo.html

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@ <h3>Get Updates</h3>
1616
allowtransparency="true" frameborder="0" scrolling="0" width="200" height="20"></iframe></p>
1717

1818
<p><a href="https://twitter.com/kennethreitz" class="twitter-follow-button" data-show-count="false">Follow @kennethreitz</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script></p>
19-
19+
<p><a href="https://saythanks.io/to/kennethreitz">Say Thanks!</a></p>
2020
<p><a href="http://tinyletter.com/kennethreitz">Join Mailing List</a>.</p>
2121

22+
<a href="http://www.dataquest.io/?utm_source=hitchhikersguide&utm_medium=ad">
23+
<img src="{{ pathto('_static/ad.png', 1) }}" alt="">
24+
</a>
25+
26+
<hr>
27+
2228
<h3>O'Reilly Book</h3>
2329

2430
<p>This guide is now available in tangible book form!</p>
@@ -27,23 +33,29 @@ <h3>O'Reilly Book</h3>
2733

2834
<p>All proceeds are being directly donated to the <a href="https://djangogirls.org">DjangoGirls</a> organization.</p>
2935

36+
37+
3038
<h3>Other Projects</h3>
3139

3240
<p>More <a href="http://kennethreitz.org/">Kenneth Reitz</a> projects:</p>
3341
<ul>
42+
<li><a href="http://wsl-guide.org/">wsl-guide.org</a></li>
43+
<li><a href="http://edmsynths.com/">edmsynths.com</a></li>
44+
<li><a href="http://pipenv.org/">pipenv</a></li>
3445
<li><a href="http://pep8.org/">pep8.org</a></li>
3546
<li><a href="http://python-requests.org">Requests: HTTP for Humans</a></li>
47+
<li><a href="https://github.com/kennethreitz/maya">Maya: Datetimes for Humans</a></li>
3648
<li><a href="https://github.com/kennethreitz/records">Records: SQL for Humans</a></li>
3749
<li><a href="http://www.git-legit.org">Legit: Git for Humans</a></li>
3850
<li><a href="http://docs.python-tablib.org/en/latest/">Tablib: Tabular Datasets</a></li>
39-
<li><a href="http://markdownplease.com">Markdown, Please!</a></li>
4051
</ul>
4152

4253
<h3>Translations</h3>
4354
<ul>
4455
<li><a href="http://docs.python-guide.org/en/latest/">English</a></li>
4556
<li><a href="https://python-guide-fr.readthedocs.io/fr/latest/">French</a></li>
4657
<li><a href="https://pythonguidecn.readthedocs.io/zh/latest/">Chinese</a></li>
47-
<li><a href="https://python-guide-ja.readthedocs.io/en/latest/">Japanese</a></li>
58+
<li><a href="http://python-guideja.readthedocs.io/ja/latest/">Japanese</a></li>
4859
<li><a href="https://python-guide-kr.readthedocs.io/ko/latest/">Korean</a></li>
60+
<li><a href="http://python-guide-pt-br.readthedocs.io/pt_BR/latest/">Brazilian Portuguese</a></li>
4961
</ul>

docs/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@
109109
'github_user': 'kennethreitz',
110110
'github_repo': 'python-guide',
111111
'github_banner': True,
112-
'show_related': False
112+
'show_related': False,
113+
'note_bg': '#FFF59C'
113114
}
114115

115116
# Add any paths that contain custom themes here, relative to this directory.

docs/contents.rst.inc

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,50 @@
11
Getting Started with Python
22
---------------------------
33

4-
New to Python? Let's properly setup up your Python environment.
4+
New to Python? Let's properly setup up your Python environment:
55
66
.. toctree::
77
:maxdepth: 2
88
99
starting/which-python
1010
11-
- Properly Install Python
11+
- Properly Install Python on your system:
1212
1313
.. toctree::
1414
:maxdepth: 1
1515
1616
starting/installation
17+
starting/install3/osx
18+
starting/install3/win
19+
starting/install3/linux
1720
starting/install/osx
1821
starting/install/win
1922
starting/install/linux
2023
2124
25+
- Using Virtualenvs with Pipenv:
26+
27+
.. toctree::
28+
:maxdepth: 2
29+
30+
dev/virtualenvs
31+
32+
33+
Python Development Environments
34+
-------------------------------
35+
36+
This part of the guide focus on the Python development environment,
37+
and the best-practice tools that are available for writing Python code.
38+
39+
.. toctree::
40+
:maxdepth: 2
41+
42+
dev/env
43+
dev/virtualenvs
44+
dev/pip-virtualenv
45+
46+
47+
2248
2349
Writing Great Python Code
2450
-------------------------
@@ -80,22 +106,6 @@ This part of the guide focuses on deploying your Python code.
80106
shipping/freezing
81107
82108
83-
Python Development Environments
84-
-------------------------------
85-
86-
This part of the guide focus on the Python development environment,
87-
and the best-practice tools that are available for writing Python code.
88-
89-
.. toctree::
90-
:maxdepth: 2
91-
92-
dev/env
93-
dev/virtualenvs
94-
dev/pip-virtualenv
95-
96-
97-
98-
99109
Additional Notes
100110
----------------
101111

docs/dev/env.rst

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Your Development Environment
22
============================
33

4+
.. image:: https://farm3.staticflickr.com/2930/33175624924_7febc46cc4_k_d.jpg
5+
46

57
Text Editors
68
::::::::::::
@@ -35,11 +37,11 @@ source files.
3537
There is also a handy syntax plugin called syntax_ featuring some improvements
3638
over the syntax file included in Vim 6.1.
3739

38-
These plugins supply you with a basic environment for developing in Python.
39-
To get the most out of Vim, you should continually check your code for syntax
40-
errors and PEP8 compliance. Luckily PEP8_ and Pyflakes_ will do this for you.
41-
If your Vim is compiled with :option:`+python` you can also utilize some very
42-
handy plugins to do these checks from within the editor.
40+
These plugins supply you with a basic environment for developing in Python. To
41+
get the most out of Vim, you should continually check your code for syntax
42+
errors and PEP8 compliance. Luckily pycodestyle_ and Pyflakes_ will do this
43+
for you. If your Vim is compiled with ``+python`` you can also utilize some
44+
very handy plugins to do these checks from within the editor.
4345

4446
For PEP8 checking and pyflakes, you can install vim-flake8_. Now you can map the
4547
function ``Flake8`` to any hotkey or action you want in Vim. The plugin will
@@ -68,12 +70,12 @@ Python-mode
6870
Python-mode_ is a complex solution for working with Python code in Vim.
6971
It has:
7072

71-
- Asynchronous Python code checking (``pylint``, ``pyflakes``, ``pep8``, ``mccabe``) in any combination
73+
- Asynchronous Python code checking (``pylint``, ``pyflakes``, ``pycodestyle``, ``mccabe``) in any combination
7274
- Code refactoring and autocompletion with Rope
7375
- Fast Python folding
7476
- Virtualenv support
7577
- Search through Python documentation and run Python code
76-
- Auto PEP8_ error fixes
78+
- Auto pycodestyle_ error fixes
7779

7880
And more.
7981

@@ -86,7 +88,7 @@ using ``<Tab>`` key or any other customized keys.
8688
.. _indent: http://www.vim.org/scripts/script.php?script_id=974
8789
.. _syntax: http://www.vim.org/scripts/script.php?script_id=790
8890
.. _Pyflakes: http://pypi.python.org/pypi/pyflakes/
89-
.. _PEP8: http://pypi.python.org/pypi/pep8/
91+
.. _pycodestyle: https://pypi.python.org/pypi/pycodestyle/
9092
.. _syntastic: https://github.com/scrooloose/syntastic
9193
.. _Python-mode: https://github.com/klen/python-mode
9294
.. _SuperTab: http://www.vim.org/scripts/script.php?script_id=1643
@@ -148,10 +150,10 @@ known for IntelliJ IDEA. Both share the same code base and most of PyCharm's
148150
features can be brought to IntelliJ with the free
149151
`Python Plug-In <https://plugins.jetbrains.com/plugin/?idea&pluginId=631>`_. There are two
150152
versions of PyCharm: Professional Edition (Free 30-day trial) and Community
151-
Edition(Apache 2.0 License) with fewer features.
153+
Edition (Apache 2.0 License) with fewer features.
152154

153155
Python (on Visual Studio Code)
154-
-----------------------------
156+
------------------------------
155157

156158
`Python for Visual Studio <https://marketplace.visualstudio.com/items?itemName=donjayamanne.python>`_ is an extension for the `Visual Studio Code IDE <https://code.visualstudio.com>`_.
157159
This is a free, light weight, open source IDE, with support for Mac, Windows, and Linux.

docs/dev/pip-virtualenv.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Further Configuration of Pip and Virtualenv
44
===========================================
55

6+
.. image:: https://farm4.staticflickr.com/3934/34018732105_f0e6758859_k_d.jpg
7+
68
Requiring an active virtual environment for ``pip``
79
---------------------------------------------------
810

@@ -18,8 +20,8 @@ environment of the project. Over time this can result in a messy global package
1820
list.
1921

2022
In order to make sure that you install packages to your active virtual
21-
environment when you use ``pip install``, consider adding the following two
22-
lines to your :file:`~/.bashrc` file:
23+
environment when you use ``pip install``, consider adding the following
24+
line to your :file:`~/.bashrc` file:
2325

2426
.. code-block:: console
2527

0 commit comments

Comments
 (0)