1616log = logging .getLogger (__name__ )
1717
1818
19+ class MISSING :
20+ def __repr__ (self ) -> str :
21+ return "<MISSING>"
22+
23+ def __bool__ (self ) -> bool :
24+ return False
25+
26+
27+ MISSING_VAL = MISSING ()
28+
29+
1930DEFAULT_TEMPLATES = {
2031 ".py" : """\
2132 # file generated by vcs-versioning
@@ -89,7 +100,7 @@ def write_version_to_path(
89100 target : Path ,
90101 template : str | None ,
91102 version : str ,
92- scm_version : ScmVersion | None = None ,
103+ scm_version : ScmVersion | MISSING | None = MISSING_VAL ,
93104) -> None :
94105 """Write version information to a file using a template.
95106
@@ -102,7 +113,7 @@ def write_version_to_path(
102113 final_template = _validate_template (target , template )
103114 log .debug ("dump %s into %s" , version , target )
104115 version_tuple = _version_as_tuple (version )
105- if scm_version is None :
116+ if scm_version is MISSING_VAL :
106117 warnings .warn (
107118 "write_version_to_path called without scm_version parameter. "
108119 "This will be required in a future version. "
@@ -125,7 +136,7 @@ def dump_version(
125136 version : str ,
126137 write_to : _t .PathT ,
127138 template : str | None = None ,
128- scm_version : ScmVersion | None = None ,
139+ scm_version : ScmVersion | MISSING | None = MISSING_VAL ,
129140) -> None :
130141 """Write version information to a file relative to root.
131142
0 commit comments