[Python] Running pdb on python uv single file scripts?

Discussão em 'Python' iniciado por Stack, Maio 3, 2025.

  1. Stack

    Stack Membro Participativo

    So the new hotness for scripts on your path in python is to use uv to create single file scripts.

    These look like this:

    #!/usr/bin/env -S uv run --script
    # -*- mode: python -*-

    # /// script
    # requires-python = ">=3.12"
    # dependencies = [
    # "dominate",
    # "python-dateutil",
    # ]
    # ///
    #


    The work pretty well.

    The old way that you could debug scripts when they went wrong was to use python3 -m pdb script so that python dropped into a pdb post mortem shell on errors. Is it possible to do this with uv?

    (the key thing here is that the environment for running the script is build by uv).

    Continue reading...

Compartilhe esta Página