Python is around for decades and has a immense user community driving the development of various projects.
:::
::::
# Interpreter
...
...
@@ -42,6 +46,10 @@ author:
print("Hello world!")
```
:::{.notes}
Because python code is not compiled, the result at runtime depends on the script **and** the interpreter.
:::
# Standard library
* Python code is organized in [modules](https://docs.python.org/3/tutorial/modules.html) and [packages](https://docs.python.org/3/tutorial/modules.html#packages)
...
...
@@ -70,12 +78,21 @@ In Python, the term "library" is only used in the context of the standard librar
python3 -m pip install numpy
```
:::{.notes}
It straight-forward to install external packages in addition to the standard library of your interpetor
:::
# Package manager
* A package manager helps you to install different versions of packages and their dependencies
* General purpose package manager (`brew`, `apt-get`, `conda`, ...)
* Python package manager (`pip`, `conda`, ...)
:::{.notes}
While `pip` is **part of** the standard library, you need an interpreter to run it.
General purpose package managers can help to install different python interpreters/versions.
:::
# Virtual environments
* Allows you to have a specific combination of libraries/binaries/packages for a project
...
...
@@ -83,6 +100,12 @@ In Python, the term "library" is only used in the context of the standard librar
* [`venv`](https://docs.python.org/3/library/venv.html) (formerly known as `virutalenv`) is shipped with the standard library
* Tools to handle general software environments (e.g. `conda`)
:::{.notes}
An increasing number of packages in an environment makes the dependence resolution difficult.
It is best, to have smaller individual environments for a dedicated task.
This makes the environment easier to reproduce, to test, and to maintain.
:::
# (Ana)conda
* `conda` is a general purpose package manager
...
...
@@ -92,6 +115,10 @@ In Python, the term "library" is only used in the context of the standard librar
_iv)_ and other software/libraries (e.g. ecCodes, NetCDF, ...)
* Due to restricted system permissions, `conda` became quite popular among HPC users
:::{.notes}
`conda` is a general purpose package manager that can handle virutal environments with different python versions.
:::
# The amazing world of snakes {.national}
:::: {.columns}
...
...
@@ -109,7 +136,7 @@ In Python, the term "library" is only used in the context of the standard librar

* Among the heaviest snakes on Earth
* Heaviest snakes on Earth (up to 90 kg)
:::
::: {.column width="30%"}
...
...
@@ -151,6 +178,10 @@ In Python, the term "library" is only used in the context of the standard librar
python3 -m pip install gribscan
```
:::{.notes}
`micromamba` is the easiest solution to setup a python environment on any system.
:::
# Recreating an environment
Specify environment name, python version and dependencies: