A PDM plugin to run a command on multiple Python versions.
Project description
PDM Multirun
A PDM plugin to run a command on multiple Python versions.
Installation
With pipx
:
pipx install pdm
pipx inject pdm pdm-multirun
With PDM:
pdm self add pdm-multirun
Usage
This plugin adds a multirun
command to PDM.
The command accepts the same parameters as the run
command,
with an additional -i
, --interpreters
, --versions
parameter
that allows to specify the interpreters to use.
pdm multirun pytest tests/
To specify interpreters, pass a comma-separated string of Python versions:
pdm multirun -i 3.10,3.11 pytest tests/
By default, PDM Multirun reads Python versions from the
PDM_MULTIRUN_VERSIONS
environment variable.
It is a string {major}.{minor} versions that can be found
and called by PDM.
# comma-separated is accepted as well
export PDM_MULTIRUN_VERSIONS="3.7 3.8 3.9 3.10 3.11"
pdm multirun pytest tests/
PDM Multirun sets the PDM_MULTIRUN=1
environment variable
when running the specified command.
You can use it to decide if you should, for example,
print the current Python version in the output
of the command:
import os
import sys
MULTIRUN = os.getenv("PDM_MULTIRUN", "0") == "1"
if MULTIRUN:
py = f"{sys.version_info[0]}.{sys.version_info[1]}" # 3.8, 3.9, etc.
... # use `py` string accordingly
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pdm_multirun-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d765b023f1a8e1801ede24225be096f345bf61f5bda2c4e52cd51d7f9faf03a0 |
|
MD5 | 7e34dcfca152f29cc40429cdf7778826 |
|
BLAKE2b-256 | 4c4d971bbe1fd32b8a2c69ddc675e4389548f6fe768bdcf68e2d7823643573dd |