Skip to content

Commit 0891916

Browse files
authored
Merge pull request #3 from bollwyvl/docs
Add Documentation with nbsphnix
2 parents 408c038 + a536fc8 commit 0891916

29 files changed

+988
-131
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ build/
66
envs/
77
lib/
88
Untitled*.*
9+
*.html

README.md

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,59 @@
11
# robotframework-jupyterlibrary
2-
> A Robot Framework library for testing Jupyter end-user applications and extensions
2+
> A [Robot Framework][] library for automating (testing of) [Jupyter][] end-user applications and extensions
3+
4+
[Robot Framework]: http://robotframework.org
5+
[Jupyter]: https://jupyter.org
36

47
[![binder-badge][]][binder] [![pipeline-badge]][pipeline]
58

6-
> _TODO: rtd, pip, conda_
9+
# Using
10+
Write `.robot` files that use `JupyterLibrary` keywords.
11+
12+
*** Settings ***
13+
Library JupyterLibrary
14+
Suite Setup Wait for New Jupyter Server to be Ready
15+
Test Teardown Reset JupyterLab and Close
16+
Suite Teardown Terminate All Jupyter Servers
17+
18+
*** Test Cases ***
19+
A Notebook in JupyterLab
20+
Open JupyterLab
21+
Launch a new JupyterLab Document
22+
Add and Run JupyterLab Code Cell
23+
Wait Until JupyterLab Kernel Is Idle
24+
Capture Page Screenshot
25+
26+
See the [acceptance tests][] for examples.
27+
728

829
# Installation
30+
> _TODO: release on pypi, conda-forge_
931
1032
## Development Installation
33+
1134
- get Firefox
12-
- get Miniconda
13-
- update and activate
14-
```bash
15-
conda env update
16-
conda activate robotframework-jupyterlibrary
17-
```
18-
- then
19-
```bash
20-
pip install -e . --no-deps --ignore-installed
21-
```
22-
- run the tests
23-
```
24-
python -m scripts.atest
25-
```
35+
- Chrome works, too, but more fickle
36+
- get [Miniconda3][] (as in Python 3.6+)
37+
- clone this repo...
2638

27-
# Using
28-
> _TODO: Figure out a documentation strategy that works with
29-
janky-imported resources_
39+
git clone https://github.com/bollwyvl/robotframework-jupyterlibrary
40+
cd robotframework-jupyterlibrary
41+
42+
- update and activate...
43+
44+
conda env update
45+
conda activate robotframework-jupyterlibrary
46+
47+
- then...
48+
49+
pip install -e . --no-deps --ignore-installed
3050

31-
Write `.robot` files that use `JupyterLibrary` keywords. See the
32-
[acceptance tests](./atest/acceptance) for examples.
51+
- run the tests...
3352

53+
python -m scripts.atest
3454

55+
[acceptance tests]: https://github.com/bollwyvl/robotframework-jupyterlab
56+
[Miniconda3]: https://conda.io/miniconda.html
3557
[binder-badge]: https://mybinder.org/badge_logo.svg
3658
[binder]: https://mybinder.org/v2/gh/bollwyvl/robotframework-jupyterlibrary/master?urlpath=lab/tree/README.md
3759
[pipeline-badge]: https://dev.azure.com/nickbollweg/nickbollweg/_apis/build/status/bollwyvl.robotframework-jupyterlibrary

anaconda-project.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,14 @@ commands:
5454
env_spec: rfjl37
5555

5656
install:win:
57-
windows: python -m pip install _artifacts\\sdist\\robotframework-jupyterlibrary-0.1.0.tar.gz --no-deps --ignore-installed -vv
57+
windows: python -m pip install _artifacts\\sdist\\robotframework-jupyterlibrary-0.1.0.tar.gz
58+
--no-deps --ignore-installed -vv
5859
env_spec: win_rfjl37
5960

