Skip to content

Commit

Permalink
👌 IMPROVE: Move symlinks to variable aiida_jupyter_symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Mar 17, 2021
1 parent 1ab5d6a commit b8fcc78
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
5 changes: 5 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,10 @@ aiida_kernel_name: python3
# default port on which to start jupyter lab with aiida-jupyterlab exec
aiida_jupyter_port: 8890

# symlink executubles from the aiida environment into the jupyter one
aiida_jupyter_symlink:
- verdi
- reentry

root_user: root
# add vm_headless=false to add a destop shortcut to start jupyter lab
13 changes: 4 additions & 9 deletions tasks/jupyter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,18 @@
python_venv_packages: "{{ aiida_jupyter_packages }}"
register: pip_install

- name: Symlink verdi to {{ aiida_jupyter_venv }}/bin
- name: "Symlink {{ item }} to {{ aiida_jupyter_venv }}/bin"
file:
src: "{{ aiida_venv }}/bin/verdi"
dest: "{{ aiida_jupyter_venv }}/bin/verdi"
src: "{{ aiida_venv }}/bin/{{ item }}"
dest: "{{ aiida_jupyter_venv }}/bin/{{ item }}"
state: link
loop: "{{ aiida_jupyter_symlink }}"

- name: "Activate verdi TAB completion in jupyter virtualenv"
lineinfile:
path: "{{ aiida_jupyter_venv }}/bin/activate"
line: 'eval "$(verdi completioncommand)"'

- name: Symlink reentry to {{ aiida_jupyter_venv }}/bin
file:
src: "{{ aiida_venv }}/bin/reentry"
dest: "{{ aiida_jupyter_venv }}/bin/reentry"
state: link

- name: Add {{ aiida_venv }} to jupyter kernels
shell: "{{ aiida_venv }}/bin/python -m ipykernel install --name {{ aiida_kernel_name }} --user"
args:
Expand Down

0 comments on commit b8fcc78

Please sign in to comment.