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:
Thomas Schmelzer
2025-04-10 03:21:56 +04:00
committed by Jonathan Taylor
parent a42e928a33
commit fe779b385a
9 changed files with 58 additions and 67 deletions

View 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
View 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

View File

@@ -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

View File

@@ -1,5 +0,0 @@
.github
.git
.docker
.dockerignore
*.Rmd

View File

@@ -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
View 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 }}

View File

@@ -37,11 +37,10 @@ jobs:
with:
version: "0.5.15"
#- name: Set up Python
# shell: bash
# run: |
# uv python install ${{ matrix.python-version }}
- name: Set up Python
shell: bash
run: |
uv python install ${{ matrix.python-version }}
- name: Create venv
shell: bash

1
.gitignore vendored
View File

@@ -49,3 +49,4 @@ share/python-wheels/
# IDEs
.vscode/
.idea/

View File

@@ -1,4 +1,7 @@
# ISLP_labs
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/intro-stat-learning/ISLP_Labs)
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
@@ -10,8 +13,6 @@
- Robert Tibshirani
- Daniela Witten
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/intro-stat-learning/ISLP_labs/v2.2)
### 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.
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.
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;
```
The labs can now be run from this directory:
The labs can now be run via:
```
jupyter lab Ch02-statlearn-lab.ipynb