Browsing the API at http://qgis.org/api and importing qgis and qgis.core I could not find any version information.
Is there a way to test in PyQGIS the version, like
if ( qgis.foo.VERSION == '2.99' ): print('on nightly')
So far I found PyQt:
In : qgis.QtCore.PYQT_VERSION_STR Out: '5.5.1'
And I guess I could try&catch a new method.
But maybe there is a "cleaner" way to do this?