Skip to content

Commit c058aea

Browse files
authored
Merge pull request #148 from yuvipanda/remove-xtensor
Simplify CI, fix mybinder.org build, bump python (and other) versions
2 parents 24a396b + d243a24 commit c058aea

File tree

7 files changed

+142
-447
lines changed

7 files changed

+142
-447
lines changed

.binder/environment.yml

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,42 @@ channels:
22
- conda-forge
33
- nodefaults
44
dependencies:
5-
# !! you can only use single `=` to set a version. Otherwise it will break the update job
6-
- invoke=2.2.0
7-
- packaging
8-
- pyyaml
5+
- ruamel.yaml
96
# applications
10-
- jupyterlab=4.1.8
11-
- jupyter-collaboration=2.1.1
12-
- nbconvert=7.16.4
13-
- notebook=7.1.3
7+
- jupyterlab
8+
- jupyter-collaboration
9+
- nbconvert
10+
- notebook
1411
# extensions
15-
- jupyter-offlinenotebook=0.3.1
16-
- jupyterlab-fasta=3.3
17-
- jupyterlab-geojson=3.4
12+
- jupyter-offlinenotebook
13+
- jupyterlab-fasta
14+
- jupyterlab-geojson
15+
# R kernel
16+
- r-irkernel
17+
- r-ggplot2
1818
# Python Kernel
19-
- ipykernel=6.29.3
20-
- xeus-python=0.14.3
21-
- ipywidgets=8
22-
- ipyleaflet=0.19.1
23-
- altair=5.3.0
24-
- bqplot=0.12.43
25-
- dask=2024.5.0
26-
- matplotlib-base=3.8.4
27-
- pandas=2.2.2
28-
- python=3.9
29-
- scikit-image=0.22.0
30-
- scikit-learn=1.4.2
31-
- seaborn-base=0.13.2
32-
- tensorflow=2.11.0
33-
- sympy=1.12
34-
- traittypes=0.2.1
19+
- ipykernel
20+
- xeus-python
21+
- ipywidgets
22+
- ipyleaflet
23+
- altair
24+
- bqplot
25+
- dask
26+
- matplotlib-base
27+
- pandas
28+
- python=3.12
29+
- scikit-image
30+
- scikit-learn
31+
- seaborn-base
32+
- tensorflow
33+
- sympy
34+
- traittypes
3535
# C++ Kernel
36-
- xeus-cling=0.13.0
37-
- xtensor=0.23.10
38-
- xtensor-blas=0.19.2
39-
- xwidgets=0.26.1
40-
- xleaflet=0.16.0
36+
# - xeus-cling
37+
# - xtensor
38+
# - xtensor-blas
39+
# - xwidgets
40+
# - xleaflet
4141
# CLI tools
4242
- pip
4343
- vim

.binder/postBuild

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
set -ex
22

3-
# invoke r --env-name=notebook
4-
invoke demofiles
5-
invoke talk -t demo
3+
python build.py
4+
65
rm -rf demofiles
76
rm -rf notebooks
87
rm -rf narrative

.github/workflows/main.yml

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,38 +15,21 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v3
18-
- name: Cache conda
19-
uses: actions/cache@v3
20-
env:
21-
# Increase this value to reset cache if .binder/environment.yml has not changed
22-
CACHE_NUMBER: 0
18+
- name: Install mamba
19+
uses: mamba-org/setup-micromamba@v1
2320
with:
24-
path: ~/conda_pkgs_dir
25-
key:
26-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('.binder/environment.yml') }}
27-
- uses: conda-incubator/setup-miniconda@v2
28-
with:
29-
mamba-version: ">=1.4.0"
30-
# Defaults is added automatically
31-
channels: conda-forge
32-
channel-priority: "strict"
33-
activate-environment: jupyterlab-demo
21+
micromamba-version: '1.5.1-0'
3422
environment-file: .binder/environment.yml
35-
# The following option is blocking the environment resolution (newer versions are not found)
36-
# use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
23+
environment-name: jupyterlab-demo
24+
cache-environment: true
3725
- run: |
38-
conda info
39-
conda list
40-
conda config --show-sources
41-
conda config --show
26+
micromamba info
27+
micromamba list
28+
micromamba config sources
29+
micromamba config list
4230
printenv | sort
4331
- run: |
44-
invoke r --env-name=jupyterlab-demo
4532
jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=60 --stdout notebooks/Data.ipynb > /dev/null;
4633
jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=60 --stdout notebooks/Fasta.ipynb > /dev/null;
4734
jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=60 --stdout notebooks/R.ipynb > /dev/null;
48-
invoke demofiles
49-
invoke talk -t demo
50-
jupyter lab workspaces import .binder/workspace.json
51-
python -m jupyterlab.browser_check
52-
invoke clean
35+
python build.py

.github/workflows/update_env.yml

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

README.md

