Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR refactors version comparisons in the application by utilizing
packaging.version.Version
more broadly.The attribute
zabbixcli.api_version
has been removed, andzabbixcli.zabbix_version
is now an instance ofpackaging.version.Version
containing the full version number instead of a single integer denoting the major version.All existing comparisons of
zabbixcli.zabbix_version
with integers have been rewritten to usezabbixcli.zabbix_version.major
.Similarly, all
zabbixcli.api_version
comparisons now usezabbixcli.zabbix_version.major
and compare them with integers instead of comparing with other version objects.On version comparisons
Comparing
Version.release
with version tuples ignores pre-release information, which is important to support users running pre-release (alpha/beta/rc) versions of Zabbix. Given the following Zabbix version:We can't compare directly with a Version object (alpha < final):
Using
release
we can compare against a tuple of integers, thus alpha >= final:In tuple comparisons, we can omit micro/patch version:
Comparing exact major and minor version is best done by constructing a tuple or comparing with
major
andminor
:This lays the foundation for implementing specific minor version comparisons, such as the one required by #159.