Skip to content

Commit

Permalink
Added a separate API version to the info
Browse files Browse the repository at this point in the history
  • Loading branch information
Lennart Regebro committed Oct 15, 2024
1 parent 2cca242 commit 84bd60d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
3.0b2 (unreleased)
------------------

- Nothing changed yet.
- Implementing a separate API version for more version flexibility, as I'm
releasing more often than I expected.


3.0b1 (2024-10-11)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ coverage: devenv
$(bin_dir)/coverage report

test: devenv
$(bin_dir)/pytest
PATH=$(bin_dir):$$PATH $(bin_dir)/pytest

release: devenv
$(bin_dir)/fullrelease
Expand Down
8 changes: 5 additions & 3 deletions src/unoserver/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from importlib import metadata
from xmlrpc.client import ServerProxy

from .server import API_VERSION

__version__ = metadata.version("unoserver")
logger = logging.getLogger("unoserver")

Expand Down Expand Up @@ -50,10 +52,10 @@ def _connect(self, proxy, retries=5, sleep=10):
while retries > 0:
try:
info = proxy.info()
if not info["unoserver"] == __version__:
if not info["api"] == API_VERSION:
raise RuntimeError(
f"Version mismatch. Client runs {__version__} while "
f"Server runs {info['unoserver']}"
f"API Version mismatch. Client {__version__} uses API {API_VERSION} "
f"while Server {info['unoserver']} uses API {info['api']}."
)
return info
except ConnectionError as e:
Expand Down
2 changes: 2 additions & 0 deletions src/unoserver/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

from unoserver import converter, comparer

API_VERSION = "3"
__version__ = metadata.version("unoserver")
logger = logging.getLogger("unoserver")

Expand Down Expand Up @@ -147,6 +148,7 @@ def info():
)
return {
"unoserver": __version__,
"api": API_VERSION,
"import_filters": import_filters,
"export_filters": export_filters,
}
Expand Down

0 comments on commit 84bd60d

Please sign in to comment.