Skip to content

Commit 617be08

Browse files
committed
content/dependencies: Minor updates from my read-though
- Mostly formatting and so on
1 parent 550c1ce commit 617be08

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

content/dependencies.rst

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ How do you track dependencies of your project?
3232
Exercises 1
3333
-----------
3434

35-
.. challenge:: Dependencies-1 (15 min)
35+
.. challenge:: Dependencies-1: Discuss dependency management (15 min)
3636

3737
Please discuss **in breakout rooms** and answer via **collaborative document** the
3838
following questions:
@@ -102,7 +102,8 @@ Why are there two ecosystems?
102102
- **Cons:**
103103
- Package creation is harder
104104

105-
.. solution:: Anaconda vs. miniconda vs. conda vs. mamba vs. Anaconda Cloud vs. conda-forge
105+
.. admonition:: Anaconda vs. miniconda vs. conda vs. mamba vs. Anaconda Cloud vs. conda-forge
106+
:class: dropdown
106107

107108
- `Anaconda <https://www.anaconda.com/>`__ - a distribution of conda packages
108109
made by Anaconda Inc.. It is free for academic and non-commercial use.
@@ -123,6 +124,8 @@ to share Python packages.
123124
Creating isolated environments
124125
------------------------------
125126

127+
An **isolated environment** allows installing packages without
128+
affecting the rest of your operating system or any other projects.
126129
Isolated environments solve a couple of problems:
127130

128131
- You can install specific, also older, versions of packages into them.
@@ -140,7 +143,7 @@ Isolated environments solve a couple of problems:
140143
Exercises 2
141144
-----------
142145

143-
.. challenge:: Dependencies-2 (15 min)
146+
.. challenge:: Dependencies-2: Create a conda environment (15 min)
144147

145148
.. highlight:: console
146149

@@ -178,15 +181,20 @@ Exercises 2
178181

179182
$ source activate python37-env
180183

181-
3. Open a Python console and check that you have effectively the right version for each package::
184+
3. Open a Python console and check that you have effectively the
185+
right version for each package:
186+
187+
.. code-block:: python
182188
183189
import numpy
184190
import matplotlib
185191
186192
print('Numpy version: ', numpy.__version__)
187193
print('Matplotlib version: ', matplotlib.__version__)
188194
189-
Or use the one-liner if you have access to a terminal like bash
195+
Or use the one-liner if you have access to a terminal like bash:
196+
197+
.. code-block:: python
190198
191199
python -c 'import numpy; print(numpy.__version__)'
192200
python -c 'import matplotlib;print(matplotlib.__version__)'
@@ -220,7 +228,7 @@ Exercises 2
220228
Exercises 3
221229
-----------
222230

223-
.. challenge:: Dependencies-3 (15 min, optional)
231+
.. challenge:: Dependencies-3: Create a virtualenv (15 min, optional)
224232

225233
This is the same exercise as before but we use virtualenv rather than conda.
226234

@@ -233,7 +241,7 @@ Exercises 3
233241
folder called ``scicomp``.
234242

235243
2. Activate it. To activate your newly created virtual environment locate the
236-
script called ``activate`` and execute it.
244+
script called ``activate`` and *source* it.
237245

238246
- **Linux/Mac-OSX**: look at ``bin`` folder in the ``scicomp`` folder::
239247

@@ -265,13 +273,13 @@ you're currently telling it to install.
265273

266274
For example, check what version of ``scipy`` you'll get if you run
267275

268-
.. code-block:: shell
276+
.. code-block:: console
269277
270278
$ pip install scipy
271279
272280
or
273281

274-
.. code-block:: shell
282+
.. code-block:: console
275283
276284
$ conda install scipy
277285
@@ -288,7 +296,9 @@ There are two standard ways to record dependencies for Python projects:
288296
``requirements.txt`` and ``environment.yml``.
289297

290298
``requirements.txt`` (used by virtual environment) is a simple
291-
text file which looks like this::
299+
text file which looks like this:
300+
301+
.. code-block:: none
292302
293303
numpy
294304
matplotlib
@@ -316,7 +326,9 @@ researchers might not be able to replicate your results or run your code.
316326

317327
Here are the two files again, but this time with versions pinned:
318328

319-
``requirements.txt`` with versions::
329+
``requirements.txt`` with versions:
330+
331+
.. code-block:: none
320332
321333
numpy==1.18.1
322334
matplotlib==3.1.3
@@ -355,7 +367,7 @@ Here are the two files again, but this time with versions pinned:
355367
Dependencies 4
356368
--------------
357369

358-
.. challenge:: Dependencies-4 (15 min)
370+
.. challenge:: Dependencies-4: Freeze an environment (15 min)
359371

360372
- Create the file ``environment.yml`` or ``requirements.txt``
361373

0 commit comments

Comments
 (0)