Skip to content

Commit 31afc05

Browse files
authored
Fix Binder (release/4/dev) (#235)
* Update requirements.txt (add simphony-osp-simlammps) * Use .binder directory * Use custom docker image for Binder * Fix minor issues in some notebooks
1 parent f2b9adc commit 31afc05

File tree

5 files changed

+85
-18
lines changed

5 files changed

+85
-18
lines changed

.binder/Dockerfile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
FROM debian:bullseye-slim
2+
3+
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
6+
7+
# Install required packages: Jupyter and packages required to run notebooks.
8+
RUN apt-get -qq update && \
9+
apt-get install --yes --no-install-recommends \
10+
wget \
11+
python3 python3-pip \
12+
ipython3 python3-ipykernel \
13+
jupyter jupyter-notebook jupyter-nbconvert \
14+
python3-jupyterlab-server \
15+
python3-lammps \
16+
graphviz ffmpeg && \
17+
apt-get -qq purge && \
18+
apt-get -qq clean && \
19+
rm -rf /var/lib/apt/lists/*
20+
21+
# Hardlink liblammps
22+
RUN ln /usr/lib/x86_64-linux-gnu/liblammps.so.0 /usr/lib/python3/dist-packages/lammps/liblammps.so
23+
24+
# create user with a home directory
25+
ARG NB_USER
26+
ARG NB_UID
27+
ENV USER ${NB_USER}
28+
ENV HOME /home/${NB_USER}
29+
30+
RUN adduser --disabled-password \
31+
--gecos "Default user" \
32+
--uid ${NB_UID} \
33+
${NB_USER}
34+
WORKDIR ${HOME}
35+
36+
# Make sure the contents of our repo are in ${HOME}
37+
COPY . ${HOME}
38+
RUN chown -R ${NB_UID} ${HOME}
39+
USER ${NB_USER}
40+
41+
# Add ~/.local/bin to PATH
42+
ENV PATH="${HOME}/.local/bin:${PATH}"
43+
44+
45+
# Update nbconvert
46+
RUN pip install --no-cache-dir nbconvert==6.4.3
47+
48+
# Install requirements
49+
RUN pip install --no-cache-dir -r requirements.txt
50+
51+
# Install multiprocess
52+
RUN pip install multiprocess
53+
54+
# Install simlammps ontology
55+
RUN wget https://raw.githubusercontent.com/simphony/simlammps/main/simphony_osp_simlammps/simlammps.ttl
56+
RUN wget https://raw.githubusercontent.com/simphony/simlammps/main/simphony_osp_simlammps/simlammps.yml
57+
RUN pico install simlammps.yml
58+
59+
# Install city and emmo ontologies
60+
RUN pico install city emmo
61+
62+
# Fix problem with lammps not priting output to Python variables
63+
ENV PYTHONUNBUFFERED=1

docs/introduction/quickstart.ipynb

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,14 @@
8484
"metadata": {},
8585
"outputs": [],
8686
"source": [
87-
"#!pico install /path/to/simlammps"
87+
"# if you are running the tutorial online using Binder, then the simlammps\n",
88+
"# ontology is already pre-installed\n",
89+
"\n",
90+
"# otherwise, download `simlammps.ttl` and `simlammps.yml` from \n",
91+
"# https://github.com/simphony/simlammps/tree/v4.0.0/simphony_osp_simlammps\n",
92+
"# and run\n",
93+
"\n",
94+
"#!pico install simlammps.yml"
8895
]
8996
},
9097
{
@@ -425,15 +432,16 @@
425432
}
426433
],
427434
"source": [
428-
"from simphony_osp.wrappers import SimLammps\n",
435+
"from simphony_osp.wrappers import SimLAMMPS\n",
429436
"\n",
430437
"# open the SQLite database and create a new SimLAMMPS session\n",
431438
"sqlite_session = SQLite('atoms.db', create=False)\n",
432-
"simlammps_session = SimLammps()\n",
439+
"simlammps_session = SimLAMMPS()\n",
433440
"\n",
434441
"# prevent closing the sessions when leaving the contexts after \n",
435442
"# using the `with` statement\n",
436-
"sqlite_session.locked = True, simlammps_session.locked = True\n",
443+
"sqlite_session.locked = True\n",
444+
"simlammps_session.locked = True\n",
437445
"\n",
438446
"# copy the individuals from the SQLite session to the SimLAMMPS session\n",
439447
"ontology_individuals_from_database = list(sqlite_session)\n",
@@ -582,7 +590,7 @@
582590
],
583591
"metadata": {
584592
"kernelspec": {
585-
"display_name": "Python 3",
593+
"display_name": "Python 3 (ipykernel)",
586594
"language": "python",
587595
"name": "python3"
588596
},
@@ -596,7 +604,7 @@
596604
"name": "python",
597605
"nbconvert_exporter": "python",
598606
"pygments_lexer": "ipython3",
599-
"version": "3.8.12"
607+
"version": "3.10.7"
600608
}
601609
},
602610
"nbformat": 4,

docs/usage/sessions/introduction.ipynb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@
153153
"source": [
154154
"session_B = Session()\n",
155155
"\n",
156-
"session_A.locked = True, session_B.locked = True # this will be explained later\n",
156+
"# this will be explained later\n",
157+
"session_A.locked = True\n",
158+
"session_B.locked = True\n",
157159
"\n",
158160
"with session_B:\n",
159161
" london = city.City(name=\"London\", coordinates=[51.50737, -0.12767])\n",
@@ -190,7 +192,7 @@
190192
],
191193
"metadata": {
192194
"kernelspec": {
193-
"display_name": "Python 3",
195+
"display_name": "Python 3 (ipykernel)",
194196
"language": "python",
195197
"name": "python3"
196198
},
@@ -204,7 +206,7 @@
204206
"name": "python",
205207
"nbconvert_exporter": "python",
206208
"pygments_lexer": "ipython3",
207-
"version": "3.8.12"
209+
"version": "3.10.7"
208210
},
209211
"toc-showcode": false,
210212
"toc-showtags": true

docs/usage/sessions/sparql.ipynb

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -249,18 +249,11 @@
249249
" \n",
250250
"</div>"
251251
]
252-
},
253-
{
254-
"cell_type": "code",
255-
"execution_count": null,
256-
"metadata": {},
257-
"outputs": [],
258-
"source": []
259252
}
260253
],
261254
"metadata": {
262255
"kernelspec": {
263-
"display_name": "Python 3",
256+
"display_name": "Python 3 (ipykernel)",
264257
"language": "python",
265258
"name": "python3"
266259
},
@@ -274,7 +267,7 @@
274267
"name": "python",
275268
"nbconvert_exporter": "python",
276269
"pygments_lexer": "ipython3",
277-
"version": "3.8.12"
270+
"version": "3.10.7"
278271
},
279272
"toc-showcode": false,
280273
"toc-showtags": true

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
simphony-osp == 4.0.0rc3
2+
simphony-osp-simlammps >= 4.0.0, < 5.0.0rc0
23
jinja2 >= 3.0.3, < 4
34
jupyter >= 1.0.0, < 2
45
markupsafe >= 2.1.1, < 3

0 commit comments

Comments
 (0)