Useful snippets

    Debug

    2023-11-18

    In Python

    raise ValueError("custom message")
    

    In PyCharm

    Top right drop-down menu:

    Edit configurations

    python interpreter:

    <python environment=""></python>
    

    place breakpoint (not in the template, click the left border)

    --OK--

    Debug 'name' (F5) (At least with VS Code keymap)

    UV python

    2026-01-22

    Docs: https://docs.astral.sh/uv/


    Install Python version: https://docs.astral.sh/uv/getting-started/features/#python-versions

    uv python install <version>

    Uninstall python version

    uv python uninstall <version> 

    Initialize project

    uv init

    Set correct python version in .python-version

    (re)-build venv

    uv venv

    Updates .venv files

    Activate venv environment

    source .venv/bin/activate
    deactivate

    Install dependencies from requirements.txt

    uv pip install -r requirements.txt

    Install one single dependency

    uv python add <package> 

    Run package command

    uv run <command>