Skip to content

Commit a61ea90

Browse files
authored
Merge pull request #18 from stefmolin/devcontainer
Add devcontainer configuration.
2 parents abff8f5 + f9326d9 commit a61ea90

14 files changed

+126
-9
lines changed

.devcontainer/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
ARG VARIANT=2
2+
FROM mcr.microsoft.com/devcontainers/universal:${VARIANT}
3+
4+
# Create the conda environment
5+
COPY environment.yml /tmp/conda-tmp/
6+
RUN conda env create --file /tmp/conda-tmp/environment.yml --quiet
7+
8+
# Update PATH for Jupyter editing option
9+
ENV PATH="/opt/conda/envs/pandas_workshop/bin:${PATH}"

.devcontainer/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Welcome to the devcontainer for Introduction to Data Analysis Using Python!
2+
3+
**IMPORTANT**: Open this file using the preview option to render the images (right-click the file in the left sidebar, and click **Open Preview**).
4+
5+
---
6+
7+
You will be running through the workshop in [Visual Studio Code](https://code.visualstudio.com/) using the Jupyter extension to interact with Jupyter Notebooks. Each time you open a new Jupyter Notebook, you will need to select the kernel (specify the virtual environment to use).
8+
9+
Start by opening up the [`notebooks/0-check_your_env.ipynb`](../notebooks/0-check_your_env.ipynb) notebook and clicking the **Select Kernel** button at the top right:
10+
11+
<img width="1000px" src="../media/devcontainer-select-kernel.png" alt="selecting a kernel">
12+
13+
Select the **Python Environments...** option:
14+
15+
<img width="600px" src="../media/devcontainer-python-environments-select.png" alt="initial options in select kernel menu">
16+
17+
Select the **pandas_workshop** option (the Python version can vary):
18+
19+
<img width="600px" src="../media/devcontainer-conda-env-select.png" alt="selecting a virtual environment">
20+
21+
Use `pandas_workshop` for all subsequent notebooks. Note that you can close the bottom panel (**TERMINAL**) for more space.

.devcontainer/devcontainer.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "Pandas Workshop",
3+
4+
"build": {
5+
"context": "..",
6+
"dockerfile": "Dockerfile"
7+
},
8+
9+
"hostRequirements": {
10+
"cpus": 4,
11+
"memory": "8gb",
12+
"storage": "32gb"
13+
},
14+
15+
// Configure tool-specific properties.
16+
"customizations": {
17+
18+
// Configure how codespaces will open
19+
"codespaces": {
20+
"openFiles": [
21+
".devcontainer/README.md"
22+
]
23+
},
24+
25+
// Configure properties specific to VS Code.
26+
"vscode": {
27+
// Set *default* container specific settings.json values on container create.
28+
"settings": {
29+
"python.defaultInterpreterPath": "/opt/conda/envs/pandas_workshop"
30+
},
31+
32+
// Add the IDs of extensions you want installed when the container is created.
33+
"extensions": [
34+
"ms-python.python",
35+
"ms-toolsai.jupyter"
36+
]
37+
}
38+
}
39+
}

README.md

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Pandas Workshop
22

