A PDM plugin to sync the exported files with the project file.
Install the plugin with PDM CLI:
pdm plugin add pdm-autoexportOr using pipx inject:
pipx inject pdm pdm-autoexportConfigure the requirement mapping in pyproject.toml:
[[tool.pdm.autoexport]]
filename = "requirements/prod.txt"
groups = ["default"]
[[tool.pdm.autoexport]]
filename = "setup.py"
format = "setuppy"Then the requirement files will be synced every time when the lock file is updated.
The configuration is an array of table [[tool.pdm.autoexport]] where each item may contain the following keys:
filename(required): The path to the exported file.groups(optional, default:["default"]): The groups of optional dependencies or dev dependency groups of PDM to sync with.format(optional, default:"requirements"): The format of the exported file, same as the--formatoption to thepdm exportcommand. Onlyrequirementsandsetuppyare supported.without-hashes(optional, default:false): Whether to remove the hashes from the exported file. Only applicable torequirementsformat.pyproject(optional, default:false): Whether to read dependencies frompyproject.toml(see--pyprojectoption to thepdm exportcommand).