61+
docs:
62+
unix: sphinx-build -M html docs _artifacts/docs
63+
env_spec: rfjl37
64+
6065
env_specs:
6166
robotframework-jupyterlibrary:
6267
packages:
@@ -65,13 +70,16 @@ env_specs:
6570
- geckodriver
6671
- isort
6772
- jupyterlab >=0.35
73+
- nbsphinx
6874
- nodejs
6975
- pillow
7076
- python-chromedriver-binary
7177
- robotframework >=3.1
7278
- robotframework-lint
7379
- robotframework-seleniumlibrary >=3.2
7480
- six
81+
- sphinx
82+
- sphinx_rtd_theme
7583
- pip:
7684
- nteract_on_jupyter
7785
channels:

atest/acceptance/01_server/00_basic.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Start three servers
2929
${terminated} = Terminate All Jupyter Servers
3030
Should be equal as integers ${terminated} 0 msg=No servers should have been terminated
3131

32-
Notebook Files
32+
Server Files
3333
[Setup] Create File ${OUTPUT_DIR}${/}foo.txt bar
3434
${nb1} = Start New Jupyter Server stdout=${OUTPUT_DIR}${/}files.log stderr=STDOUT
3535
Copy Files to Jupyter Directory ${OUTPUT_DIR}${/}*.txt

atest/acceptance/10_lab/10_notebook.robot

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ Library Process
99
IPython Notebook
1010
Open JupyterLab
1111
Launch a new JupyterLab Document
12-
Add and Run Cell print("hello world")
13-
Wait Until Kernel Is Idle
12+
Add and Run JupyterLab Code Cell print("hello world")
13+
Wait Until JupyterLab Kernel Is Idle
1414
Capture Page Screenshot ipython.png
1515

1616
IPython Notebook Outputs
1717
Open JupyterLab
1818
Launch a new JupyterLab Document
1919
: FOR ${i} IN RANGE ${10}
20-
\ Add and Run Cell print("${i} hello world " * ${i ** 2})
21-
Wait Until Kernel Is Idle
22-
Screenshot Each Output of Active Document ipython_outputs${/}
20+
\ Add and Run JupyterLab Code Cell print("${i} hello world " * ${i ** 2})
21+
Wait Until JupyterLab Kernel Is Idle
22+
Screenshot Each Output of Active JupyterLab Document ipython_outputs${/}

ci/steps.common.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ steps:
2020
- script: python -m scripts.atest
2121
displayName: Test
2222

23+
- ${{ if eq(parameters.name, 'Linux') }}:
24+
- script: sphinx-build -M html docs _artifacts/docs
25+
displayName: Build Docs
26+
- task: PublishBuildArtifacts@1
27+
displayName: Publish Docs
28+
inputs:
29+
PathtoPublish: _artifacts/docs/html
30+
ArtifactName: ${{ parameters.name }} tests
31+
condition: always()
32+
2333
- task: PublishTestResults@2
2434
displayName: Publish Test Results
2535
inputs:

ci/steps.conda.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ steps:
1212
geckodriver
1313
isort
1414
jupyterlab>=0.35
15+
nbsphinx
1516
nodejs>=10,<11
1617
pillow
1718
python-chromedriver-binary
1819
python>=3.6,<3.7
19-
robotframework>=3.1
2020
robotframework-lint
2121
robotframework-seleniumlibrary>=3.2
22+
robotframework>=3.1
23+
sphinx_rtd_theme
2224
- script: pip install nteract_on_jupyter --no-deps --ignore-installed -vv
2325
displayName: Pip dependencies

