Skip to content

Commit 9ae1d68

Browse files
committed
Website build
1 parent 390c4f8 commit 9ae1d68

File tree

7 files changed

+58
-44
lines changed

7 files changed

+58
-44
lines changed

2_programs_in_files.html

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ <h3><span class="section-number">2.2.1. </span>Installing packages from PyPI<a c
121121
distributed from PyPI. Suppose your venv doesn’t have <a class="reference external" href="https://numpy.org/doc/stable/reference/index.html#module-numpy" title="(in NumPy v1.19)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">numpy</span></code></a>
122122
installed and you need it. You would install it with the following
123123
terminal command:</p>
124-
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp gp-VirtualEnv">(my_venv)</span> <span class="gp">$</span> python3 -m pip install numpy
124+
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp gp-VirtualEnv">(my_venv)</span> <span class="gp">$</span> python -m pip install numpy
125125
</pre></div>
126126
</div>
127127
<p>It is also possible to invoke pip directly using the command <code class="xref py py-obj docutils literal notranslate"><span class="pre">pip3</span></code>,
@@ -131,7 +131,7 @@ <h3><span class="section-number">2.2.1. </span>Installing packages from PyPI<a c
131131
likely that pip will install more packages than those you directly
132132
asked for. This is necessary if those packages are to actually work.</p>
133133
<p>Pip can also be used to upgrade a package to the latest version:</p>
134-
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp gp-VirtualEnv">(my_venv)</span> <span class="gp">$</span> python3 -m pip install --upgrade numpy
134+
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp gp-VirtualEnv">(my_venv)</span> <span class="gp">$</span> python -m pip install --upgrade numpy
135135
</pre></div>
136136
</div>
137137
</div>
@@ -231,24 +231,29 @@ <h3><span class="section-number">2.4.1. </span>A first Python script<a class="he
231231
disk from the text editor, we can now run the program. Open a
232232
terminal, and change to the folder (directory) where you saved
233233
<code class="file docutils literal notranslate"><span class="pre">hello.py</span></code>. For example, if <code class="file docutils literal notranslate"><span class="pre">hello.py</span></code> is in the directory <code class="file docutils literal notranslate"><span class="pre">src</span></code> in
234-
your home directory, then you would type the following:</p>
234+
your home directory, then on most operating systems, you would type the following:</p>
235235
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$</span> <span class="nb">cd</span> src
236236
<span class="gp">$</span> python3 hello.py
237237
</pre></div>
238238
</div>
239-
<p>The dollar sign is the command prompt. Its different on some systems,
240-
for example, it’s often a greater than sign (<code class="xref py py-obj docutils literal notranslate"><span class="pre">&gt;</span></code>). The text to the left
241-
of the command prompt might also be different depending on which
242-
terminal program you are using on which operating system, but we are
243-
only concerned with the commands to the right of the prompt. The first
244-
of these, <code class="xref py py-obj docutils literal notranslate"><span class="pre">cd</span></code> (<em>change directory</em>) switches the current folder to
245-
<code class="file docutils literal notranslate"><span class="pre">src</span></code>. The second command actually runs the Python interpreter on
246-
<code class="file docutils literal notranslate"><span class="pre">hello.py</span></code>. Depending on what is installed on your computer, it might
247-
also be possible to leave off the <code class="xref py py-obj docutils literal notranslate"><span class="pre">3</span></code> at the end of <code class="xref py py-obj docutils literal notranslate"><span class="pre">python3</span></code>, however
248-
on some systems the plain <code class="xref py py-obj docutils literal notranslate"><span class="pre">python</span></code> command is still linked to the old
249-
version 2 of Python, so it’s better to be explicit and type
250-
<code class="xref py py-obj docutils literal notranslate"><span class="pre">python3</span></code>. When we press the <kbd class="kbd docutils literal notranslate">enter</kbd> key after the last line above,
251-
our tiny Python script <code class="file docutils literal notranslate"><span class="pre">hello.py</span></code> runs and the following is displayed:</p>
239+
<p>on Windows you might instead need to type:</p>
240+
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;</span> <span class="nb">cd</span> src
241+
<span class="gp">&gt;</span> py hello.py
242+
</pre></div>
243+
</div>
244+
<p>The dollar sign is the command prompt. Its different on some systems, for
245+
example, it’s often a greater than sign (<code class="xref py py-obj docutils literal notranslate"><span class="pre">&gt;</span></code>). The text to the left of the
246+
command prompt might also be different depending on which terminal program you
247+
are using on which operating system, but we are only concerned with the commands
248+
to the right of the prompt. The first of these, <code class="xref py py-obj docutils literal notranslate"><span class="pre">cd</span></code> (<em>change directory</em>)
249+
switches the current folder to <code class="file docutils literal notranslate"><span class="pre">src</span></code>. The second command actually runs the
250+
Python interpreter on <code class="file docutils literal notranslate"><span class="pre">hello.py</span></code>. Depending on what is installed on your
251+
computer, it might also be possible to leave off the <code class="xref py py-obj docutils literal notranslate"><span class="pre">3</span></code> at the end of
252+
<code class="xref py py-obj docutils literal notranslate"><span class="pre">python3</span></code>, however on some systems the plain <code class="xref py py-obj docutils literal notranslate"><span class="pre">python</span></code> command is still linked to
253+
the old version 2 of Python, so it’s better to be explicit and type <code class="xref py py-obj docutils literal notranslate"><span class="pre">python3</span></code>.
254+
Once we start working with Python <a class="reference internal" href="#term-virtual-environment"><span class="xref std std-term">virtual environments</span></a>, it will always be safe to use <code class="xref py py-obj docutils literal notranslate"><span class="pre">python</span></code> without the 3. When we
255+
press the <kbd class="kbd docutils literal notranslate">enter</kbd> key after the last line above, our tiny Python script
256+
<code class="file docutils literal notranslate"><span class="pre">hello.py</span></code> runs and the following is displayed:</p>
252257
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">Hello World</span>
253258
</pre></div>
254259
</div>
@@ -598,7 +603,7 @@ <h3><span class="section-number">2.6.3. </span>Installing a package from local c
598603
(hopefully a git repository!) on your local computer. This is usually
599604
the case where you are developing the package yourself. In this case,
600605
you would type:</p>
601-
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp gp-VirtualEnv">(my_venv)</span> <span class="gp">$</span> python3 -m pip install -e folder/
606+
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp gp-VirtualEnv">(my_venv)</span> <span class="gp">$</span> python -m pip install -e folder/
602607
</pre></div>
603608
</div>
604609
<p>replacing <code class="xref py py-obj docutils literal notranslate"><span class="pre">folder</span></code> with the name of the top-level folder of your
@@ -647,7 +652,7 @@ <h2><span class="section-number">2.7. </span>Testing frameworks<a class="headerl
647652
concepts are largely similar so rather than get bogged down in the
648653
details of multiple frameworks, we will introduce <a class="reference external" href="https://docs.pytest.org/en/latest/index.html" title="(in pytest v6.3.0.dev93+g42d5545f4)"><span class="xref std std-doc">pytest</span></a>, which is one of the most widely used. Pytest is simply a Python
649654
package, so you can install it into your current environment using:</p>
650-
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$</span> python3 -m pip install pytest
655+
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$</span> python -m pip install pytest
651656
</pre></div>
652657
</div>
653658
<div class="section" id="pytest-tests">

