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
Feat/version notification #198
Conversation
vortexasdk/client.py
Outdated
latest_version, _ = get_latest_package_version(pkg_name) | ||
try: | ||
version_mask = StrictVersion(__version__) < StrictVersion( | ||
latest_version | ||
) | ||
except ValueError as e: | ||
if "invalid version number" in str(e): | ||
version_mask = LooseVersion(__version__) < LooseVersion( | ||
latest_version | ||
) | ||
else: | ||
raise e | ||
if version_mask: | ||
logger.warning( | ||
f"You are using vortexasdk version {__version__}, however version {latest_version} is available.\n" | ||
f"You should consider upgrading via the 'pip install vortexasdk --upgrade' command." | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the warning at the point where we are creating the client. Not sure if that's the best place to do so. Also open to any comments on whether we could do this code more robust, i.e. that's a 'nice-to-have' check, we don't want this to be the cause of failing to create the client.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be helpful functionality. Just added a couple of comments.
Raise a warning when a user is using an old SDK version. The user would see something like this:
This closes #126.