|
30 | 30 | "\n",
|
31 | 31 | "## 1) Initial setup and library installs\n",
|
32 | 32 | "\n",
|
33 |
| - "Note: the cell below runs some code to determine where the notebook is running (e.g. on your local machine or on Binder), and decides where to save results. If it is hidden, click on the dots (•••) to view." |
| 33 | + "Note: the cell below runs some code to determine where the notebook is running (e.g. on your local machine or on Binder)." |
34 | 34 | ]
|
35 | 35 | },
|
36 | 36 | {
|
37 | 37 | "cell_type": "code",
|
38 | 38 | "execution_count": 1,
|
39 | 39 | "metadata": {
|
40 | 40 | "editable": true,
|
41 |
| - "jupyter": { |
42 |
| - "source_hidden": true |
43 |
| - }, |
44 | 41 | "slideshow": {
|
45 | 42 | "slide_type": ""
|
46 | 43 | },
|
|
53 | 50 | "name": "stdout",
|
54 | 51 | "output_type": "stream",
|
55 | 52 | "text": [
|
56 |
| - "Results will be saved in /Users/padraig/git/combine-notebooks/notebooks/results\n" |
| 53 | + "Current directory is: /Users/padraig/git/combine-notebooks/notebooks/results\n" |
57 | 54 | ]
|
58 | 55 | }
|
59 | 56 | ],
|
60 | 57 | "source": [
|
61 |
| - "#note: metadata hides this cell on binder but it doesn't get hidden on colab\n", |
62 | 58 | "from pathlib import Path\n",
|
63 | 59 | "\n",
|
64 |
| - "#determine if we're running on colab\n", |
65 |
| - "try:\n", |
66 |
| - " import google.colab\n", |
67 |
| - " exec_env = \"colab\" #we seem to be on colab\n", |
68 |
| - " print(\"Assuming this notebook is running on Google Colab\")\n", |
69 |
| - "except:\n", |
70 |
| - " exec_env = \"binder\" #assume it's binder\n", |
71 |
| - "\n", |
72 |
| - "if exec_env == \"colab\":\n", |
73 |
| - " working_dir = f\"{Path.cwd()}/combine-notebooks/notebooks/results\"\n", |
74 |
| - " !git clone https://github.com/combine-org/combine-notebooks\n", |
75 |
| - " %cd combine-notebooks\n", |
76 |
| - " !pip install .\n", |
77 |
| - " %mkdir -p {working_dir}\n", |
78 |
| - "\n", |
79 |
| - "else:\n", |
80 |
| - " #binder starts off in the notebook's folder\n", |
81 |
| - " working_dir = f\"{Path.cwd()}/results\"\n", |
82 |
| - "\n", |
83 |
| - "import os\n", |
84 |
| - "os.chdir(working_dir)\n", |
85 |
| - "\n", |
86 |
| - "print(\"Results will be saved in %s\"%working_dir)" |
| 60 | + "from combine_notebooks.utils import determine_environment\n", |
| 61 | + "working_dir = determine_environment()" |
87 | 62 | ]
|
88 | 63 | },
|
89 | 64 | {
|
|
0 commit comments