File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ pyroids = [
6363]
6464
6565[tool .setuptools_scm ]
66- write_to = " _version.py"
66+ write_to = " pyroids/ _version.py"
6767
6868[[tool .uv .index ]]
6969name = " testpypi"
Original file line number Diff line number Diff line change 6060
6161from __future__ import annotations
6262
63+ import contextlib
6364from enum import Enum
6465from pathlib import Path
6566
@@ -79,3 +80,25 @@ class PlayerColor(Enum):
7980
8081 BLUE = "blue"
8182 RED = "red"
83+
84+
85+ # Resolve version
86+ __version__ = None
87+
88+ from importlib .metadata import version # noqa: E402
89+
90+ # get version from installed package
91+ with contextlib .suppress (ImportError ):
92+ __version__ = version ("pyroids" )
93+
94+ if __version__ is None :
95+ try :
96+ # if package not installed, get version as set when package built
97+ from ._version import version
98+ except Exception : # noqa: BLE001, S110
99+ # If package not installed and not built, leave __version__ as None
100+ pass
101+ else :
102+ __version__ = version
103+
104+ del version
You can’t perform that action at this time.
0 commit comments