Skip to content

Commit 9e54517

Browse files
Dev container (#36)
* Create .python-version * Create .gitignore * Create Makefile * remove Dockerfile * remove docker workflow * startup.sh * devcontainer * README with link * Update Makefile * obsolete python-version * Update README.md * Update README.md * Update README.md * Update devcontainer.json no browser option for devContainer * introducing a first test * introducing a first test * introducing a manual release job * introducing a manual release job * Update README.md --------- Co-authored-by: Jonathan Taylor <[email protected]>
1 parent ae63016 commit 9e54517

File tree

10 files changed

+137
-62
lines changed

10 files changed

+137
-62
lines changed

.devcontainer/devcontainer.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "Jupyter Environment",
3+
"image": "mcr.microsoft.com/devcontainers/python:3",
4+
"features": {
5+
"ghcr.io/devcontainers/features/python:1": {}
6+
},
7+
"customizations": {
8+
"vscode": {
9+
"extensions": [
10+
"ms-python.python",
11+
"ms-toolsai.jupyter",
12+
"ms-toolsai.jupyter-keymap",
13+
"ms-toolsai.jupyter-renderers",
14+
"ms-toolsai.vscode-jupyter-cell-tags",
15+
"ms-toolsai.vscode-jupyter-slideshow"
16+
]
17+
}
18+
},
19+
"onCreateCommand": ".devcontainer/startup.sh",
20+
"forwardPorts": [8888],
21+
"postStartCommand": "uv run jupyter lab --no-browser --ip=0.0.0.0 --port=8888 --NotebookApp.token='' --NotebookApp.password=''"
22+
}

.devcontainer/startup.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
curl -LsSf https://astral.sh/uv/install.sh | sh
3+
uv venv --python 3.12
4+
uv pip install --no-cache-dir jupyterlab
5+
uv pip install --no-cache-dir -r requirements.txt

.docker/Dockerfile

Lines changed: 0 additions & 11 deletions
This file was deleted.

.dockerignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/docker.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Bump version and publish
2+
3+
on:
4+
#push:
5+
workflow_dispatch
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
tagging:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
new_tag: ${{ steps.tag_step.outputs.new_tag }}
15+
16+
steps:
17+
- name: Generate Tag
18+
id: tag_step
19+
uses: tschm/cradle/actions/[email protected]
20+
with:
21+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# testing all notebooks
2+
name: TEST
3+
4+
on:
5+
- push
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
11+
strategy:
12+
matrix:
13+
python-version: ['3.11', '3.12']
14+
#notebook: [ Ch02-statlearn-lab.ipynb ]. # Ch02 is tricky but we have a solution for it
15+
notebook: [ Ch03-linreg-lab.ipynb ]
16+
# Ch04-classification-lab.ipynb,
17+
# Ch05-resample-lab.ipynb,
18+
# Ch06-varselect-lab.ipynb,
19+
# Ch07-nonlin-lab.ipynb,
20+
# Ch08-baggboost-lab.ipynb,
21+
# Ch09-svm-lab.ipynb,
22+
# Ch10-deeplearning-lab.ipynb,
23+
# Ch11-surv-lab.ipynb,
24+
# Ch12-unsup-lab.ipynb,
25+
# Ch13-multiple-lab.ipynb]
26+
#exclude:
27+
# - python-version: '3.11'
28+
# notebook: Ch10-deeplearning-lab.ipynb
29+
30+
fail-fast: false
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Install uv
36+
uses: astral-sh/setup-uv@v5
37+
#with:
38+
# version: "0.5.15"
39+
40+
41+
#- name: Set up Python
42+
# shell: bash
43+
# run: |
44+
# uv python install ${{ matrix.python-version }}
45+
46+
- name: Create venv
47+
shell: bash
48+
run: uv venv --python ${{ matrix.python-version }}
49+
50+
- name: Install requirements
51+
shell: bash
52+
run: |
53+
uv pip install --upgrade pip
54+
uv pip install -r requirements.txt
55+
uv pip install pytest nbmake
56+
57+
- name: Test
58+
shell: bash
59+
run: |
60+
uv run pytest --nbmake --nbmake-timeout=3600 -vv ${{ matrix.notebook }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,4 @@ share/python-wheels/
4949
# IDEs
5050
.vscode/
5151
.idea/
52+

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.DEFAULT_GOAL := help
2+
3+
venv:
4+
@curl -LsSf https://astral.sh/uv/install.sh | sh
5+
@uv venv --python 3.12
6+
7+
8+
.PHONY: install
9+
install: venv ## Install all dependencies (in the virtual environment) defined in requirements.txt
10+
@uv pip install --upgrade pip
11+
@uv pip install -r requirements.txt
12+
13+
14+
.PHONY: help
15+
help: ## Display this help screen
16+
@echo -e "\033[1mAvailable commands:\033[0m"
17+
@grep -E '^[a-z.A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}' | sort
18+
19+
20+
.PHONY: jupyter
21+
jupyter: install ## Install and start jupyter Lab
22+
@uv run pip install jupyterlab
23+
@uv run jupyter lab

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# ISLP_labs
2+
3+
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/intro-stat-learning/ISLP_Labs)
4+
25
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
36
[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)
47
<!-- ALL-CONTRIBUTORS-BADGE:END -->
@@ -10,8 +13,6 @@
1013
- Robert Tibshirani
1114

1215
- Daniela Witten
13-
14-
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/intro-stat-learning/ISLP_labs/v2.2)
1516

1617
### ISLP
1718

@@ -23,7 +24,7 @@ if necessary, which is not included as a requirement of the labs.
2324
### Up-to-date version of labs for ISLP.
2425

2526
This repo will track labs for ISLP as their source code changes. The
26-
intent is that building a conda environment with
27+
intent is that building a virtual environment with
2728
`requirements.txt` will reproduce the results in this repo.
2829

2930
To install the current version of the requirements run
@@ -32,7 +33,7 @@ To install the current version of the requirements run
3233
pip install -r https://raw.githubusercontent.com/intro-stat-learning/ISLP_labs/v2.2/requirements.txt;
3334
```
3435

35-
The labs can now be run from this directory:
36+
The labs can now be run via:
3637

3738
```
3839
jupyter lab Ch02-statlearn-lab.ipynb

0 commit comments

Comments
 (0)