Skip to content

Commit cdefe37

Browse files
committed
fix: change version retrieval
1 parent b186beb commit cdefe37

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ zip_safe = True
3636
install_requires =
3737
depinfo
3838
httpx
39+
importlib_metadata; python_version <'3.8'
3940
ordered-set
4041
pydantic
4142
python-dotenv

src/structurizr/api/structurizr_client_settings.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@
2121
from pathlib import Path
2222
from socket import getfqdn
2323

24-
from pydantic import UUID4, BaseSettings, DirectoryPath, Field, HttpUrl
2524

26-
from .. import __version__
25+
try:
26+
from importlib.metadata import version
27+
except ModuleNotFoundError:
28+
from importlib_metadata import version
29+
30+
from pydantic import UUID4, BaseSettings, DirectoryPath, Field, HttpUrl
2731

2832

2933
__all__ = ("StructurizrClientSettings",)
@@ -44,7 +48,7 @@
4448
if hostname:
4549
USER = f"{USER}@{hostname}"
4650

47-
AGENT = f"structurizr-python/{__version__}"
51+
AGENT = f"structurizr-python/{version('structurizr-python')}"
4852

4953

5054
class StructurizrClientSettings(BaseSettings):

0 commit comments

Comments
 (0)