44import sys
55from contextlib import suppress
66from copy import deepcopy
7- from typing import TYPE_CHECKING , Any , Generic , cast
87from functools import cached_property
8+ from typing import TYPE_CHECKING , Any , Generic , cast
99
1010from hatchling .metadata .utils import (
1111 format_dependency ,
@@ -100,7 +100,7 @@ def core_raw_metadata(self) -> dict[str, Any]:
100100 @cached_property
101101 def dynamic (self ) -> list [str ]:
102102 # Here we maintain a copy of the dynamic fields from `self.core raw metadata`.
103- # This property should never be mutated. In contrast, the fields in
103+ # This property should never be mutated. In contrast, the fields in
104104 # `self.core.dynamic` are depopulated on the first evaulation of `self.core`
105105 # or `self.version` as the actual values are computed.
106106 dynamic = self .core_raw_metadata .get ('dynamic' , [])
@@ -391,7 +391,7 @@ def name(self) -> str:
391391 return normalize_project_name (self .raw_name )
392392
393393 @cached_property
394- def version (self ) -> str :
394+ def version (self ) -> str | None :
395395 """
396396 https://peps.python.org/pep-0621/#version
397397 """
@@ -404,6 +404,7 @@ def version(self) -> str:
404404 'if `version` is in field `project.dynamic`'
405405 )
406406 raise ValueError (message )
407+ return None
407408 else :
408409 if 'version' in self .dynamic :
409410 message = (
@@ -901,6 +902,7 @@ def classifiers(self) -> list[str]:
901902 verify_classifiers = not os .environ .get ('HATCH_METADATA_CLASSIFIERS_NO_VERIFY' )
902903 if verify_classifiers :
903904 import bisect
905+
904906 import trove_classifiers
905907
906908 known_classifiers = trove_classifiers .classifiers | self ._extra_classifiers
0 commit comments