Skip to content

Commit 040d13d

Browse files
authored
Initial commit
0 parents  commit 040d13d

23 files changed

Lines changed: 502 additions & 0 deletions

.binder/.pyiron

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[DEFAULT]
2+
TOP_LEVEL_DIRS = /home/jovyan
3+
RESOURCE_PATHS = /srv/conda/envs/notebook/share/pyiron, /home/jovyan/pyiron/resources

.binder/postBuild

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# install environment
2+
mamba env update --name notebook --file environment.yml
3+
4+
# move pyiron config to home directory
5+
mv .binder/.pyiron .
6+
7+
# import dataset
8+
bash .github/ci_support/import_dataset.sh
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
# pyiron config
3+
python .github/ci_support/pyironconfig.py
4+
5+
# import dataset
6+
bash .github/ci_support/import_dataset.sh
7+
8+
# conda install papermill
9+
conda install -c conda-forge papermill
10+
11+
# execute notebooks
12+
current_dir=$(pwd)
13+
i=0;
14+
for f in $(find . -name "*.ipynb" | sort -n); do
15+
cd $(dirname $f);
16+
notebook=$(basename $f);
17+
papermill ${notebook} ${notebook%.*}-out.${notebook##*.} -k "python3" || i=$((i+1));
18+
cd $current_dir;
19+
done;
20+
21+
# push error to next level
22+
if [ $i -gt 0 ]; then
23+
exit 1;
24+
fi;

.github/ci_support/environment.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
channels:
2+
- conda-forge
3+
dependencies:
4+
- jupyter-book
5+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
cd pyiron
3+
for ds in $(ls calculation/*.tar.gz); do
4+
cp ${ds} .
5+
cp calculation/export.csv .
6+
file=$(basename ${ds} .tar.gz)
7+
python << EOF
8+
from pyiron_base import Project
9+
Project("calculation").unpack("${file}")
10+
EOF
11+
rm $(basename ${ds})
12+
rm export.csv
13+
done
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
# ngl view for jupyter
4+
jupyter nbextension install nglview --py --sys-prefix
5+
jupyter nbextension enable nglview --py --sys-prefix
6+
7+
# ngl view for jupyter lab
8+
jupyter labextension install @jupyter-widgets/jupyterlab-manager --no-build
9+
jupyter labextension install nglview-js-widgets --minimize=False

.github/ci_support/pyironconfig.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import os
2+
3+
4+
def main():
5+
current_path = os.path.abspath(os.path.curdir)
6+
top_level_path = current_path.replace('\\', '/')
7+
resource_path = os.path.join(current_path, "pyiron", "resources").replace('\\', '/')
8+
pyiron_config = os.path.expanduser('~/.pyiron').replace('\\', '/')
9+
if not os.path.exists(pyiron_config):
10+
with open(pyiron_config, 'w') as f:
11+
f.writelines(['[DEFAULT]\n',
12+
'TOP_LEVEL_DIRS = ' + top_level_path + '\n',
13+
'RESOURCE_PATHS = ' + resource_path + '\n',
14+
'DATABASE_FILE = ' + resource_path + '/pyiron.db\n',
15+
])
16+
else:
17+
print('config exists')
18+
19+
20+
if __name__ == '__main__':
21+
main()
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
cat << EOF > _config.yml
3+
title: $(echo ${GITHUB_REPOSITORY} | awk -F '/' '{print $2}')
4+
author: pyiron
5+
logo: logo_dark.png
6+
7+
execute:
8+
execute_notebooks : off
9+
10+
html:
11+
extra_navbar : Powered by <a href="https://pyiron.org">pyiron</a>
12+
13+
repository:
14+
url : https://github.com/${GITHUB_REPOSITORY}
15+
path_to_book : ""
16+
17+
launch_buttons:
18+
notebook_interface : jupyterlab
19+
binderhub_url : https://mybinder.org
20+
21+
EOF

.github/workflows/book.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Jupyterbook
2+
3+
on:
4+
pull_request:
5+
branches: [ master ]
6+
7+
jobs:
8+
build:
9+
10+
runs-on: ubuntu-latest
11+
env:
12+
CONDA_PREFIX: /usr/share/miniconda/
13+
GPAW_SETUP_PATH: /usr/share/miniconda/share/gpaw
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: conda-incubator/setup-miniconda@v2
18+
with:
19+
auto-update-conda: true
20+
python-version: 3.8
21+
environment-file: .github/ci_support/environment.yml
22+
auto-activate-base: false
23+
- name: Install Jupyterbook
24+
shell: bash -l {0}
25+
run: |
26+
27+
echo "format: jb-book" > _toc.yml
28+
echo "root: README" >> _toc.yml
29+
echo "chapters:" >> _toc.yml
30+
for f in $(find . -name '*.ipynb' | sort -n); do echo "- file: ${f#*/}" >> _toc.yml; done
31+
curl https://pyiron.org/images/logo_dark.png --output logo_dark.png
32+
bash .github/ci_support/write_book_config.sh
33+
rm CODE_OF_CONDUCT.md LICENSE
34+
cat _toc.yml
35+
jupyter-book build . --path-output public
36+
- run: mv public/_build/html public_html
37+
- run: touch public_html/.nojekyll

.github/workflows/deploy.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
build:
9+
10+
runs-on: ubuntu-latest
11+
env:
12+
CONDA_PREFIX: /usr/share/miniconda/
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: conda-incubator/setup-miniconda@v2
17+
with:
18+
auto-update-conda: true
19+
python-version: 3.8
20+
environment-file: .github/ci_support/environment.yml
21+
auto-activate-base: false
22+
- name: Install Jupyterbook
23+
shell: bash -l {0}
24+
run: |
25+
echo "format: jb-book" > _toc.yml
26+
echo "root: README" >> _toc.yml
27+
echo "chapters:" >> _toc.yml
28+
for f in $(find . -name '*.ipynb' | sort -n); do echo "- file: ${f#*/}" >> _toc.yml; done
29+
curl https://pyiron.org/images/logo_dark.png --output logo_dark.png
30+
bash .github/ci_support/write_book_config.sh
31+
rm CODE_OF_CONDUCT.md LICENSE
32+
cat _toc.yml
33+
jupyter-book build . --path-output public
34+
- run: mv public/_build/html public_html
35+
- run: touch public_html/.nojekyll
36+
- name: Deploy 🚀
37+
uses: JamesIves/github-pages-deploy-action@3.7.1
38+
with:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
BRANCH: gh-pages # The branch the action should deploy to.
41+
FOLDER: public_html # The folder the action should deploy.
42+
CLEAN: true

0 commit comments

Comments
 (0)