Versioning
Qiskit’s version can be queried using a set of compiler macros.
QISKIT_VERSION
A human-readable version as char*. For example: "2.1.0-rc1".
QISKIT_VERSION_HEX
The version number as 4-byte hexadecimal. The format is 0xMMmmppls, where M is the major, m is the minor, p is the patch, l is the release level and s is the serial. For example, 2.1.0-rc1 is 0x020100C1.
Note that final versions, such as 2.1.0, will always end with 0xF0 in the last byte.
See qk_api_version() for the runtime version of this.
QISKIT_VERSION_MAJOR
The major release version.
QISKIT_VERSION_MINOR
The minor release version.
QISKIT_VERSION_PATCH
The patch release version.
QISKIT_RELEASE_LEVEL
The release level:
0xAfor an unreleased dev (or alpha) version0xBfor a beta version0xCfor a release candidate0xFfor a stable (or final) version.
QISKIT_RELEASE_SERIAL
This can be used to indicate the pre-release number in a pre-release series. For example, this would be set to 4 for 2.1.0-rc4. This is 0 for the final version.
QISKIT_GET_VERSION_HEX(major, minor, patch, level, serial)
A macro to pack the version numbers into hexadecimal format. This can be used as tool to compare numbers, for example to ensure the current version is at least the stable 2.1.0 release do:
if (QISKIT_VERSION_HEX >= QISKIT_GET_VERSION_HEX(2, 1, 0, 0xF, 0)) {
// Code for version 2.1.0 (final) or later
}qk_api_version
uint32_t qk_api_version(void)
Get the C API version of the loaded library.
If you are dynamically linking against Qiskit, in either a stand-alone or Python-extension build, this function can be useful to check the version of the library actually loaded at runtime. The header-file macro QISKIT_VERSION_HEX is the equivalent of this function, but for the version of the headers used at build time.
Returns
The version of the compiled Qiskit C API library, in the same format as the QISKIT_VERSION_HEX header-file macro.