Lines changed: 2 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -13,84 +13,15 @@ generation user interface of Project Jupyter.
1313
The demo requires `mamba`, available as part of [Mambaforge](https://github.com/conda-forge/miniforge) and the package
1414
requirements are described in `environment.yml`
1515

16-
To install the environment and demofiles, we use [pyinvoke](http://pyinvoke.org). To install pyinvoke with `mamba` call:
17-
```bash
18-
mamba install -c conda-forge invoke packaging pyyaml
19-
```
20-
21-
### Create the environment
22-
23-
To create the conda environment with all the dependencies and jupyterlab extensions for the demo, run:
24-
25-
```bash
26-
invoke environment # optionally --env-name=my-env-name
27-
```
28-
29-
The default environment name is `jupyterlab-demo`.
30-
31-
To create the environment and remove previous installation, call:
32-
33-
```bash
34-
invoke environment --clean
35-
```
36-
37-
### Activate/deactivate the environment
38-
39-
To activate the conda environment, run:
40-
41-
```bash
42-
source activate jupyterlab-demo
43-
```
44-
45-
To deactivate the conda environment, run:
46-
47-
```bash
48-
source deactivate
49-
```
50-
51-
### Additional demo files
52-
53-
The demo includes files from a number of other repositories. To install these files,
54-
run:
55-
56-
```bash
57-
invoke demofiles
58-
```
59-
60-
To remove demofiles and download again all:
61-
```
62-
invoke demofiles --clean
63-
```
64-
65-
### R Language support
66-
67-
To add R language support, run:
68-
69-
```bash
70-
invoke r
71-
```
72-
73-
### Julia Language support
74-
75-
To add Julia language support follow the instructions [here](https://github.com/JuliaLang/IJulia.jl#installation).
76-
77-
78-
### Uninstalling
79-
80-
To uninstall the demofiles and enviornment, call:
81-
82-
```
83-
invoke clean
84-
```
16+
TODO: More installation instructions
8517

8618
# Demo guide
8719

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

90-
9122
# External Repositories
9223

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

9526
| Name | Author |License |
9627
|---|---|---|

build.py

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#!/usr/bin/env python3
2+
from pathlib import Path
3+
import subprocess
4+
from ruamel.yaml import YAML
5+
import shutil
6+
import os
7+
8+
yaml = YAML()
9+
10+
DEMO_FOLDER = "demofiles"
11+
12+
def setup_talks():
13+
"""
14+
Reads yaml file talks.yml and moves files and folders specified in yaml
15+
file to the a folder matching the name of the talk Args: talk_name: name
16+
of talk in talks.yml Note: yaml file is assumed to be a dict of dicts of
17+
lists and dict with the following python format:
18+
{'talk_name':
19+
{'folders':
20+
{'src0': 'dest0', 'src1': 'dest1']
21+
'files':
22+
['file0', file1']
23+
'rename':
24+
{'oldname': 'newname'}
25+
}
26+
}
27+
or in yaml format:
28+
talk_name:
29+
folders:
30+
src0: dest0
31+
src1: dest1
32+
files:
33+
- file0
34+
- file1
35+
rename:
36+
oldname: newname
37+
"""
38+
with open("talks.yml", "r") as stream:
39+
talks = yaml.load(stream)
40+
for talk_name in talks:
41+
Path(talk_name).mkdir(parents=True, exist_ok=True)
42+
43+
if "files" in talks[talk_name]:
44+
for f in talks[talk_name]["files"]:
45+
copied_path = os.path.join(talk_name, os.path.basename(f))
46+
shutil.copy(f, copied_path)
47+
assert os.path.isfile(copied_path), f"{f} failed to copy into {talk_name}"
48+
49+
if "folders" in talks[talk_name]:
50+
for src, dst in talks[talk_name]["folders"].items():
51+
dst = os.path.join(talk_name, dst)
52+
if not os.path.exists(dst):
53+
shutil.copytree(src, dst)
54+
55+
if "rename" in talks[talk_name]:
56+
for old_file, new_file in talks[talk_name]["rename"].items():
57+
moved_file = os.path.join(talk_name, os.path.basename(old_file))
58+
if os.path.isfile(moved_file):
59+
os.rename(moved_file, os.path.join(talk_name, new_file))
60+
elif os.path.isfile(old_file):
61+
shutil.copy(old_file, os.path.join(talk_name, new_file))
62+
63+
def setup_demofiles():
64+
print("creating demofolder")
65+
demo_folder = Path("demofiles")
66+
demo_folder.mkdir(parents=True, exist_ok=True)
67+
68+
# list of repos used in demo
69+
print(f"cloning repos into demo folder {demo_folder}")
70+
reponames = [
71+
"jakevdp/PythonDataScienceHandbook",
72+
"swissnexSF/Urban-Data-Challenge",
73+
"altair-viz/altair",
74+
"QuantEcon/QuantEcon.notebooks",
75+
"theandygross/TCGA",
76+
"aymericdamien/TensorFlow-Examples",
77+
"bloomberg/bqplot",
78+
]
79+
for repo in reponames:
80+
target_path = demo_folder / Path(repo.split("/")[1])
81+
if not target_path.is_dir():
82+
subprocess.check_call([
83+
"git", "clone", "--depth", "1",
84+
f"https://github.com/{repo}.git"
85+
], cwd=demo_folder)
86+
# This empty file and empty folder are for showing drag and drop in jupyterlab
87+
Path("move_this_file.txt").touch()
88+
Path("move_it_here").mkdir(exist_ok=True)
89+
90+
def main():
91+
setup_demofiles()
92+
setup_talks()
93+
94+
95+
if __name__ == "__main__":
96+
main()

0 commit comments

Comments
 (0)