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 <jonathan.taylor@stanford.edu>
This commit is contained in:
22
.devcontainer/devcontainer.json
Normal file
22
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"name": "Jupyter Environment",
|
||||||
|
"image": "mcr.microsoft.com/devcontainers/python:3",
|
||||||
|
"features": {
|
||||||
|
"ghcr.io/devcontainers/features/python:1": {}
|
||||||
|
},
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"extensions": [
|
||||||
|
"ms-python.python",
|
||||||
|
"ms-toolsai.jupyter",
|
||||||
|
"ms-toolsai.jupyter-keymap",
|
||||||
|
"ms-toolsai.jupyter-renderers",
|
||||||
|
"ms-toolsai.vscode-jupyter-cell-tags",
|
||||||
|
"ms-toolsai.vscode-jupyter-slideshow"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"onCreateCommand": ".devcontainer/startup.sh",
|
||||||
|
"forwardPorts": [8888],
|
||||||
|
"postStartCommand": "uv run jupyter lab --no-browser --ip=0.0.0.0 --port=8888 --NotebookApp.token='' --NotebookApp.password=''"
|
||||||
|
}
|
||||||
5
.devcontainer/startup.sh
Executable file
5
.devcontainer/startup.sh
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
|
uv venv --python 3.12
|
||||||
|
uv pip install --no-cache-dir jupyterlab
|
||||||
|
uv pip install --no-cache-dir -r requirements.txt
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
FROM docker.io/jupyter/base-notebook:lab-4.0.5
|
|
||||||
|
|
||||||
COPY requirements.txt .
|
|
||||||
|
|
||||||
# Install Python deps, the user approach is documented here:
|
|
||||||
# https://pythonspeed.com/articles/multi-stage-docker-python/
|
|
||||||
RUN pip install --user --no-cache-dir -r requirements.txt
|
|
||||||
|
|
||||||
COPY --chown=jovyan:users . ${HOME}/work
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
.github
|
|
||||||
.git
|
|
||||||
.docker
|
|
||||||
.dockerignore
|
|
||||||
*.Rmd
|
|
||||||
42
.github/workflows/docker.yml
vendored
42
.github/workflows/docker.yml
vendored
@@ -1,42 +0,0 @@
|
|||||||
name: Publish Docker image
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- stable
|
|
||||||
tags:
|
|
||||||
- v*
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
push_to_registry:
|
|
||||||
name: Push Docker image to Docker Hub
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Check out the repo
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Log in to Docker Hub
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v4
|
|
||||||
with:
|
|
||||||
images: jetaylor74/islp_labs
|
|
||||||
tags: |
|
|
||||||
type=ref,event=branch
|
|
||||||
type=semver,pattern={{raw}}
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v4
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: .docker/Dockerfile
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
21
.github/workflows/release.yml
vendored
Normal file
21
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
name: Bump version and publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
#push:
|
||||||
|
workflow_dispatch
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
tagging:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
new_tag: ${{ steps.tag_step.outputs.new_tag }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Generate Tag
|
||||||
|
id: tag_step
|
||||||
|
uses: tschm/cradle/actions/tag@v0.1.57
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
60
.github/workflows/test.yml
vendored
Normal file
60
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
# testing all notebooks
|
||||||
|
name: TEST
|
||||||
|
|
||||||
|
on:
|
||||||
|
- push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: ['3.11', '3.12']
|
||||||
|
#notebook: [ Ch02-statlearn-lab.ipynb ]. # Ch02 is tricky but we have a solution for it
|
||||||
|
notebook: [ Ch03-linreg-lab.ipynb ]
|
||||||
|
# Ch04-classification-lab.ipynb,
|
||||||
|
# Ch05-resample-lab.ipynb,
|
||||||
|
# Ch06-varselect-lab.ipynb,
|
||||||
|
# Ch07-nonlin-lab.ipynb,
|
||||||
|
# Ch08-baggboost-lab.ipynb,
|
||||||
|
# Ch09-svm-lab.ipynb,
|
||||||
|
# Ch10-deeplearning-lab.ipynb,
|
||||||
|
# Ch11-surv-lab.ipynb,
|
||||||
|
# Ch12-unsup-lab.ipynb,
|
||||||
|
# Ch13-multiple-lab.ipynb]
|
||||||
|
#exclude:
|
||||||
|
# - python-version: '3.11'
|
||||||
|
# notebook: Ch10-deeplearning-lab.ipynb
|
||||||
|
|
||||||
|
fail-fast: false
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install uv
|
||||||
|
uses: astral-sh/setup-uv@v5
|
||||||
|
#with:
|
||||||
|
# version: "0.5.15"
|
||||||
|
|
||||||
|
|
||||||
|
#- name: Set up Python
|
||||||
|
# shell: bash
|
||||||
|
# run: |
|
||||||
|
# uv python install ${{ matrix.python-version }}
|
||||||
|
|
||||||
|
- name: Create venv
|
||||||
|
shell: bash
|
||||||
|
run: uv venv --python ${{ matrix.python-version }}
|
||||||
|
|
||||||
|
- name: Install requirements
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
uv pip install --upgrade pip
|
||||||
|
uv pip install -r requirements.txt
|
||||||
|
uv pip install pytest nbmake
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
uv run pytest --nbmake --nbmake-timeout=3600 -vv ${{ matrix.notebook }}
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -49,3 +49,4 @@ share/python-wheels/
|
|||||||
# IDEs
|
# IDEs
|
||||||
.vscode/
|
.vscode/
|
||||||
.idea/
|
.idea/
|
||||||
|
|
||||||
|
|||||||
23
Makefile
Normal file
23
Makefile
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
.DEFAULT_GOAL := help
|
||||||
|
|
||||||
|
venv:
|
||||||
|
@curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
|
@uv venv --python 3.12
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: install
|
||||||
|
install: venv ## Install all dependencies (in the virtual environment) defined in requirements.txt
|
||||||
|
@uv pip install --upgrade pip
|
||||||
|
@uv pip install -r requirements.txt
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: help
|
||||||
|
help: ## Display this help screen
|
||||||
|
@echo -e "\033[1mAvailable commands:\033[0m"
|
||||||
|
@grep -E '^[a-z.A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}' | sort
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: jupyter
|
||||||
|
jupyter: install ## Install and start jupyter Lab
|
||||||
|
@uv run pip install jupyterlab
|
||||||
|
@uv run jupyter lab
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
# ISLP_labs
|
# ISLP_labs
|
||||||
|
|
||||||
|
[](https://codespaces.new/intro-stat-learning/ISLP_Labs)
|
||||||
|
|
||||||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
||||||
[](#contributors-)
|
[](#contributors-)
|
||||||
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
||||||
@@ -10,8 +13,6 @@
|
|||||||
- Robert Tibshirani
|
- Robert Tibshirani
|
||||||
|
|
||||||
- Daniela Witten
|
- Daniela Witten
|
||||||
|
|
||||||
[](https://mybinder.org/v2/gh/intro-stat-learning/ISLP_labs/v2.2)
|
|
||||||
|
|
||||||
### ISLP
|
### ISLP
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ if necessary, which is not included as a requirement of the labs.
|
|||||||
### Up-to-date version of labs for ISLP.
|
### Up-to-date version of labs for ISLP.
|
||||||
|
|
||||||
This repo will track labs for ISLP as their source code changes. The
|
This repo will track labs for ISLP as their source code changes. The
|
||||||
intent is that building a conda environment with
|
intent is that building a virtual environment with
|
||||||
`requirements.txt` will reproduce the results in this repo.
|
`requirements.txt` will reproduce the results in this repo.
|
||||||
|
|
||||||
To install the current version of the requirements run
|
To install the current version of the requirements run
|
||||||
@@ -32,7 +33,7 @@ To install the current version of the requirements run
|
|||||||
pip install -r https://raw.githubusercontent.com/intro-stat-learning/ISLP_labs/v2.2/requirements.txt;
|
pip install -r https://raw.githubusercontent.com/intro-stat-learning/ISLP_labs/v2.2/requirements.txt;
|
||||||
```
|
```
|
||||||
|
|
||||||
The labs can now be run from this directory:
|
The labs can now be run via:
|
||||||
|
|
||||||
```
|
```
|
||||||
jupyter lab Ch02-statlearn-lab.ipynb
|
jupyter lab Ch02-statlearn-lab.ipynb
|
||||||
|
|||||||
Reference in New Issue
Block a user