Python advice requested:

I need to include a small test program, written in Python, in a repository containing other software not in Python. The program will have multiple source files and use dependencies from PyPI, but does not need to be installed anywhere. The expected usage is to just run it directly from the directory where it lives.

Is there a suitable tool to use to run it which will create a temporary virtual environment, install the dependencies, run the program, and then clean that stuff up?

#Python

Thanks for all the replies! It appears that 'uv', with its support for PEP 723, will be the way to go here.

Confirmed: uv meets my needs. Here's a tiny example:

https://forge.km6g.us/kpfleming/muart-failsafe/src/branch/stm32-firmware/prototest/prototest.py

This uses PEP 723 inline metadata and 'uv run', and includes two dependencies and three local modules. It also has a shebang line so that the user can just run `./prototest.py`, and the only requirement is that they have a suitably-recent version of 'uv' installed and available.

muart-failsafe/prototest/prototest.py at stm32-firmware

muart-failsafe - Failsafe hardware for use with the MUART project

KM6G Software Forge