Skip to content

Commit

Permalink
fix: rename to locked-groups
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming committed Jul 10, 2024
1 parent 1fad786 commit d6e0103
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions doc/src/plugins/backend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ hatchling
Select groups to lock
~~~~~~~~~~~~~~~~~~~~~

By default, the default group and all optional groups will be locked, but you can specify the groups to lock by setting `lock-groups` in the configuration.
By default, the default group and all optional groups will be locked, but you can specify the groups to lock by setting `locked-groups` in the configuration.

.. code-block:: toml
:caption: pyproject.toml
# for pdm-backend
[tool.pdm.build]
locked = true
lock-groups = ["default", "optional1"]
locked-groups = ["default", "optional1"]
# for hatchling
[tool.hatch.metadata.hooks.build-locked]
lock-groups = ["default", "optional1"]
locked-groups = ["default", "optional1"]
2 changes: 1 addition & 1 deletion src/pdm_build_locked/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def pdm_build_hook_enabled(self, context: Context) -> bool:
def pdm_build_initialize(self, context: Context) -> None:
static_fields = list(context.config.metadata)
update_metadata_with_locked(
context.config.metadata, context.root, context.config.build_config.get("lock-groups")
context.config.metadata, context.root, context.config.build_config.get("locked-groups")
)
new_fields = set(context.config.metadata) - set(static_fields)
for field in new_fields:
Expand Down
2 changes: 1 addition & 1 deletion src/pdm_build_locked/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def handle(self, project: Project, options: argparse.Namespace) -> None:
if dev_dependencies := project.pyproject.settings.get("dev-dependencies"):
pdm_dev_dependencies = dev_dependencies.keys()

groups = project.pyproject.settings.get("build", {}).get("lock-groups", None)
groups = project.pyproject.settings.get("build", {}).get("locked-groups", None)
if groups is None:
groups = {group for group in project.all_dependencies if group not in pdm_dev_dependencies}
else:
Expand Down
2 changes: 1 addition & 1 deletion src/pdm_build_locked/hatchling.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BuildLockedMetadataHook(MetadataHookInterface):
PLUGIN_NAME = "build-locked"

def update(self, metadata: dict) -> None:
update_metadata_with_locked(metadata, Path(self.root), self.config.get("lock-groups"))
update_metadata_with_locked(metadata, Path(self.root), self.config.get("locked-groups"))


@hookimpl
Expand Down
2 changes: 1 addition & 1 deletion tests/data/large-selected/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ source = "scm"
[tool.pdm.build]
package-dir = "src"
locked = true
lock-groups = ["default"]
locked-groups = ["default"]

[tool.pdm.dev-dependencies]
dev = [
Expand Down

0 comments on commit d6e0103

Please sign in to comment.