Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions .binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,42 @@ channels:
- conda-forge
- nodefaults
dependencies:
# !! you can only use single `=` to set a version. Otherwise it will break the update job
- invoke=2.2.0
- packaging
- pyyaml
- ruamel.yaml
# applications
- jupyterlab=4.1.8
- jupyter-collaboration=2.1.1
- nbconvert=7.16.4
- notebook=7.1.3
- jupyterlab
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to pin it to >=4.3.5? Currently it resolves to

image

If we are giving a demo of jupyterlab, it feels like this one package should probably be pinned as we would not want to receive reports for things already fixed in newer versions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krassowski I dug into why it was resolving to this, and it's because that's the base version in repo2docker - last updated in jupyterhub/repo2docker#1369. I agree that we should try to use latest jupyterlab here if possible. If we pin to >=4.3.5, it means that when repo2docker goes to a version above 4.3.5, it'll simply just get pinned to that rather than latest. Do you know if there's a way to specify 'latest' with a conda environment.yml?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krassowski ok, so I've made jupyterhub/repo2docker#1407 which bumps up all versions of things, including lab to 4.3.5. For this PR, my suggestion is that we either find a way to specify 'latest' or let it be unpinned, as once that repo2docker PR lands >=4.3.5 is a no-op

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've checked with a colleague working on conda and it seems there is no way to specify latest but if we had an option to customize the CLI invocation we could use --prune to ignore constraints from currently installed versions.

- jupyter-collaboration
- nbconvert
- notebook
# extensions
- jupyter-offlinenotebook=0.3.1
- jupyterlab-fasta=3.3
- jupyterlab-geojson=3.4
- jupyter-offlinenotebook
- jupyterlab-fasta
- jupyterlab-geojson
# R kernel
- r-irkernel
- r-ggplot2
# Python Kernel
- ipykernel=6.29.3
- xeus-python=0.14.3
- ipywidgets=8
- ipyleaflet=0.19.1
- altair=5.3.0
- bqplot=0.12.43
- dask=2024.5.0
- matplotlib-base=3.8.4
- pandas=2.2.2
- python=3.9
- scikit-image=0.22.0
- scikit-learn=1.4.2
- seaborn-base=0.13.2
- tensorflow=2.11.0
- sympy=1.12
- traittypes=0.2.1
- ipykernel
- xeus-python
- ipywidgets
- ipyleaflet
- altair
- bqplot
- dask
- matplotlib-base
- pandas
- python=3.12
- scikit-image
- scikit-learn
- seaborn-base
- tensorflow
- sympy
- traittypes
# C++ Kernel
- xeus-cling=0.13.0
- xtensor=0.23.10
- xtensor-blas=0.19.2
- xwidgets=0.26.1
- xleaflet=0.16.0
# - xeus-cling
# - xtensor
# - xtensor-blas
# - xwidgets
# - xleaflet
# CLI tools
- pip
- vim
5 changes: 2 additions & 3 deletions .binder/postBuild
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
set -ex

# invoke r --env-name=notebook
invoke demofiles
invoke talk -t demo
python build.py

rm -rf demofiles
rm -rf notebooks
rm -rf narrative
Expand Down
37 changes: 10 additions & 27 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache conda
uses: actions/cache@v3
env:
# Increase this value to reset cache if .binder/environment.yml has not changed
CACHE_NUMBER: 0
- name: Install mamba
uses: mamba-org/setup-micromamba@v1
with:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('.binder/environment.yml') }}
- uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: ">=1.4.0"
# Defaults is added automatically
channels: conda-forge
channel-priority: "strict"
activate-environment: jupyterlab-demo
micromamba-version: '1.5.1-0'
environment-file: .binder/environment.yml
# The following option is blocking the environment resolution (newer versions are not found)
# use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
environment-name: jupyterlab-demo
cache-environment: true
- run: |
conda info
conda list
conda config --show-sources
conda config --show
micromamba info
micromamba list
micromamba config sources
micromamba config list
printenv | sort
- run: |
invoke r --env-name=jupyterlab-demo
jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=60 --stdout notebooks/Data.ipynb > /dev/null;
jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=60 --stdout notebooks/Fasta.ipynb > /dev/null;
jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=60 --stdout notebooks/R.ipynb > /dev/null;
invoke demofiles
invoke talk -t demo
jupyter lab workspaces import .binder/workspace.json
python -m jupyterlab.browser_check
invoke clean
python build.py
68 changes: 0 additions & 68 deletions .github/workflows/update_env.yml

This file was deleted.

