Developer Blog

Tipps und Tricks für Entwickler und IT-Interessierte

Jupyter | Cookbook

Cookbook

Customize start dir

$ jupyter notebook --generate-config<br>
Writing default config to: /Users/demo/.jupyter/jupyter_notebook_config.py

Search for the following line in the file

#c.NotebookApp.notebook_dir = ''

Replace by

c.NotebookApp.notebook_dir = '†/the/path/to/home/folder/'

Change password

jupyter lab password

Free online Notebooks

https://notebooks.azure.com/

https://nbviewer.jupyter.org/

https://colab.research.google.com/notebooks/welcome.ipynb

Python | Working with virtual environments

Introduction

  • venv module
  • virtualenv
  • pipenv

pipenv

Introduction

Pipenv — the officially recommended Python packaging tool from Python.org, free (as in freedom).

Read here how to install in details

Installation

For Mac OS and brew package manager

brew install pipenv

Prepare environment

venv module

Installation

Nothing required. Module venv is part of the Python distribution

Prepare environment

python3 -m venv env

virtualenv

Prepare environment

$ virtualenv -p python3 .env/python

iPython | Getting Started

Introduction

iPython ist ein Kommandozeileninterpreter zum interaktiven Arbeiten mit der Programmiersprache Python

IDEs and Environments

Install 

Jupyter

$ virtualenv --python python3 jupyter
$ cd jupyter
$ . bin/activate
$ pip install --upgrade pip
$ pip install jupyter

Finally run jupyter

jupyter notebook

Anaconda

$ virtualenv --python python3 anaconda
$ cd anaconda
$ . bin/activate
$ wget https://repo.continuum.io/archive/Anaconda3-4.3.1-Linux-x86_64.sh | bash
jupyter notebook

Resources

Awesome Notebooks

Notebooks

Python | Toolbox

Introduction

Update Python Environment

Update all Python packages

pip3 list| cut -f1 -d' '|xargs -I {} pip3 install {} --upgrade

Debugging and Tracing

def tracefunc(frame, event, arg, indent=[0]):
      if event == "call":
          indent[0] += 2
          print "-" * indent[0] + "> call function", frame.f_code.co_name
      elif event == "return":
          print "<" + "-" * indent[0], "exit function", frame.f_code.co_name
          indent[0] -= 2
      return tracefunc

import sys
sys.settrace(tracefunc)

main()