Skip to content

Commit f697c36

Browse files
bollwyvldatakurre
authored andcommitted
Add jupyterlab starters (#62)
* add starters * configure robotkernel-examples and robotkernel-tutorials as starter
1 parent 1552c59 commit f697c36

33 files changed

+413
-122
lines changed

.gitignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
__pycache__/
22
_artifacts/
33
_cache/
4+
.vscode/
45
*.egg-info/
56
*.ipynb_checkpoints/
67
*.pyc
7-
build/
88
**/construct.yaml
9-
dist/
10-
envs/
119
**/icons/*.png
10+
build/
1211
constructor/.*
12+
dist/
13+
envs/
14+
robotkernel-*/

anaconda-project.yml

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ commands:
4949
env_spec: robotlab-dev
5050

5151
channels:
52-
- https://conda.anaconda.org/anaconda
53-
- https://conda.anaconda.org/conda-forge
52+
- https://conda.anaconda.org/anaconda
53+
- https://conda.anaconda.org/conda-forge
5454

5555
env_specs:
5656
_robots_from_jupyter:
5757
description: the main build/test environment
5858
channels:
59-
- https://conda.anaconda.org/anaconda
60-
- https://conda.anaconda.org/conda-forge
59+
- https://conda.anaconda.org/anaconda
60+
- https://conda.anaconda.org/conda-forge
6161
packages:
6262
- conda >=4.7.12,<4.8
6363
- conda-build >=3.18.9,<3.19
@@ -74,7 +74,7 @@ env_specs:
7474

7575
_lab:
7676
packages:
77-
- jupyterlab ==1.2.3
77+
- jupyterlab ==1.2.4
7878
- nodejs >=11,<12
7979
- python >=3.6,<3.7.0a0
8080

@@ -88,34 +88,39 @@ env_specs:
8888

8989
_test:
9090
inherit_from:
91-
- _robots_from_jupyter
91+
- _robots_from_jupyter
9292
channels:
93-
- ./_artifacts/conda-bld
93+
- ./_artifacts/conda-bld
9494
packages:
95-
- robotframework-jupyterlibrary
95+
- robotframework-jupyterlibrary
9696

9797
robotlab-dev:
9898
description: basically what goes in the constructor for interactive dev/test
9999
inherit_from:
100100
- _lab
101101
channels:
102-
- ./_artifacts/conda-bld
102+
- ./_artifacts/conda-bld
103103
packages:
104-
- conda
105-
- firefox
106-
- pyshortcuts
107-
- restinstance
108-
- robotframework-seleniumscreenshots
109-
- robotkernel
104+
- conda
105+
- firefox
106+
- jupyter-starters
107+
- jupytext
108+
- pyshortcuts
109+
- restinstance
110+
- robotframework-seleniumscreenshots
111+
- robotframework-seleniumtestability
112+
- robotkernel
110113

111114
robotlab-dev-win:
112115
inherit_from:
113-
- robotlab-dev
116+
- robotlab-dev
114117
packages:
115-
- robotframework-whitelibrary
118+
- robotframework-whitelibrary
116119

117120
robotlab-test:
118-
inherit_from:
119-
- robotlab-dev
121+
channels:
122+
- https://conda.anaconda.org/anaconda
123+
- https://conda.anaconda.org/conda-forge
124+
- ./_artifacts/conda-bld
120125
packages:
121-
- robotlab
126+
- robotlab

ci/env-lab.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ channels:
77
dependencies:
88
- black
99
- flake8
10-
- jupyterlab ==1.2.3
10+
- jupyterlab ==1.2.4
1111
- nodejs >=11,<12
1212
- python >=3.6,<3.7.0a0
13-
- python >=3.6,<3.7.0a0
1413
- robotframework-lint

ci/job.noarch.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ jobs:
99
- script: |-
1010
python -m scripts.build conda \
1111
--no-test \
12+
jupyter-starters \
1213
robotframework \
1314
restinstance \
1415
robotframework-jupyterlibrary \

ci/job.selftest.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ jobs:
3434
- ${{ if not(eq(platform.name, 'Windows')) }}:
3535
- script: bash _artifacts/constructor/${{ product }}-$(ROBOTLAB_VERSION)-${{ platform.name }}-x86_64.sh -fbp _${{ product }}
3636
displayName: run installer
37+
- script: . ./_${{ product }}/bin/activate ./_${{ product }} && python -m scripts.test robot ${{ product }} --headless --in-product --dryrun
38+
displayName: acceptance tests (dry run)
3739
- script: . ./_${{ product }}/bin/activate ./_${{ product }} && python -m scripts.test robot ${{ product }} --headless --in-product
3840
displayName: acceptance tests
3941

@@ -47,7 +49,12 @@ jobs:
4749
- script: |
4850
@echo on
4951
call "%cd%\_${{ product }}\Scripts\activate.bat" "%cd%\_${{ product }}"
50-
python -m scripts.test robot --headless --in-product ${{ product }}
52+
python -m scripts.test robot ${{ product }} --headless --in-product --dryrun
53+
displayName: acceptance tests (dry run)
54+
- script: |
55+
@echo on
56+
call "%cd%\_${{ product }}\Scripts\activate.bat" "%cd%\_${{ product }}"
57+
python -m scripts.test robot ${{ product }} --headless --in-product
5158
displayName: acceptance tests
5259
5360
- ${{ if eq(platform.name, 'MacOSX') }}:

recipes/jupyter-starters/meta.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{% set name = "jupyter_starters" %}
2+
{% set version = "0.1.0a3" %}
3+
4+
package:
5+
name: {{ name | replace("_", "-") }}
6+
version: {{ version }}
7+
8+
source:
9+
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
10+
sha256: 644cf8458fa8c5fbc63da6dbc4e079c16d38c499964d3077dc8659f12c9763ad
11+
12+
build:
13+
noarch: python
14+
number: 0
15+
script: "{{ PYTHON }} -m pip install . -vv"
16+
17+
requirements:
18+
host:
19+
- python >=3.6
20+
- pip
21+
run:
22+
- python >=3.6
23+
- notebook >=5.3
24+
25+
test:
26+
imports:
27+
- jupyter_starters
28+
- jupyter_starters.handlers
29+
- jupyter_starters.manager
30+
- jupyter_starters.py_starters.cookiecutter
31+
- jupyter_starters.schema.v1
32+
- jupyter_starters.serverextension
33+
- jupyter_starters.trait_types
34+
- jupyter_starters.types
35+
36+
about:
37+
home: https://github.com/deathbeds/jupyterlab-starters
38+
license: BSD-3-Clause
39+
license_family: BSD
40+
license_file: LICENSE
41+
summary: 'Parameterized file and directory starters for JupyterLab.'

recipes/pyshortcuts/meta.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ requirements:
2222
- pywin32 # [win]
2323

2424
test:
25-
requires:
26-
- wxpython
25+
# TODO: some issues currently with wx.__version__
26+
# requires:
27+
# - wxpython
2728
imports:
2829
- pyshortcuts
2930
- pyshortcuts.darwin
3031
- pyshortcuts.linux
3132
- pyshortcuts.windows
32-
- pyshortcuts.wxgui
33+
# - pyshortcuts.wxgui
3334

3435
commands:
3536
- pyshortcut --help

recipes/robotlab/builder.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
from pathlib import Path
2+
import os, sys, shutil, json
3+
4+
SRC_DIR = Path(os.environ["SRC_DIR"])
5+
PREFIX = Path(os.environ["PREFIX"])
6+
7+
APP = SRC_DIR / "app_dir"
8+
9+
WWW = PREFIX / "var" / "www"
10+
ETC = PREFIX / "etc" / "jupyter" / "jupyter_notebook_config.d"
11+
SHARE = PREFIX / "share" / "jupyter"
12+
13+
KERNEL = SRC_DIR / "robotkernel"
14+
EXAMPLES = WWW / "robotkernel-examples"
15+
TUTORIAL = WWW / "robotkernel-tutorial"
16+
NOTEBOOKS = {
17+
EXAMPLES: KERNEL / "examples",
18+
TUTORIAL: KERNEL / "docs" / "notebooks"
19+
}
20+
SVG = SRC_DIR / "robotlab" / "src" / "robotlab" / "icons" / "starter.svg"
21+
22+
print("making directories...")
23+
[d.mkdir(exist_ok=True, parents=True) for d in [SHARE, ETC, WWW]]
24+
25+
print("copying lab...")
26+
shutil.rmtree(APP / "staging", ignore_errors=True)
27+
shutil.copytree(APP, SHARE / "robotlab")
28+
29+
print("copying notebooks...")
30+
NOT_A_NOTEBOOK = lambda d, paths: [p for p in paths if not p.endswith(".ipynb")]
31+
[
32+
shutil.copytree(src, dest, ignore=NOT_A_NOTEBOOK)
33+
for dest, src in NOTEBOOKS.items()
34+
]
35+
36+
print("making starters...")
37+
(ETC / "robotlab-starters.json").write_text(json.dumps({
38+
"StarterManager": {
39+
"extra_starters": {
40+
"robotkernel-examples": {
41+
"type": "copy",
42+
"label": "Robotkernel Examples",
43+
"description": "Examples of using robotkernel",
44+
"icon": SVG.read_text().replace("jp-icon3", "jp-icon-contrast1"),
45+
"src": str(EXAMPLES)
46+
},
47+
"robotkernel-tutorial": {
48+
"type": "copy",
49+
"label": "Robotkernel Tutorial",
50+
"description": "A guided tutorial through using robotkernel",
51+
"icon": SVG.read_text().replace("jp-icon3", "jp-icon-contrast3"),
52+
"src": str(TUTORIAL)
53+
}
54+
}
55+
}
56+
}, indent=2))

recipes/robotlab/meta.yaml

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{% set robot = "3.1.2" %}
2-
{% set robotkernel = "1.2" %}
3-
{% set robot_jupyterlab = "==1.2.3" %}
4-
{% set robot_pywinpty = ">=0.5.5" %}
52
{% set robot_conda = ">=4.7.12,<4.8" %}
63
{% set robot_fox = ">=68.0.2,<69" %}
7-
{% set robot_widgets = ">=7.5.1" %}
4+
{% set robot_jupyterlab = "==1.2.4" %}
85
{% set robot_node = ">=11,<12" %}
6+
{% set robot_pywinpty = ">=0.5.5" %}
7+
{% set robot_starters = ">=0.1.0a2,<0.2.0a0" %}
8+
{% set robot_widgets = ">=7.5.1" %}
9+
{% set robotkernel = "1.2" %}
910

1011
package:
1112
name: {% set name = "robotlab" %}{{ name }}
@@ -30,40 +31,11 @@ build:
3031
- robotlab-examples = robotlab.examples:copy_robotkernel_examples
3132
- robotlab-tutorial = robotlab.tutorial:copy_robotkernel_tutorial
3233
script:
34+
- {{ PYTHON }} {{ RECIPE_DIR }}/builder.py # [unix]
35+
- {{ PYTHON }} {{ RECIPE_DIR }}\builder.py # [win]
3336
- cd robotlab
3437
- {{ PYTHON }} -m pip install --no-deps --ignore-installed --no-cache-dir -vvv .
3538

36-
- cd {{ SRC_DIR }}
37-
38-
- mkdir -p {{ PREFIX }}/share/jupyter # [unix]
39-
- cp -r app_dir {{ PREFIX }}/share/jupyter/robotlab # [unix]
40-
- rm -rf {{ PREFIX }}/share/jupyter/robotlab/staging # [unix]
41-
- ls {{ PREFIX }}/share/jupyter/robotlab # [unix]
42-
43-
- md {{ PREFIX }}\share\jupyter\robotlab # [win]
44-
- xcopy /e app_dir\* {{ PREFIX }}\share\jupyter\robotlab\ # [win]
45-
- rd /s /q {{ PREFIX }}\share\jupyter\robotlab\staging # [win]
46-
- dir {{ PREFIX }}\share\jupyter\robotlab # [win]
47-
48-
- cd robotkernel
49-
- cd examples
50-
51-
- mkdir -p {{ PREFIX }}/var/www/robotkernel-examples # [unix]
52-
- cp *.ipynb {{ PREFIX }}/var/www/robotkernel-examples # [unix]
53-
54-
- md {{ PREFIX }}\var\www\robotkernel-examples # [win]
55-
- xcopy *.ipynb {{ PREFIX }}\var\www\robotkernel-examples\ # [win]
56-
57-
- cd ..
58-
- cd docs
59-
- cd notebooks
60-
61-
- mkdir -p {{ PREFIX }}/var/www/robotkernel-tutorial # [unix]
62-
- cp *.ipynb {{ PREFIX }}/var/www/robotkernel-tutorial # [unix]
63-
64-
- md {{ PREFIX }}\var\www\robotkernel-tutorial # [win]
65-
- xcopy *.ipynb {{ PREFIX }}\var\www\robotkernel-tutorial\ # [win]
66-
6739
requirements:
6840
host:
6941
- pip
@@ -73,6 +45,7 @@ requirements:
7345
- firefox {{ robot_fox }}
7446
- geckodriver
7547
- ipywidgets {{ robot_widgets }}
48+
- jupyter-starters {{ robot_starters }}
7649
- jupyterlab {{ robot_jupyterlab }}
7750
- jupytext >=1.3.0
7851
- nodejs {{ robot_node }}

0 commit comments

Comments
 (0)