Skip to content

Python

Optional

There is no denying it, python is one of the most popular programming languages. And although I hate the syntax until the day I die (come at me, but indentation as syntax is a mistake), the shier amount of packages, tools, libraries, APIs, yada yada, makes it extremely flexible and versatile.

A jack of all trades is a master of none, but often times better than a master of one.

or as I call it in German

Die Eierlegende Wollmilchsau

Not giving up on my lispy dreams though, I’m trying out Hy here and there, too.

Setup

Normally installing python is as simple as installing the package.

System Packages vs. pip

Installing packages globally through pip isn’t the most optimal thing, especially when using it in a development environment.

It is generally preferred to install the specific package through the official repositories or AUR, where the package name often follows the python-<package_name> scheme.

miniforge

Another way is to utilize virtual environments.

I personally prefer using miniforge, which provides the conda and mamba commands, among others.

I prefer the community supported conda-forge channel, though, which miniforge uses by default and exclusively. Furthermore, miniforge is installed in userspace, so it marks a clear separation of a virtual environment to the system installation.

  1. Download the latest installer script from the download page, or using your preferred shell

    ~
    wget -O Miniforge3.sh $"https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-(uname | get kernel-name)-(uname | get machine).sh"
  2. Run the script through bash

    ~
    bash Miniforge3.sh
  3. Choose no when prompted whether you want to update your shell configuration or not (doesn’t work for nushell).

  4. Add miniforge’s bin directory to your $PATH

    ~/.config/nushell/user.nu
    use std/util "path add"
    path add "~/miniforge3/bin"
  5. Close and reopen your shell

  6. Make sure the conda plugin for nu works correctly (should be setup with my dotfiles out of the box)

    ~
    conda activate
  7. Remove the installation script

    ~
    rm Miniforge3.sh

Now when you want to activate an environment, you can simply use

Terminal window
conda activate <name>