docs/INSTALL.ipynb

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# INSTALL\n",
8+
"Installing `JupyterLibrary` will bring along Robot Framework and SeleniumLibrary. Jupyter components, like `notebook`, `jupyterlab` and `nteract_on_jupyter`, and browser executors (e.g. `chromedriver`, `geckodriver`) and various utilities (e.g. `nodejs`) are up to you, depending on what you want to test. Here are some examples.\n",
9+
"\n",
10+
"> _Sorry for the mess, haven't actually shipped anything yet... but the [DEV](#DEV) install does kinda work already_"
11+
]
12+
},
13+
{
14+
"cell_type": "markdown",
15+
"metadata": {},
16+
"source": [
17+
"## TODO `conda`"
18+
]
19+
},
20+
{
21+
"cell_type": "markdown",
22+
"metadata": {},
23+
"source": [
24+
"## TODO `pip`"
25+
]
26+
},
27+
{
28+
"cell_type": "markdown",
29+
"metadata": {},
30+
"source": [
31+
"## TODO `pipenv`"
32+
]
33+
},
34+
{
35+
"cell_type": "markdown",
36+
"metadata": {},
37+
"source": [
38+
"## TODO `poetry`"
39+
]
40+
},
41+
{
42+
"cell_type": "markdown",
43+
"metadata": {},
44+
"source": [
45+
"## TODO `anaconda-project`"
46+
]
47+
},
48+
{
49+
"cell_type": "markdown",
50+
"metadata": {},
51+
"source": [
52+
"## `master`\n",
53+
"`JupyterLibrary` is under active development, and is heavily invested in `conda` because of the complexity of managing browser execution dependencies. But `conda` (rightly) makes it hard to install Random Repos from the Internet, so you'll need a bit of `pip`, too. \n",
54+
"\n",
55+
"Here's a complete setup:\n",
56+
"```shell\n",
57+
"conda create \\\n",
58+
" -n testing-jupyter \\ # as good a name as any\n",
59+
" python=3 # 2020 is right around the corner\n",
60+
"\n",
61+
"conda activate testing-jupyter # get on the right PATH\n",
62+
"\n",
63+
"conda install \\\n",
64+
" -c conda-forge \\ # can't get all these from Austin\n",
65+
" jupyterlab \\ # mostly this\n",
66+
" robotframework-seleniumlibrary \\ # includes robotframework... and selenium\n",
67+
" geckodriver \\ # moz:\\\\a FTW\n",
68+
" python-chromedriver-binary # for the rest of the marketshare\n",
69+
"\n",
70+
"pip install --no-deps \\ # don't want any surprises\n",
71+
" nteract_on_jupyter \\ # now with more ✨\n",
72+
" git+http://github.com/bollwyvl/robotframework-jupyterlibrary#egg=JupyterLibrary\n",
73+
"```\n",
74+
"Also take a gander at this project's `environment.yml` or `anaconda-project.yml` at that URL there."
75+
]
76+
},
77+
{
78+
"cell_type": "markdown",
79+
"metadata": {},
80+
"source": [
81+
"## DEV\n",
82+
"- get Firefox\n",
83+
"- get Miniconda\n",
84+
"- clone\n",
85+
" \n",
86+
" git clone http://github.com/bollwyvl/robotframework-jupyterlibrary\n",
87+
"\n",
88+
"- update and activate\n",
89+
"\n",
90+
" conda env update\n",
91+
" conda activate robotframework-jupyterlibrary\n",
92+
"\n",
93+
"- then\n",
94+
"\n",
95+
" pip install -e . --no-deps --ignore-installed\n",
96+
"\n",
97+
"- run the tests\n",
98+
"\n",
99+
" python -m scripts.atest"
100+
]
101+
},
102+
{
103+
"cell_type": "code",
104+
"execution_count": null,
105+
"metadata": {},
106+
"outputs": [],
107+
"source": []
108+
}
109+
],
110+
"metadata": {
111+
"kernelspec": {
112+
"display_name": "Python 3",
113+
"language": "python",
114+
"name": "python3"
115+
},
116+
"language_info": {
117+
"codemirror_mode": {
118+
"name": "ipython",
119+
"version": 3
120+
},
121+
"file_extension": ".py",
122+
"mimetype": "text/x-python",
123+
"name": "python",
124+
"nbconvert_exporter": "python",
125+
"pygments_lexer": "ipython3",
126+
"version": "3.7.1"
127+
},
128+
"nteract": {
129+
"version": "nteract-on-jupyter@0.35.4"
130+
}
131+
},
132+
"nbformat": 4,
133+
"nbformat_minor": 2
134+
}

0 commit comments

Comments
 (0)