Codespaces
In class we built a data science environment in the cloud and ran JupyterLab inside it. This page walks through every step so you can do it on your own. At the end you will have your own copy of the class repo with a hello world notebook in it. That is the turn-in for this unit.
The class repo is UNC-BIOS-512/codespace.
1. Make a GitHub account
You need a free GitHub account. Sign up at github.com/signup. Use an email you check.
2. Fork the class repo
A fork is your own copy of a repo. You can change it without touching the original.
Click the badge. Leave the settings as they are and click Create fork. GitHub takes you to your copy. The address looks like github.com/YOUR-USERNAME/codespace.
3. Open a Codespace on your fork
A Codespace is a computer in the cloud that you use from your browser. It runs VS Code, has a terminal, and comes with the tools the repo asks for. The class repo’s container already has pixi installed.
On your fork’s page, click the green Code button, then the Codespaces tab, then Create codespace on main. The first build takes a couple of minutes.
If GitHub asks you for a secret named LITELLM_API_KEY, leave it blank and continue. We will use it in a later lesson.
When it opens, you see VS Code in your browser. The terminal is the black panel at the bottom. If you do not see it, press Ctrl+` (Control and backtick). You type every command on this page into the terminal.

$, then press Enter.4. Build your environment with pixi
pixi is a package manager. It installs Python, R, and their packages into a folder inside the project. You get to choose what goes in. Run these in the terminal:
pixi init .
pixi add jupyterlab xeus-r r-tidyverse r-palmerpenguins
pixi shellpixi init .creates apixi.tomlfile that lists your project’s packages.pixi add ...installs JupyterLab, an R kernel (xeus-r), the tidyverse, and the penguins data. Add more packages later withpixi add NAME.pixi shellputs you inside the environment sojupyterandRare on your path.
5. Start JupyterLab
jupyter lab --ip=0.0.0.0 --port=8888 --no-browser --IdentityProvider.token='' --ServerApp.password=''Codespaces will pop up a notification about port 8888 with an Open in Browser button. Do not use that button. It often fails with a login error. Do this instead:
- Click the Ports tab next to the Terminal tab.
- Find the row for port 8888.
- Hover over that row and click the globe icon. That opens JupyterLab in a new browser tab.

The globe always works. If JupyterLab ever shows a blank page or a login error, come back here and click the globe again.
The token and password flags turn off login. That is fine here because only you can reach the Codespace.
6. Make a hello world notebook
In JupyterLab:
- In the file browser on the left, double-click the
notebooksfolder. - Click the big blue + button, then pick the R kernel under Notebook.
- In the first cell, type this and press Shift+Enter to run it:
print("Hello, world!")- Add a second cell that loads the penguins data and shows the first rows:
library(palmerpenguins)
head(penguins)- Save the notebook with Ctrl+S, then right-click its tab and choose Rename Notebook. Name it
hello-world.ipynb.
7. Commit and push to your fork
Your notebook only exists inside the Codespace right now. To put it on GitHub you commit it (save a snapshot) and push it (send the snapshot to GitHub). Go back to the VS Code tab:
- Click the Source Control icon on the left bar. It looks like three connected dots.
- You will see
notebooks/hello-world.ipynb,pixi.toml, andpixi.lockin the list. Hover over Changes and click the + to stage them all. - Type a short message in the box at the top, like
add hello world notebook. - Click Commit, then click Sync Changes. If VS Code asks whether to push, say yes.
Open your fork on GitHub and refresh. You should see the notebooks folder with hello-world.ipynb inside.
8. Turn it in
Copy the address of your fork, like https://github.com/YOUR-USERNAME/codespace, and paste it into the Canvas assignment.
Things to know
- Codespaces uses free hours. Personal GitHub accounts get a monthly allowance. Stop your Codespace when you are done: click the Codespaces menu in the bottom-left corner and choose Stop Current Codespace.
- Your work stays in the Codespace until you push. Commit and push often.
- Coming back later. Your Codespace keeps your files and your pixi environment. Open it from github.com/codespaces. Run
pixi shelland the JupyterLab command again. - Plot size. The repo’s
.Rprofilesets a default plot size and resolution for R plots in notebooks.
