b.api : module documentation

Part of bzrlib

Library API versioning support.

Added in bzrlib 0.18 this allows export of compatibility information about bzrlib. Please see doc/developers/api-versioning.txt for design details and examples.

Function get_current_api_version Return the API version tuple for object_with_api.
Function get_minimum_api_version Return the minimum API version supported by object_with_api.
Function require_api Check if object_with_api supports the api version wanted_api.
Function require_any_api Check if object_with_api supports the api version wanted_api.
def get_current_api_version(object_with_api):
Return the API version tuple for object_with_api.

Added in bzrlib 0.18.

Parametersobject_with_apiAn object to look for an API version on. If the object has a api_current_version attribute, that is used. Otherwise if there is a version_info attribute, its first three elements are used. Finally if there was no version_info attribute, the current api version of bzrlib itself is used.
def get_minimum_api_version(object_with_api):
Return the minimum API version supported by object_with_api.

Added in bzrlib 0.18.

Parametersobject_with_apiAn object to look for an API version on. If the object has a api_minimum_version attribute, that is used. Otherwise the minimum api version of bzrlib itself is used.
def require_api(object_with_api, wanted_api):
Check if object_with_api supports the api version wanted_api.

Added in bzrlib 0.18.

Parametersobject_with_apiAn object which exports an API minimum and current version. See get_minimum_api_version and get_current_api_version for details.
wanted_apiThe API version for which support is required.
ReturnsNone
RaisesIncompatibleAPIWhen the wanted_api is not supported by object_with_api.
def require_any_api(object_with_api, wanted_api_list):
Check if object_with_api supports the api version wanted_api.

Added in bzrlib 1.9.

Parametersobject_with_apiAn object which exports an API minimum and current version. See get_minimum_api_version and get_current_api_version for details.
wanted_apiA list of API versions, any of which being available is sufficent.
ReturnsNone
RaisesIncompatibleAPIWhen the wanted_api is not supported by object_with_api.
API Documentation for Bazaar, generated by pydoctor at 2019-12-12 00:44:34.