Skip to content

Commit c6838bc

Browse files
committed
Slightly simplify CLI version logic
1 parent 82131f2 commit c6838bc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

backend/src/hatchling/cli/version/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ def version_impl(
2121
plugin_manager = PluginManager()
2222
metadata = ProjectMetadata(root, plugin_manager)
2323

24-
if 'version' in metadata.config.get('project', {}):
24+
static_version = metadata.core.version
25+
if static_version is not None:
2526
if desired_version:
2627
app.abort('Cannot set version when it is statically defined by the `project.version` field')
2728
else:
28-
static_version = cast(str, metadata.core.version)
2929
app.display(static_version)
3030
return
3131

0 commit comments

Comments
 (0)