Skip to content

Commit 1437d87

Browse files
committed
Improve comments
1 parent cda0c74 commit 1437d87

File tree

1 file changed

+9
-3
lines changed
  • backend/src/hatchling/metadata

1 file changed

+9
-3
lines changed

backend/src/hatchling/metadata/core.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def core_raw_metadata(self) -> dict[str, Any]:
9898
@cached_property
9999
def dynamic(self) -> list[str]:
100100
# Here we maintain a copy of the dynamic fields from `self.core raw metadata`.
101-
# This property should never be mutated. In contrast, the fields in
101+
# This property should never be mutated. In contrast, the fields in
102102
# `self.core.dynamic` are depopulated on the first evaulation of `self.core`
103103
# or `self.version` as the actual values are computed.
104104
dynamic = self.core_raw_metadata.get('dynamic', [])
@@ -161,7 +161,11 @@ def build(self) -> BuildMetadata:
161161
def core(self) -> CoreMetadata:
162162
metadata = CoreMetadata(self.root, self.core_raw_metadata, self.hatch.metadata, self.context)
163163

164-
# Save the fields
164+
# Make a copy of the dynamic fields before they are computed.
165+
# The corresponding `CoreMetadata.dynamic` here in the `metadata`
166+
# variable will be depopulated once the values are computed, either
167+
# directly below by the metadata hooks, or from a version source
168+
# via `ProjectMetadata.version`.
165169
_ = self.dynamic
166170

167171
metadata_hooks = self.hatch.metadata.hooks
@@ -1249,9 +1253,11 @@ def optional_dependencies(self) -> dict[str, list[str]]:
12491253
@cached_property
12501254
def dynamic(self) -> list[str]:
12511255
"""
1256+
Dynamic metadata whose values have not yet been resolved.
1257+
12521258
https://peps.python.org/pep-0621/#dynamic
12531259
1254-
WARNING: This property is mutable, and dynamic fields will be removed as
1260+
WARNING: The returned list is mutable, and dynamic fields will be removed after
12551261
they are resolved.
12561262
"""
12571263
dynamic = self.config.get('dynamic', [])

0 commit comments

Comments
 (0)