|
a |
|
b/README.md |
|
|
1 |
## Version control installation of existing Notebook via jupytext |
|
|
2 |
|
|
|
3 |
```bash |
|
|
4 |
# do this once |
|
|
5 |
pip install jupytext |
|
|
6 |
jupyter notebook --generate-config -y |
|
|
7 |
echo 'c.NotebookApp.contents_manager_class = "jupytext.TextFileContentsManager"' >> ~/.jupyter/jupyter_notebook_config.py |
|
|
8 |
# allow notebook to automatically generate .py code from your notebook |
|
|
9 |
jupytext --set-formats ipynb,VERSION-CONTROL-OUTPUT-DIRECTORY-NAME//py NOTEBOOK_NAME.ipynb |
|
|
10 |
|
|
|
11 |
# git add, commit, push the .py file |
|
|
12 |
# you can ignore the .ipynb file in your repository |
|
|
13 |
|
|
|
14 |
# as a collaborator you can then git pull the repository or changes |
|
|
15 |
# update your notebook with the repo's changes from the .py file |
|
|
16 |
jupytext --to notebook --update VERSION-CONTROL-OUTPUT-DIRECTORY-NAME/NOTEBOOK_NAME.py |
|
|
17 |
``` |
|
|
18 |
|
|
|
19 |
further reference: https://github.com/mwouts/jupytext#jupytext-commands-in-jupyterlab |
|
|
20 |
|
|
|
21 |
## Installation of python projects and Jupyter |
|
|
22 |
```bash |
|
|
23 |
cd project_folder |
|
|
24 |
|
|
|
25 |
# create your virtual environment |
|
|
26 |
|
|
|
27 |
pip install -r requirements.txt |
|
|
28 |
|
|
|
29 |
# add kernel to notebook |
|
|
30 |
python -m ipykernel install --user --name=$VENV-NAME |
|
|
31 |
|
|
|
32 |
# choose your $VENV-NAME kernel in notebook |
|
|
33 |
``` |