You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+69Lines changed: 69 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,75 @@ uv run jupyter lab Ch02-statlearn-lab.ipynb
48
48
49
49
You can download all the labs as a `.zip` or `.tar.gz`[here](https://github.com/intro-stat-learning/ISLP_labs/releases/tag/v2.2.1)
50
50
51
+
# Setup script
52
+
53
+
We've added a setup script that ensures precisely the desired labs are checked out along with a `uv` virtual environment being created. Follow
54
+
these instructions:
55
+
56
+
To set up a local environment to run the notebooks for a specific version of the labs, you can use the `setup_notebook_env.py` script. This script will create a directory, download the labs, and set up a Python virtual environment with all the necessary packages.
57
+
58
+
## Prerequisites
59
+
60
+
This script relies on `uv` for managing Python environments. If you don't have `uv` installed, you can install it using `pipx` or `cargo`:
61
+
62
+
***Using `pipx` (recommended):**
63
+
```bash
64
+
pip install pipx
65
+
pipx ensurepath
66
+
pipx install uv
67
+
```
68
+
69
+
***Using `cargo` (if you have Rust installed):**
70
+
```bash
71
+
cargo install uv
72
+
```
73
+
74
+
For more detailed installation instructions, please refer to the [uv documentation](https://github.com/astral-sh/uv#installation).
75
+
76
+
## Instructions
77
+
78
+
### 1. Download the setup script
79
+
80
+
You can find the raw Python script here: [`setup_notebook_env.py`](https://raw.githubusercontent.com/intro-stat-learning/ISLP_labs/main/setup_notebook_env.py)
81
+
82
+
To download and run it, first ensure `uv` is installed (see Prerequisites above), then execute the following commands in your terminal:
uv run python setup_notebook_env.py --outdir ISLP_v2.2.1 --commit v2.2.1 --python-version 3.12
87
+
```
88
+
89
+
### 2. Run the setup script
90
+
91
+
Open your terminal and run the following command to set up the environment for version `v2.2.1` of the labs with Python `3.12`. You can also specify one or more notebooks to run automatically after setup.
92
+
93
+
*`--outdir ISLP_v2.2.1`: This will create a directory named `ISLP_v2.2.1`for your labs.
94
+
*`--commit v2.2.1`: This specifies that you want to use version `v2.2.1` of the labs.
95
+
*`--python-version 3.12`: This will use Python 3.12 for the environment.
96
+
*`Ch02-statlearn-lab.ipynb`: This is an optional argument to run a specific notebook after the setup is complete. It is meant for testing to be sure given notebooks run but is not required. You can list more than one notebook.
97
+
98
+
### 2. Activate the environment
99
+
100
+
Once the script is finished, you can activate the virtual environment to run other notebooks or work with the lab materials.
101
+
102
+
***On macOS and Linux:**
103
+
```bash
104
+
source ISLP_v2.2.1/.venv/bin/activate
105
+
```
106
+
107
+
***On Windows:**
108
+
```bash
109
+
ISLP_v2.2.1\.venv\Scripts\activate
110
+
```
111
+
112
+
### 3. Run other notebooks
113
+
114
+
After activating the environment, you can start Jupyter Lab to run other notebooks.
0 commit comments