Skip to content

Commit

Permalink
Slightly simplify CLI version logic
Browse files Browse the repository at this point in the history
  • Loading branch information
maresb committed Dec 27, 2024
1 parent 82131f2 commit 4f121fa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/src/hatchling/cli/version/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import argparse
from typing import Any, cast
from typing import Any


def version_impl(
Expand All @@ -21,11 +21,11 @@ def version_impl(
plugin_manager = PluginManager()
metadata = ProjectMetadata(root, plugin_manager)

if 'version' in metadata.config.get('project', {}):
static_version = metadata.core.version
if static_version is not None:
if desired_version:
app.abort('Cannot set version when it is statically defined by the `project.version` field')
else:
static_version = cast(str, metadata.core.version)
app.display(static_version)
return

Expand Down

0 comments on commit 4f121fa

Please sign in to comment.