Repository: pypa/setuptools_scm

Issue:
Question: what are the possible types for the default generated versions file?
I'm adding `version.pyi` to one of my projects so that mypy doesn't complain when this is missing. But what are the possible types for `version_tuple` produced here?  I'm using this, based on the two things I've seen so far:

```python
version: str
version_tuple: tuple[int, int, int] | tuple[int, int, int, str, str]
```
Are there any other lengths of tuple possible? (4, 6, etc)

(would have made this a Discussion if they were activated, as it doesn't require code changes, just a question).

Discussion:

Patch:
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 221ffd2..85da487 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -37,7 +37,7 @@ features
 
 * support passing log levels to SETUPTOOLS_SCM_DEBUG
 * support using rich.logging as console log handler if installed
-
+* fix #527: type annotation in default version template
 
 v7.1.0
 ======
diff --git a/src/setuptools_scm/_integration/dump_version.py b/src/setuptools_scm/_integration/dump_version.py
index d40c6bb..a7ff4d3 100644
--- a/src/setuptools_scm/_integration/dump_version.py
+++ b/src/setuptools_scm/_integration/dump_version.py
@@ -15,8 +15,10 @@ TEMPLATES = {
     ".py": """\
 # file generated by setuptools_scm
 # don't change, don't track in version control
-__version__ = version = {version!r}
-__version_tuple__ = version_tuple = {version_tuple!r}
+from __future__ import annotations
+__version__ : str = version : str = {version!r}
+__version_tuple__ : 'tuple[int | str, ...]' = \\
+  version_tuple : 'tuple[int | str, ...]' = {version_tuple!r}
 """,
     ".txt": "{version}",
 }
@@ -32,6 +34,7 @@ def dump_version(
     assert isinstance(version, str)
     # todo: assert write_to doesnt escape
     write_to = Path(write_to)
+
     assert not write_to.is_absolute(), f"{write_to=}"
     target = Path(root).joinpath(write_to)
     write_version_to_path(


Test patch:
diff --git a/testing/test_basic_api.py b/testing/test_basic_api.py
index 76770de..bfcc47c 100644
--- a/testing/test_basic_api.py
+++ b/testing/test_basic_api.py
@@ -179,8 +179,11 @@ def test_dump_version(tmp_path: Path) -> None:
     scm_version = meta("1.0", distance=42, config=c)
     dump_version(tmp_path, version, "first.py", scm_version=scm_version)
     lines = read("first.py").splitlines()
-    assert "__version__ = version = '1.0.dev42'" in lines
-    assert "__version_tuple__ = version_tuple = (1, 0, 'dev42')" in lines
+    assert lines[3:] == [
+        "__version__ : str = version : str = '1.0.dev42'",
+        "__version_tuple__ : 'tuple[int | str, ...]' = \\",
+        "  version_tuple : 'tuple[int | str, ...]' = (1, 0, 'dev42')",
+    ]
 
     version = "1.0.1+g4ac9d2c"
     scm_version = meta("1.0.1", node="g4ac9d2c", config=c)