4_style.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ <h3><span class="section-number">4.2.1. </span>Linters<a class="headerlink" href
196196
<h3><span class="section-number">4.2.2. </span>Installing flake8<a class="headerlink" href="#installing-flake8" title="Permalink to this headline"></a></h3>
197197
<p>Flake8 is a Python package, which can be installed using pip. Make sure you’ve
198198
activated your <a class="reference internal" href="2_programs_in_files.html#term-virtual-environment"><span class="xref std std-term">virtual environment</span></a> and then run:</p>
199-
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$</span> python3 -m pip install flake8
199+
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$</span> python -m pip install flake8
200200
</pre></div>
201201
</div>
202202
<p>This is enough to run flake8 on the command line, however you will probably want

9_debugging.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ <h3><span class="section-number">9.1.1. </span>Obtaining <code class="xref py py
8888
<p>Because <code class="xref py py-mod docutils literal notranslate"><span class="pre">ipdb</span></code> does not form a part of the standard library, you
8989
may not always find it installed by default. However, it’s simply a
9090
Python package so you can install it with:</p>
91-
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$</span> python3 -m pip install ipdb
91+
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$</span> python -m pip install ipdb
9292
</pre></div>
9393
</div>
9494
</div>

_sources/2_programs_in_files.rst.txt

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ terminal command:
7070

