Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: emit post_lock after writing pyproject.toml and pdm.lock in add… #3291

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/3285.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Emit `post_lock` after writing pyproject.toml and pdm.lock in add/update
2 changes: 1 addition & 1 deletion src/pdm/cli/commands/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ def do_add(
# Update dependency specifiers and lockfile hash.
deps_to_update = group_deps if unconstrained else requirements
save_version_specifiers(deps_to_update, resolved, save)
hooks.try_emit("post_lock", resolution=resolved, dry_run=dry_run)
if not dry_run:
project.add_dependencies(deps_to_update, group, selection.dev or False)
project.write_lockfile(project.lockfile._data, False)
hooks.try_emit("post_lock", resolution=resolved, dry_run=dry_run)
if sync:
do_sync(
project,
Expand Down
2 changes: 1 addition & 1 deletion src/pdm/cli/commands/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ def do_update(
hooks=hooks,
groups=locked_groups,
)
hooks.try_emit("post_lock", resolution=resolved, dry_run=dry_run)
if unconstrained:
# Need to update version constraints
save_version_specifiers(chain.from_iterable(updated_deps.values()), resolved, save)
Expand All @@ -196,6 +195,7 @@ def do_update(
for group, deps in updated_deps.items():
project.add_dependencies(deps, group, selection.dev or False)
project.write_lockfile(project.lockfile._data, False)
hooks.try_emit("post_lock", resolution=resolved, dry_run=dry_run)
if sync or dry_run:
do_sync(
project,
Expand Down
Loading