You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are trying to automatically generate platform-specific lockfiles whenever changes to the pyproject.toml were made. We tried using the post_lock lifecycle hook:
However, this does not work for pdm add, because the post_lock event is emitted before the new pyproject.toml is written, meaning that the above pdm lock commands still operate on the "old" pyproject.toml file.
As a workaround, we are using the post_install hook. This works, but this hook is also emitted in "clean" installs when no changes were made to the dependencies, triggering unnecessary lockfile generations.
Problem and Solution
Having the lockfile written to the disk before calling the post_lock hook would enable this functionality and make PDM's adoption easier for workflows that use platform-specific lockfiles.
Feature Description
We are trying to automatically generate platform-specific lockfiles whenever changes to the pyproject.toml were made. We tried using the
post_lock
lifecycle hook:However, this does not work for
pdm add
, because thepost_lock
event is emitted before the new pyproject.toml is written, meaning that the abovepdm lock
commands still operate on the "old" pyproject.toml file.pdm/src/pdm/cli/commands/add.py
Lines 168 to 173 in 1867fba
As a workaround, we are using the
post_install
hook. This works, but this hook is also emitted in "clean" installs when no changes were made to the dependencies, triggering unnecessary lockfile generations.Problem and Solution
Having the lockfile written to the disk before calling the
post_lock
hook would enable this functionality and make PDM's adoption easier for workflows that use platform-specific lockfiles.Additional Context
I think this is analogous to #1224.
Are you willing to contribute to the development of this feature?
The text was updated successfully, but these errors were encountered: