Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a separate API version to the info #141

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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