Get Version¶
The library reports two version numbers: the version of the language binding, and the version of the native library it wraps.
Overview¶
| Accessor | Returns |
|---|---|
inscoper_nbo.__version__ |
Version of the Python wheel, as major.minor.patch |
NBOUtils.getVersion() |
Identification string of the native library, including its version |
Both come from the same release: the wheel embeds the library it was built against, so the package version always appears inside the identification string. Comparing them confirms that the native binary being loaded is the one shipped in the wheel.
Read the version¶
import inscoper_nbo
# Version of the Python wheel, exposed as a standard dunder attribute
package_version = inscoper_nbo.__version__
print(f"Package version: {package_version}")
# Identification string of the native library the wheel is built on
library_version = inscoper_nbo.NBOUtils.getVersion()
print(f"Library version: {library_version}")
# The package version is always contained in the library identification string,
# which makes the check below a reliable installation test
major, minor, patch = package_version.split(".")
assert f" v{major}.{minor}.{patch}" in library_version
#include <NBO/NBO/NBOUtils.h>
#include <NBO/NBOVersion.h>
#include <iostream>
int main() {
// Identification string of the library, read from the binary itself
std::cout << Inscoper::NBO::NBOUtils::getVersion() << std::endl;
// The same version is available at compile time, from NBOVersion.h, which
// lets an application check the headers it built against
std::cout << INSCOPER_NBO_VERSION_MAJOR << "."
<< INSCOPER_NBO_VERSION_MINOR << "."
<< INSCOPER_NBO_VERSION_PATCH << std::endl;
return 0;
}