Skip to content

Commit af34892

Browse files
Add library version (#481)
* Add X-LIBRARY-VERSION to headers so backend knows which library version is being used * update version
1 parent 990531a commit af34892

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

tests/test_api_client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
os.environ["VM_API_MODEL"] = "your_model"
1515

1616
import validmind.api_client as api_client
17+
from validmind.__version__ import __version__
1718
from validmind.errors import (
1819
MissingAPICredentialsError,
1920
MissingModelIdError,
@@ -87,6 +88,7 @@ def test_init_successful(self, mock_requests_get):
8788
"X-API-SECRET": os.environ["VM_API_SECRET"],
8889
"X-MODEL-CUID": os.environ["VM_API_MODEL"],
8990
"X-MONITORING": "False",
91+
"X-LIBRARY-VERSION": __version__,
9092
},
9193
)
9294

@@ -129,6 +131,7 @@ def test_init_no_warning_when_document_is_passed(
129131
"X-API-SECRET": os.environ["VM_API_SECRET"],
130132
"X-MODEL-CUID": os.environ["VM_API_MODEL"],
131133
"X-MONITORING": "False",
134+
"X-LIBRARY-VERSION": __version__,
132135
"X-DOCUMENT-TYPE": "documentation",
133136
},
134137
)
@@ -184,6 +187,7 @@ def test_init_unsuccessful_ping(self, mock_get):
184187
"X-API-SECRET": os.environ["VM_API_SECRET"],
185188
"X-MODEL-CUID": os.environ["VM_API_MODEL"],
186189
"X-MONITORING": "False",
190+
"X-LIBRARY-VERSION": __version__,
187191
},
188192
)
189193

validmind/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "2.12.0"
1+
__version__ = "2.12.1"

validmind/api_client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import requests
2020
from aiohttp import FormData
2121

22+
from .__version__ import __version__
2223
from .client_config import client_config
2324
from .errors import MissingAPICredentialsError, MissingModelIdError, raise_api_error
2425
from .logging import get_logger, log_api_operation
@@ -73,6 +74,7 @@ def _get_api_headers() -> Dict[str, str]:
7374
"X-API-SECRET": _api_secret,
7475
"X-MODEL-CUID": _model_cuid,
7576
"X-MONITORING": str(_monitoring),
77+
"X-LIBRARY-VERSION": __version__,
7678
}
7779
if _document:
7880
headers["X-DOCUMENT-TYPE"] = _document

0 commit comments

Comments
 (0)