Skip to content

Commit 47c1893

Browse files
committed
Encourage editable install in exercise 1
1 parent bf035bd commit 47c1893

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from calculator import add, subtract, integral
22

3-
print(add(2, 3))
4-
print(subtract(2, 3))
5-
print(integral(lambda x: x * x, 0.0, 1.0))
3+
print("2 + 3 =", add(2, 3))
4+
print("2 - 3 =", subtract(2, 3))
5+
integral_x_squared, error = integral(lambda x: x * x, 0.0, 1.0)
6+
print(f"{integral_x_squared = }")
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from calculator import subtract
2+
3+
print("2 - 3 =", subtract(2, 3))

content/packaging.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,21 @@ Exercises 1
128128
- Create a new folder outside of our example project
129129
- Create a new virtual environment (:ref:`dependency_management`)
130130
- Install the example package from the project folder
131-
into the new environment: ``$ pip install /path/to/project-folder/``
131+
into the new environment::
132+
133+
pip install --editable /path/to/project-folder/
134+
132135
- Test the local installation:
133136

134137
.. literalinclude:: packaging-example-project/test.py
135138

139+
- Make a change in the ``subtract`` function above such that it always
140+
returns a float ``return float(x - y)``.
141+
142+
- Open a new Python console and test the following lines. Compare it with
143+
the previous output.
144+
145+
.. literalinclude:: packaging-example-project/test_editable.py
136146

137147
Sharing packages via PyPI
138148
-------------------------

0 commit comments

Comments
 (0)