{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "965d3b35-ff65-4a31-93ac-0389e578772a",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": []
   },
   "source": [
    "# How to Jupyter\n",
    "\n",
    "Jupyter Notebook is an open-source web application that allows you to create and share documents containing live code, equations, visualizations, and narrative text.\n",
    "\n",
    "It's widely used for interactive computing, data analysis, scientific research, education, and data visualization.\n",
    "\n",
    "Some key features and components of Jupyter Notebook includes:\n",
    "\n",
    "---\n",
    "\n",
    "**At the bottom left is a control pad with which you can navigate through the slides.**\n",
    "\n",
    "(How to create slides will be explained later.)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "263e7df3-97cc-4568-9d50-59d073d4a7d9",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "subslide"
    },
    "tags": []
   },
   "source": [
    "1. **Interactive Environment**\n",
    "2. **Support for Multiple Programming Languages**\n",
    "3. **Rich Text Support**\n",
    "4. **Data Visualization**\n",
    "5. **Equation Rendering**\n",
    "6. **Easy Sharing**\n",
    "7. **Notebook Extensions**\n",
    "8. **Data Analysis and Exploration**\n",
    "9. **Education and Learning**"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "733cbe91-df68-44d1-b546-8c229fa0dc90",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "skip"
    },
    "tags": []
   },
   "source": [
    "1. **Interactive Environment**: Jupyter Notebook provides an interactive environment where you can write and execute code in chunks called cells. This allows you to see the immediate results of your code as you work on it.\n",
    "\n",
    "2. **Support for Multiple Programming Languages**: While Jupyter was originally designed for Python, it supports various programming languages such as Julia, R, and more through language-specific kernels. Each kernel enables you to execute code written in a specific language."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "01244173-08be-4c4c-9675-27f09620e34b",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "skip"
    },
    "tags": []
   },
   "source": [
    "3. **Rich Text Support**: You can combine code cells with text cells to create a narrative that explains the code, its purpose, and the analysis being performed. This makes it a powerful tool for creating data-driven documents and reports.\n",
    "\n",
    "4. **Data Visualization**: Jupyter Notebook supports the integration of various data visualization libraries such as Matplotlib, Seaborn, Plotly, and more. This allows you to create charts, graphs, and other visualizations to better understand your data."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2d52825d-b8fa-456b-98f4-574585e3b3bb",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "skip"
    },
    "tags": []
   },
   "source": [
    "5. **Equation Rendering**: It supports rendering mathematical equations using LaTeX notation, which is useful for scientific and mathematical documentation.\n",
    "\n",
    "6. **Easy Sharing**: Jupyter Notebooks can be easily shared with colleagues, collaborators, or the public. Notebooks can be exported to various formats such as HTML, PDF, and slideshows. There are also platforms like GitHub and JupyterHub that allow for collaborative editing and sharing."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2c1679b9-b0db-4bf4-9bbc-9d33ca7ffeb0",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "skip"
    },
    "tags": []
   },
   "source": [
    "7. **Notebook Extensions**: Jupyter Notebook has a wide range of extensions that can be added to enhance functionality. These extensions can provide additional features like code linting, spell checking, and more.\n",
    "\n",
    "8. **Data Analysis and Exploration**: Jupyter Notebook is widely used for data analysis and exploration tasks. Analysts and researchers can import data, clean it, perform statistical analysis, and visualize the results all within the same document.\n",
    "\n",
    "9. **Education and Learning**: Jupyter Notebook is used in educational settings to teach programming, data science, and various scientific concepts. Its interactive nature helps learners experiment and grasp concepts more effectively."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "10d93371-42d5-40df-8a30-2ff49dde94d5",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "skip"
    },
    "tags": []
   },
   "source": [
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6bce7ad3-61cd-4087-b35e-bddcb8c9d3c8",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": []
   },
   "source": [
    "## Install Python\n",
    "\n",
    "In this module we will learn the programming language Python. To do this, we need to install it on our system in order to be able to use Jupyter Notebook in advance.\n",
    "\n",
    "The [Python.org](https://www.python.org/) website contains a download link for each operating system. Under [www.python.org/downloads/](https://www.python.org/downloads/) you can download the latest Python version.\n",
    "\n",
    "After following the installation wizard (this depends heavily on which operating system you are using, so we do not show this here), you have successfully installed Python.\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "eec4a5bc-9c06-4680-9aae-d388f0a2bec1",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": []
   },
   "source": [
    "## Opening a Terminal\n",
    "\n",
    "**Windows**: \n",
    "\n",
    "1. `Press Start` (⊞ - Windows Symbol) -> type and search for `cmd`\n",
    "2. Or Press the Windows Symbol ⊞ + the R key `(Windows + R)` -> type `cmd` in the window that appeard -> press `Enter`\n",
    "\n",
    "**Mac**:\n",
    "\n",
    "Open launchpad and Search for `Terminal`\n",
    "\n",
    "**Linux**:\n",
    "\n",
    "It depends on your Environment. But `Ctrl + Alt + T` should do the Trick on every System."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "50a7f663-3a14-4de7-bf03-edaf571681d8",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": []
   },
   "source": [
    "## Upgrading Pip and Installing Jupyter\n",
    "\n",
    "---\n",
    "\n",
    "### Pip - Python Package Index\n",
    "\n",
    "pip is the de-facto and recommended package management programme for Python packages from the Python Package Index (PyPI). At the beginning, the project was called \"pyinstall\".\n",
    "\n",
    "It's website is found under [pypi.org](https://pypi.org/). Every Package you need, can and should be derived from PyPI.\n",
    "\n",
    "---\n",
    "\n",
    "After opening the terminal, pip should first be updated to the latest version. To do this, enter the command:\n",
    "\n",
    "`python3 -m pip install -U pip`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "99fcae70-17c9-447d-afdb-1e2cd41c3457",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": ""
    },
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: pip in /home/phil/Desktop/einfuhrung-in-die-programmierung/env/lib/python3.11/site-packages (23.2.1)\n"
     ]
    }
   ],
   "source": [
    "!python3 -m pip install -U pip"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "99db8dd0-cd07-4a13-a9e8-073188d7a492",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "skip"
    },
    "tags": []
   },
   "source": [
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3f2a5398-4480-4db6-a4dd-7bba2bdf90a3",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": []
   },
   "source": [
    "### Installing Jupyter\n",
    "\n",
    "Now we can install some software we only need two packages depending on your need.\n",
    "\n",
    "`virtualenv` is a tool to create isolated Python environments. You can read more about it in the [Virtualenv documentation](https://virtualenv.pypa.io/en/stable/)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3a6b4743-7d3a-4e87-8e6a-108d526df1ca",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "subslide"
    },
    "tags": []
   },
   "source": [
    "1. We need to install the package `virtualenv` (venv)\n",
    "\n",
    "`python3 -m pip install virtualenv`"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9eaf8cf1-91e8-47cb-85a6-7687b641ecac",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "subslide"
    },
    "tags": []
   },
   "source": [
    "2. Now we can create an virtual environment in any folder we want. (A good practice is a venv for every project)\n",
    "\n",
    "`python3 -m venv env`\n",
    "\n",
    "the name `env` is the folder which has all of our environment information, it can be named everything, but for convinence `env` should be used."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "810aa9c6-4a5d-4f85-8168-31497850f88b",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "subslide"
    },
    "tags": []
   },
   "source": [
    "3. After installing `virtualenv` we need to activate it\n",
    "\n",
    "**Windows**: `.\\env\\Scripts\\activate`\n",
    "\n",
    "**Linux / Mac**: `source env/bin/activate`\n",
    "\n",
    "your command prompt will be modified to reflect the change."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d9f09c52-1bea-41e7-a6f8-f19d73553687",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "subslide"
    },
    "tags": []
   },
   "source": [
    "4. Now you can install jupyter and other dependencies without tinkering with your system\n",
    "\n",
    "`pip install jupyterlab`\n",
    "\n",
    "-> We can use pip direct because we specified the python version with venv implicitly."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "92bbebdf-2dd0-471e-a98d-74ebdf3e1926",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "skip"
    },
    "tags": []
   },
   "source": [
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c889baa0-4202-4811-89b9-8b8bb578f05a",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": []
   },
   "source": [
    "## Starting Jupyter for the first time\n",
    "\n",
    "the last thing we need to tab out of the command line is to start Jupyter\n",
    "\n",
    "therefor type `jupyter lab` and Enter. Do not close the command line it will stop jupyter!\n",
    "\n",
    "After a little waiting time jupyter prompts you with messages one of them should look like:\n",
    "\n",
    "`http(s)://<server:port>/<lab-location>/lab`\n",
    "\n",
    "copy the url and open it in your Webbrowser of Choice. Now we can Proceed.\n",
    "\n",
    "**Note**: This step needs to be done everytime you want to start Jupyter!\n",
    "\n",
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "594997a1-37ed-42a4-835d-5a4ab92eea70",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": []
   },
   "source": [
    "# Alternatives "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1a432129-1fcb-4ee8-a2eb-ebca101dd501",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "subslide"
    },
    "tags": []
   },
   "source": [
    "## (Mini)conda \n",
    "\n",
    "conda from Ananconda Inc. is an open source package and environment manager for many languages that encludes everything we needs.\n",
    "\n",
    "For most purposes miniconda should do the trick. You can download it here [conda docs](https://docs.conda.io/en/latest/miniconda.html)\n",
    "\n",
    "After installing you can change every `python3 -m pip` and `pip` command with `conda`."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "31415a9f-6949-434a-b714-c1c36dddf99a",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "subslide"
    },
    "tags": []
   },
   "source": [
    "## Jupyter Lab Desktop \n",
    "\n",
    "As there description on [GitHub](https://github.com/jupyterlab/jupyterlab-desktop) stated \n",
    "\n",
    "**JupyterLab Desktop is the cross-platform desktop application for JupyterLab. It is the quickest and easiest way to get started with Jupyter notebooks on your personal computer, with the flexibility for advanced use cases.**\n",
    "\n",
    "its nothing else than a selfcontained webbrowser bundeld with Jupyter Lab. You can download a binary for your operating System under there [GitHub Releases](https://github.com/jupyterlab/jupyterlab-desktop/releases) page.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a9d2fead-7d7e-427c-bf35-0f5d379f9ddc",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "subslide"
    },
    "tags": []
   },
   "source": [
    "## Note\n",
    "\n",
    "Every Process has its Advantages and Disadvantages and depends on your needs and workflow.\n",
    "\n",
    "The easiest way isn't always the best.\n",
    "\n",
    "If you have no command line experience try to get used to it and don't use Jupyter Lab Desktop."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "68563ada-3ac1-421b-ab82-5be195a75f23",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "skip"
    },
    "tags": []
   },
   "source": [
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e66d9571-a154-4e4b-b612-9ba9151cd6cd",
   "metadata": {
    "editable": true,
    "slideshow": {
     "slide_type": "skip"
    },
    "tags": []
   },
   "source": [
    "# Jupyter Tricks\n",
    "\n",
    "## Package handeling\n",
    "\n",
    "Our course provides a requirements.txt file, take a look.\n",
    "\n",
    "This file can be created using `pip freeze > requirements.txt` and contains all of your environment data.\n",
    "\n",
    "To use the file we need to install the content. Thankfully pythons pip provides an easy way to this\n",
    "\n",
    "just start a new jupyter notebook and type in the first cell `!pip install -r requirements.txt` and run the cell.\n",
    "\n",
    "## Markdown \n",
    "\n",
    "Making notes in Jupyter is just as powerful. It uses a technology named Markdown which is just another way to write [HTML](https://en.wikipedia.org/wiki/HTML) (The Backbone of the Internet)\n",
    "\n",
    "Some good cheatSheets to learn this simple typewriter can be found under:\n",
    "\n",
    "1. [Markdown Guide](https://www.markdownguide.org/cheat-sheet/)\n",
    "2. [Adam P Markdown Wiki](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)\n",
    "3. [Markdown Table Generator](https://www.tablesgenerator.com/markdown_tables)\n",
    "\n",
    "## Slides and Presentations\n",
    "\n",
    "We have a whole Lesson for that but here is a quick example to look in [mljar.com](https://mljar.com/blog/jupyter-notebook-presentation/)\n",
    "\n",
    "## Debugging\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d0f136f2-5975-489d-819b-b6e6296286a6",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
