Skip to content

Commit dd0b924

Browse files
authored
Merge pull request #1 from kennethreitz/master
pull from upstream
2 parents bb79614 + 2eb3bfb commit dd0b924

Some content is hidden

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

75 files changed

+8076
-2988
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ docs/_build
77

88
# Ignore .hgignore for contributors using Mercurial.
99
.hgignore
10+
11+
# Ignore files generated during build
12+
build/

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sudo: false
2+
language: python
3+
install: pip install sphinx
4+
script:
5+
- make doctest
6+
- make html

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

CONTRIBUTING.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
How to contribute
2+
-----------------
3+
4+
This guide is under heavy development. If you would like to contribute, please
5+
see:
6+
7+
http://docs.python-guide.org/en/latest/notes/contribute/
8+
9+
How to test your changes
10+
------------------------
11+
12+
The html version of this guide is built with [sphinx](http://www.sphinx-doc.org/en/stable/). You may test your revisions locally by having sphinx installed. You can do this easily with pip (as described in the link).
13+
14+
``` bash
15+
pip install --user sphinx
16+
```
17+
18+
Then navigate to the directory of the makefile and ```make build``` or ```make html```. Sphinx will then generate the html in a folder called _build/html
19+
20+
After navigating to this folder, you can then use python's built in webserver to view your changes locally:
21+
22+
``` bash
23+
python3 -m http.server
24+
```
25+
26+
By default, http.server listens on every ip address bound on your host on port 8000. To bind to a specific one, say, localhost on port 8005:
27+
28+
``` bash
29+
python3 -m http.server 8005 --bind 127.0.0.1
30+
```
31+
32+
Style Guide
33+
-----------
34+
35+
For all contributions, please follow the `Guide Style Guide`:
36+
37+
http://docs.python-guide.org/en/latest/notes/styleguide/

Readme.rst

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,34 @@ 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

8-
**Work in progress. If you'd like to help, please do. There's a lot of work to be done.**
10+
**Work in progress. If you'd like to help, please do. There's a lot of work to
11+
be done.**
912

10-
This guide is currently under heavy development. 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.
13+
This guide is currently under heavy development. This opinionated guide
14+
exists to provide both novice and expert Python developers a best practice
15+
handbook to the installation, configuration, and usage of Python on a daily
16+
basis.
1117

1218

1319
Topics include:
1420

15-
- Platform/version specific installations
21+
- Platform- and version-specific installations
1622
- Py2app, Py2exe, bbfreeze, pyInstaller
17-
- Pip / virtualenv
18-
- Documentation. Writing it.
19-
- server configurations / tools for various web frameworks
20-
- fabric
21-
- exhaustive module recommendations, grouped by topic/purpose
22-
- Testing. Jenkins + tox guides.
23-
- How to interface w/ hg from git easily
24-
- what libraries to use for what
25-
26-
If you are not fond of reading reStructuredText, there is a
23+
- Pip
24+
- Numpy, scipy, statpy, pyplot, matplotlib
25+
- Virtualenv
26+
- Fabric
27+
- Exhaustive module recommendations, grouped by topic/purpose
28+
- Which libraries to use for what
29+
- Server configurations & tools for various web frameworks
30+
- Documentation: writing it
31+
- Testing: Jenkins & tox guides
32+
- How to easily interface ``hg`` from ``git``
33+
34+
If you aren't fond of reading reStructuredText, there is an
2735
almost up-to-date `HTML version at docs.python-guide.org
2836
<http://docs.python-guide.org>`_.

docs/Makefile

Lines changed: 54 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,19 @@ SPHINXBUILD = sphinx-build
77
PAPER =
88
BUILDDIR = _build
99

10+
# User-friendly check for sphinx-build
11+
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
12+
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
13+
endif
14+
1015
# Internal variables.
1116
PAPEROPT_a4 = -D latex_paper_size=a4
1217
PAPEROPT_letter = -D latex_paper_size=letter
1318
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
19+
# the i18n builder cannot share the environment and doctrees with the others
20+
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
1421

15-
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
22+
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
1623

1724
help:
1825
@echo "Please use \`make <target>' where <target> is one of"
@@ -27,14 +34,20 @@ help:
2734
@echo " epub to make an epub"
2835
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
2936
@echo " latexpdf to make LaTeX files and run them through pdflatex"
37+
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
3038
@echo " text to make text files"
3139
@echo " man to make manual pages"
40+
@echo " texinfo to make Texinfo files"
41+
@echo " info to make Texinfo files and run them through makeinfo"
42+
@echo " gettext to make PO message catalogs"
3243
@echo " changes to make an overview of all changed/added/deprecated items"
44+
@echo " xml to make Docutils-native XML files"
45+
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
3346
@echo " linkcheck to check all external links for integrity"
3447
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
3548

3649
clean:
37-
-rm -rf $(BUILDDIR)/*
50+
rm -rf $(BUILDDIR)/*
3851

3952
html:
4053
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@@ -72,17 +85,17 @@ qthelp:
7285
@echo
7386
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
7487
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
75-
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/osxpython.qhcp"
88+
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/pythonguide.qhcp"
7689
@echo "To view the help file:"
77-
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/osxpython.qhc"
90+
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/pythonguide.qhc"
7891

7992
devhelp:
8093
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
8194
@echo
8295
@echo "Build finished."
8396
@echo "To view the help file:"
84-
@echo "# mkdir -p $$HOME/.local/share/devhelp/osxpython"
85-
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/osxpython"
97+
@echo "# mkdir -p $$HOME/.local/share/devhelp/pythonguide"
98+
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/pythonguide"
8699
@echo "# devhelp"
87100

88101
epub:
@@ -100,7 +113,13 @@ latex:
100113
latexpdf:
101114
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
102115
@echo "Running LaTeX files through pdflatex..."
103-
make -C $(BUILDDIR)/latex all-pdf
116+
$(MAKE) -C $(BUILDDIR)/latex all-pdf
117+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
118+
119+
latexpdfja:
120+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
121+
@echo "Running LaTeX files through platex and dvipdfmx..."
122+
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
104123
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
105124

106125
text:
@@ -113,6 +132,24 @@ man:
113132
@echo
114133
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
115134

135+
texinfo:
136+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
137+
@echo
138+
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
139+
@echo "Run \`make' in that directory to run these through makeinfo" \
140+
"(use \`make info' here to do that automatically)."
141+
142+
info:
143+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
144+
@echo "Running Texinfo files through makeinfo..."
145+
make -C $(BUILDDIR)/texinfo info
146+
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
147+
148+
gettext:
149+
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
150+
@echo
151+
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
152+
116153
changes:
117154
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
118155
@echo
@@ -128,3 +165,13 @@ doctest:
128165
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
129166
@echo "Testing of doctests in the sources finished, look at the " \
130167
"results in $(BUILDDIR)/doctest/output.txt."
168+
169+
xml:
170+
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
171+
@echo
172+
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
173+
174+
pseudoxml:
175+
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
176+
@echo
177+
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."

docs/_static/ad.png

39.2 KB
Loading

docs/_static/pep-0001-1.png

20.3 KB
Loading

docs/_static/python-guide-logo.png

58.7 KB
Loading

docs/_templates/hacks.html

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
32+
<script type="text/javascript">
33+
var _gauges = _gauges || [];
34+
(function() {
35+
var t = document.createElement('script');
36+
t.type = 'text/javascript';
37+
t.async = true;
38+
t.id = 'gauges-tracker';
39+
t.setAttribute('data-site-id', '56ca79a64b2ffa7a470027ea');
40+
t.setAttribute('data-track-path', 'https://track.gaug.es/track.gif');
41+
t.src = 'https://d36ee2fcip1434.cloudfront.net/track.js';
42+
var s = document.getElementsByTagName('script')[0];
43+
s.parentNode.insertBefore(t, s);
44+
})();
45+
</script>

0 commit comments

Comments
 (0)