3-
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/stefmolin/pandas-workshop/main?urlpath=lab/tree/notebooks) [![Nbviewer](https://img.shields.io/badge/render-nbviewer-lightgrey?logo=jupyter)](https://nbviewer.jupyter.org/github/stefmolin/pandas-workshop/tree/main/) [![Env Build Workflow Status](https://img.shields.io/github/actions/workflow/status/stefmolin/pandas-workshop/env-checks.yml?label=env%20build&logo=github&logoColor=white)](https://github.com/stefmolin/pandas-workshop/actions/workflows/env-checks.yml) ![GitHub repo size](https://img.shields.io/github/repo-size/stefmolin/pandas-workshop?logo=git&logoColor=white) [![View slides in browser](https://img.shields.io/badge/view-slides-orange?logo=reveal.js&logoColor=white)](https://stefmolin.github.io/pandas-workshop/slides/html/workshop.slides.html#/)
3+
[![Nbviewer](https://img.shields.io/badge/render-nbviewer-lightgrey?logo=jupyter)](https://nbviewer.jupyter.org/github/stefmolin/pandas-workshop/tree/main/) [![Env Build Workflow Status](https://img.shields.io/github/actions/workflow/status/stefmolin/pandas-workshop/env-checks.yml?label=env%20build&logo=github&logoColor=white)](https://github.com/stefmolin/pandas-workshop/actions/workflows/env-checks.yml) ![GitHub repo size](https://img.shields.io/github/repo-size/stefmolin/pandas-workshop?logo=git&logoColor=white) [![View slides in browser](https://img.shields.io/badge/view-slides-orange?logo=reveal.js&logoColor=white)](https://stefmolin.github.io/pandas-workshop/slides/html/workshop.slides.html#/)
44

55
Working with data can be challenging: it often doesn’t come in the best format for analysis, and understanding it well enough to extract insights requires both time and the skills to filter, aggregate, reshape, and visualize it. This session will equip you with the knowledge you need to effectively use pandas – a powerful library for data analysis in Python – to make this process easier.
66

@@ -30,18 +30,25 @@ You should have basic knowledge of Python and be comfortable working in Jupyter
3030
---
3131

3232
## Setup Instructions
33+
You can work through the notebooks locally or in your browser. Pick the installation option that makes sense for you.
34+
35+
### Local Installation
3336
**Warning**: It is highly recommended that you use your personal laptop for the installation.
3437

3538
0. Install Python >= version 3.8 and <= version 3.11 OR install [Anaconda](https://docs.anaconda.com/anaconda/install/)/[Miniconda](https://docs.conda.io/en/latest/miniconda.html). Note that Anaconda/Miniconda is recommended if you are working on a Windows machine and are not very comfortable with the command line. Alternatively, depending on server availability, you can use [this](https://mybinder.org/v2/gh/stefmolin/pandas-workshop/main?urlpath=lab) Binder environment if you don't want to install anything on your machine.
3639
1. Fork this repository:
3740

3841
![location of fork button in GitHub](./media/fork_button.png)
3942

40-
2. Clone your forked repository:
43+
2. Navigate to your fork, and click the **Code** button:
44+
45+
![location of code button in GitHub](./media/code_button.png)
46+
47+
3. Clone your forked repository using the desired method from the **Local** tab:
4148

42-
![location of clone button in GitHub](./media/clone_button.png)
49+
<img width="400px" src="./media/clone_options.png" alt="local cloning options">
4350

44-
3. Create and activate a Python virtual environment:
51+
4. Create and activate a Python virtual environment:
4552
- If you installed Anaconda/Miniconda, use `conda` (on Windows, these commands should be run in **Anaconda Prompt**):
4653

4754
```shell
@@ -60,20 +67,57 @@ You should have basic knowledge of Python and be comfortable working in Jupyter
6067
(pandas_workshop) ~/pandas-workshop$ pip3 install -r requirements.txt
6168
```
6269

63-
4. Launch JupyterLab:
70+
5. Launch JupyterLab:
6471

6572
```shell
6673
(pandas_workshop) ~/pandas-workshop$ jupyter lab
6774
```
6875

69-
5. Navigate to the `0-check_your_env.ipynb` notebook in the `notebooks/` folder:
76+
6. Navigate to the `0-check_your_env.ipynb` notebook in the `notebooks/` folder:
7077

7178
![open 0-check_your_env.ipynb](./media/open_env_check_notebook.png)
7279

73-
6. Run the notebook to confirm everything is set up properly:
80+
7. Run the notebook to confirm everything is set up properly:
7481

7582
![check env](./media/env_check.png)
7683

84+
85+
### Cloud Options
86+
87+
#### GitHub Codespaces
88+
89+
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/stefmolin/pandas-workshop)
90+
91+
The [GitHub Codespaces](https://github.com/features/codespaces) setup provides a pre-configured machine accessible via your browser. You will need a GitHub account and available quota (all users get more than enough free monthly quota to be able to run this workshop). Note that this will take a while to build. It's recommended that you click the badge above to build the codespace in advance of the workshop and then [stop the codespace](https://docs.github.com/en/codespaces/developing-in-codespaces/stopping-and-starting-a-codespace) until the workshop, at which point you can simply resume and pick up where you left off.
92+
93+
Note that if you want to save your changes, you will need to fork the repository before creating the codespace. You will then be able to commit your changes directly from the codespace. Be sure to create your codespace in advance of the session and resume when we start.
94+
95+
1. Fork this repository:
96+
97+
![location of fork button in GitHub](./media/fork_button.png)
98+
99+
2. Navigate to your fork, and click the **Code** button:
100+
101+
![location of code button in GitHub](./media/code_button.png)
102+
103+
3. Launch the codespace from your fork by clicking on the **+** or **Create codespace on main** button in the **Codespaces** tab:
104+
105+
<img width="400px" src="./media/create_codespace.png" alt="location of create codespace button">
106+
107+
4. Stop the codespace until the session starts by selecting **Stop codespace** from the **...** menu.
108+
109+
<img width="400px" src="./media/stop-codespace.png" alt="stop codespace">
110+
111+
5. To resume the codespace, click **Open in ...** and then select your preferred method. If you aren't sure, select JupyterLab.
112+
113+
<img width="400px" src="./media/resume-codespace.png" alt="resuming a codespace">
114+
115+
#### Binder
116+
117+
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/stefmolin/pandas-workshop/main?urlpath=lab/tree/notebooks)
118+
119+
Depending on server availability, you can use [this](https://mybinder.org/v2/gh/stefmolin/pandas-workshop/main?urlpath=lab) Binder environment, which does not require the creation of a GitHub account. **There is no guarantee that you will be able to access this during the workshop.**
120+
77121
---
78122

79123
## About the Author

media/clone_options.png

77.9 KB
Loading
File renamed without changes.

media/create_codespace.png

83.1 KB
Loading
57.9 KB
Loading
Loading

media/devcontainer-select-kernel.png

218 KB
Loading

0 commit comments

Comments
 (0)