Entry

Pipx script starter: shebang & in-script dependency management

Solution

#!/usr/bin/env -S pipx run

# pipx metadata
# /// script
# dependencies = ["requests"]
# ///

if __name__ == "__main__":
    pass

Assuming you have pipx installed, you can now directly run the python file and have pipx manage everything.