dist/tools/bmp: in-line dependencies using PEP 723 #21131
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contribution description
PEP 723 is an accepted proposal to in-line script metadata. One such use cases is to list script dependencies inside the script, which makes the
requirements.txt
redundant.With the correct shebang, it becomes even possible to run the script directly, without creating a virtual environment and installing dependencies in advance. Combining both makes the execution of single-file scripts within RIOT much easier and friendlier.
PEP 723 metadata can be used by
pipx
and can be easily installed whenpip
is available. It is maintained by the PyPA, just likepip
.I chose this file to start with, but there are at least five more scripts with
requirements.txt
that could benefit from the same change. Becausepip install
still requires arequirements.txt
file, which is generally accepted during development, I kept both for now. Aan open issue exists to add support for reading dependencies from PEP 723, which might make it superfluous in the future.Testing procedure
Ensure that
pipx
is installed.Alternatively, execute it from the
dist/tools/bmp
folder.This script is part of the Black Magic Debugger. Execute it from the
dist/tools/bmp
folder, or compile any application and usePROGRAMMER=bmp
to execute it from the build process.Issues/PRs references
None