7171
.. code-block:: console
7272
73-
(my_venv) $ python3 -m pip install numpy
73+
(my_venv) $ python -m pip install numpy
7474
7575
It is also possible to invoke pip directly using the command `pip3`,
7676
but there are some circumstances where that might result in pip using
@@ -84,7 +84,7 @@ Pip can also be used to upgrade a package to the latest version:
8484

8585
.. code-block:: console
8686
87-
(my_venv) $ python3 -m pip install --upgrade numpy
87+
(my_venv) $ python -m pip install --upgrade numpy
8888
8989
The Python interpreter
9090
----------------------
@@ -189,26 +189,35 @@ the file as a Python file. Having remembered to save :file:`hello.py` to
189189
disk from the text editor, we can now run the program. Open a
190190
terminal, and change to the folder (directory) where you saved
191191
:file:`hello.py`. For example, if :file:`hello.py` is in the directory :file:`src` in
192-
your home directory, then you would type the following:
192+
your home directory, then on most operating systems, you would type the following:
193193

194194
.. code-block:: console
195195
196-
$ cd src
197-
$ python3 hello.py
198-
199-
The dollar sign is the command prompt. Its different on some systems,
200-
for example, it's often a greater than sign (`>`). The text to the left
201-
of the command prompt might also be different depending on which
202-
terminal program you are using on which operating system, but we are
203-
only concerned with the commands to the right of the prompt. The first
204-
of these, `cd` (*change directory*) switches the current folder to
205-
:file:`src`. The second command actually runs the Python interpreter on
206-
:file:`hello.py`. Depending on what is installed on your computer, it might
207-
also be possible to leave off the `3` at the end of `python3`, however
208-
on some systems the plain `python` command is still linked to the old
209-
version 2 of Python, so it's better to be explicit and type
210-
`python3`. When we press the :kbd:`enter` key after the last line above,
211-
our tiny Python script :file:`hello.py` runs and the following is displayed:
196+
$ cd src
197+
$ python3 hello.py
198+
199+
on Windows you might instead need to type:
200+
201+
.. code-block:: console
202+
203+
> cd src
204+
> py hello.py
205+
206+
207+
The dollar sign is the command prompt. Its different on some systems, for
208+
example, it's often a greater than sign (`>`). The text to the left of the
209+
command prompt might also be different depending on which terminal program you
210+
are using on which operating system, but we are only concerned with the commands
211+
to the right of the prompt. The first of these, `cd` (*change directory*)
212+
switches the current folder to :file:`src`. The second command actually runs the
213+
Python interpreter on :file:`hello.py`. Depending on what is installed on your
214+
computer, it might also be possible to leave off the `3` at the end of
215+
`python3`, however on some systems the plain `python` command is still linked to
216+
the old version 2 of Python, so it's better to be explicit and type `python3`.
217+
Once we start working with Python :term:`virtual environments <virtual
218+
environment>`, it will always be safe to use `python` without the 3. When we
219+
press the :kbd:`enter` key after the last line above, our tiny Python script
220+
:file:`hello.py` runs and the following is displayed:
212221

213222
.. code-block:: console
214223
@@ -616,7 +625,7 @@ you would type:
616625

617626
.. code-block:: console
618627
619-
(my_venv) $ python3 -m pip install -e folder/
628+
(my_venv) $ python -m pip install -e folder/
620629
621630
replacing `folder` with the name of the top-level folder of your
622631
repository: the folder containing :file:`setup.py`. The option flag `-e`
@@ -669,7 +678,7 @@ package, so you can install it into your current environment using:
669678

670679
.. code-block:: console
671680
672-
$ python3 -m pip install pytest
681+
$ python -m pip install pytest
673682
674683
Pytest tests
675684
~~~~~~~~~~~~

_sources/4_style.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ activated your :term:`virtual environment` and then run:
154154

155155
.. code-block:: console
156156
157-
$ python3 -m pip install flake8
157+
$ python -m pip install flake8
158158
159159
This is enough to run flake8 on the command line, however you will probably want
160160
to set up your editor to highlight flake8 incompatibilities in your source. For

_sources/9_debugging.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Python package so you can install it with:
3939

4040
.. code-block:: console
4141
42-
$ python3 -m pip install ipdb
42+
$ python -m pip install ipdb
4343
4444
Postmortem debugging
4545
....................

searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)