Skip to content

Commit 4f121fa

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

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
import argparse
4-
from typing import Any, cast
4+
from typing import Any
55

66

77
def version_impl(
@@ -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)