Skip to content

Commit ad77e9f

Browse files
I *think* everything we need is here now.
1 parent 0d28fc3 commit ad77e9f

13 files changed

Lines changed: 649 additions & 95 deletions

File tree

File renamed without changes.
File renamed without changes.

‎source/exercises/lambda_magic.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ Example calling code
5454
to the input, 5... i.e. the nth function in the list adds n to the input.
5555
5656
57-
See the test code in :download:`test_lambda.py <../solutions/lambda/test_lambda.py>`
57+
See the test code in :download:`test_lambda.py <../solutions/extras/lambda/test_lambda.py>`
5858

5959

‎source/index.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Individual Modules and Exercises
2828
.. toctree::
2929
:maxdepth: 2
3030

31+
modules/dev_environment/index
3132
modules/index
3233
exercises/index
3334

‎source/modules/EnvironmentOverview.rst‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ There are three basic elements to your environment when working with Python for
2323

2424
* A Python interpreter
2525

26-
- We use "cPython" version 3.6 or greater for this class.
26+
- We use "cPython" version 3.8 or greater for this class.
2727

2828
* A way to edit your code.
2929

@@ -45,7 +45,7 @@ Having some facility on the command line is important for a software developer.
4545
We won't cover this much in class, so if you are not comfortable,
4646
please bone up on your own.
4747

48-
We have some resources here: `PythonResources--command line <http://uwpce-pythoncert.github.io/PythonResources/DevEnvironment/command_line.html>`_
48+
We have some resources here: :ref:`command_line_basics`
4949

5050
**Windows:**
5151

@@ -56,7 +56,8 @@ Windows provides the "DOS" command line, which is OK, but pretty old and limited
5656
If you are comfortable with either of these, go for it.
5757

5858
If not, you can use the "git Bash" shell, which is much like the bash shell on OS-X and Linux. Or, on Windows 10, look into the "bash shell for Windows," otherwise known as the "Windows Subsystem for Linux." More info is available here:
59-
`PythonResources--Windows Bash <http://uwpce-pythoncert.github.io/PythonResources/DevEnvironment/windows_bash.html>`_
59+
60+
:ref:`windows_bash`
6061

6162
Accessing the Command Line
6263
--------------------------
@@ -77,7 +78,7 @@ OS-X
7778
On The Mac, you can add a "New Terminal at Folder" right-click menu item by:
7879

7980

80-
Head into System Preferences and select Keyboard > Shortcuts > Services. Find "New Terminal at Folder" in the settings and click the box. Now, when you're in Finder, just right-click a folder and you're shown the open to open Terminal. When you do, it'll start right in the folder you're in.
81+
Head into System Preferences and select Keyboard => Shortcuts => Services. Find "New Terminal at Folder" in the settings and click the box. Now, when you're in Finder, just right-click a folder and you're shown the open to open Terminal. When you do, it'll start right in the folder you're in.
8182

8283
`Launch an OS-X Terminal Window <https://lifehacker.com/launch-an-os-x-terminal-window-from-a-specific-folder-1466745514>`_
8384

@@ -303,6 +304,6 @@ Other Helpful Hints
303304

304305
There are a number of other assorted helpful materials here:
305306

306-
:ref:`supplemental_materials`
307+
:ref:`installing_python`
307308

308309

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
.. _how_to_run_a_python_file:
2+
3+
How to run a python file
4+
========================
5+
6+
A file with python code in it is a 'module' or 'script'
7+
8+
(more on the distinction later on...)
9+
10+
It should be named with the ``.py`` extension: ``some_name.py``
11+
12+
If you want to run the code directly (it is a script), you have a couple options:
13+
14+
1) call python on the command line, and pass in your module name
15+
16+
.. code-block:: bash
17+
18+
$ python3 the_name_of_the_script.py
19+
20+
2) On \*nix (linux, OS-X, Windows bash), you can make the file "executable"::
21+
22+
$ chmod +x the_file.py
23+
24+
And make sure it has a "shebang" line at the top::
25+
26+
#!/usr/bin/env python
27+
28+
Then you can run it directly::
29+
30+
./the_file.py
31+
32+
3) On Windows, the `.py` extensions can be associated with the python interpreter, so it can be run directly. This is clunkier than the \*nix "shebang line" approach, so I don't recommend it -- but it is an option.
33+
34+
4) run ``ipython``, and run it from within iPython with the ``run`` command
35+
36+
.. code-block:: ipython
37+
38+
In [1]: run the_file.py
39+
40+
5) Various IDEs (PyCharm, IDLE, etc) have a way to run the module you are currently editing -- if you use one of these tools, learn how to do that. Make sure that it is using the version of Python that you want it to be.

‎source/modules/SpecialMethodsAndProtocols.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ Write a class for a quadratic equation.
402402
my_quad(0)
403403
404404
Here's one way to do that:
405-
:download:`quadratic.py <../solutions/quadratic/quadratic.py>`
405+
:download:`quadratic.py <../examples/quadratic/quadratic.py>`
406406

407407
Protocols in Summary
408408
--------------------
@@ -413,7 +413,7 @@ Look up the special methods you need and define them (and only the ones you need
413413

414414
There's more to read about the details of implementing these methods:
415415

416-
* https://docs.python.org/3.6/reference/datamodel.html#special-method-names
416+
* https://docs.python.org/3.8/reference/datamodel.html#special-method-names
417417

418418

419419
References

source/modules/dev_environment/images/feature_branching.rst renamed to source/modules/dev_environment/feature_branching.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ point in time, then you do some isolated work, then merge it back into
3131
main branch. No commits to master will affect your work in your feature
3232
branch while you're in it.
3333

34-
.. image:: feature_branching_img1.png
34+
.. image:: images/feature_branching_img1.png
3535
:scale: 75
3636

3737

@@ -102,14 +102,14 @@ Creating feature branch via GitHub UI
102102

103103
Navigate to your forked GitHub repo and identify Branch dropdown:
104104

105-
.. image:: feature_branching_img2.png
105+
.. image:: images/feature_branching_img2.png
106106
:scale: 50
107107

108108
Initially you should only see master branch listed. Within that dropdown
109109
type the name of the new feature branch, for this example we will call
110110
it ``lesson1/assignment1``
111111

112-
.. image:: feature_branching_img3.png
112+
.. image:: images/feature_branching_img3.png
113113
:scale: 50
114114

115115
Once you start typing the name of the branch, and if it does not
@@ -150,7 +150,7 @@ Create PR into main repo
150150
In GitHub UI navigate to Pull Requests and select New pull request
151151
button, you should now see options for source/target and branches
152152

153-
.. image:: feature_branching_img4.png
153+
.. image:: images/feature_branching_img4.png
154154
:scale: 50
155155

156156
In the far right dropdown you will want to select your feature branch.
@@ -203,7 +203,7 @@ Navigate to Pull Requests again, and press New Pull request button, you
203203
will now select your fork on the far left with master branch, and your
204204
feature branch on the far right.
205205

206-
.. image:: feature_branching_img5.png
206+
.. image:: images/feature_branching_img5.png
207207
:scale: 50
208208

209209
Create your pull request, then merge it and delete feature branch.

0 commit comments

Comments
 (0)