73 changes: 2 additions & 71 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,84 +13,15 @@ generation user interface of Project Jupyter.
The demo requires `mamba`, available as part of [Mambaforge](https://github.com/conda-forge/miniforge) and the package
requirements are described in `environment.yml`

To install the environment and demofiles, we use [pyinvoke](http://pyinvoke.org). To install pyinvoke with `mamba` call:
```bash
mamba install -c conda-forge invoke packaging pyyaml
```

### Create the environment

To create the conda environment with all the dependencies and jupyterlab extensions for the demo, run:

```bash
invoke environment # optionally --env-name=my-env-name
```

The default environment name is `jupyterlab-demo`.

To create the environment and remove previous installation, call:

```bash
invoke environment --clean
```

### Activate/deactivate the environment

To activate the conda environment, run:

```bash
source activate jupyterlab-demo
```

To deactivate the conda environment, run:

```bash
source deactivate
```

### Additional demo files

The demo includes files from a number of other repositories. To install these files,
run:

```bash
invoke demofiles
```

To remove demofiles and download again all:
```
invoke demofiles --clean
```

### R Language support

To add R language support, run:

```bash
invoke r
```

### Julia Language support

To add Julia language support follow the instructions [here](https://github.com/JuliaLang/IJulia.jl#installation).


### Uninstalling

To uninstall the demofiles and enviornment, call:

```
invoke clean
```
TODO: More installation instructions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to keep this TODO in the readme or open an issue instead?


# Demo guide

The basic outline of the JupyterLab demo is described in the file `jupyterlab.md`.


# External Repositories

Our `invoke demofiles` clones repos from other authors. The details of these repos are as follows:
Our `build.py` clones repos from other authors. The details of these repos are as follows:

| Name | Author |License |
|---|---|---|
Expand Down
96 changes: 96 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/usr/bin/env python3
from pathlib import Path
import subprocess
from ruamel.yaml import YAML
import shutil
import os

yaml = YAML()

DEMO_FOLDER = "demofiles"

def setup_talks():
"""
Reads yaml file talks.yml and moves files and folders specified in yaml
file to the a folder matching the name of the talk Args: talk_name: name
of talk in talks.yml Note: yaml file is assumed to be a dict of dicts of
lists and dict with the following python format:
{'talk_name':
{'folders':
{'src0': 'dest0', 'src1': 'dest1']
'files':
['file0', file1']
'rename':
{'oldname': 'newname'}
}
}
or in yaml format:
talk_name:
folders:
src0: dest0
src1: dest1
files:
- file0
- file1
rename:
oldname: newname
"""
with open("talks.yml", "r") as stream:
talks = yaml.load(stream)
for talk_name in talks:
Path(talk_name).mkdir(parents=True, exist_ok=True)

if "files" in talks[talk_name]:
for f in talks[talk_name]["files"]:
copied_path = os.path.join(talk_name, os.path.basename(f))
shutil.copy(f, copied_path)
assert os.path.isfile(copied_path), f"{f} failed to copy into {talk_name}"

if "folders" in talks[talk_name]:
for src, dst in talks[talk_name]["folders"].items():
dst = os.path.join(talk_name, dst)
if not os.path.exists(dst):
shutil.copytree(src, dst)

if "rename" in talks[talk_name]:
for old_file, new_file in talks[talk_name]["rename"].items():
moved_file = os.path.join(talk_name, os.path.basename(old_file))
if os.path.isfile(moved_file):
os.rename(moved_file, os.path.join(talk_name, new_file))
elif os.path.isfile(old_file):
shutil.copy(old_file, os.path.join(talk_name, new_file))

def setup_demofiles():
print("creating demofolder")
demo_folder = Path("demofiles")
demo_folder.mkdir(parents=True, exist_ok=True)

# list of repos used in demo
print(f"cloning repos into demo folder {demo_folder}")
reponames = [
"jakevdp/PythonDataScienceHandbook",
"swissnexSF/Urban-Data-Challenge",
"altair-viz/altair",
"QuantEcon/QuantEcon.notebooks",
"theandygross/TCGA",
"aymericdamien/TensorFlow-Examples",
"bloomberg/bqplot",
]
for repo in reponames:
target_path = demo_folder / Path(repo.split("/")[1])
if not target_path.is_dir():
subprocess.check_call([
"git", "clone", "--depth", "1",
f"https://github.com/{repo}.git"
], cwd=demo_folder)
# This empty file and empty folder are for showing drag and drop in jupyterlab
Path("move_this_file.txt").touch()
Path("move_it_here").mkdir(exist_ok=True)

def main():
setup_demofiles()
setup_talks()


if __name__ == "__main__":
main()
Loading