pygplates.Version

class pygplates.Version(revision)

Bases: Boost.Python.instance

A version of pygplates (GPlates Python API).

All comparison operators (==, !=, <, <=, >, >=) are supported and Version is hashable (can be used as a key in a dict).

During the lifespan of pygplates, the imported pygplates version has been incremented for each API change. So it can be used to ensure new API additions are present in the imported pygplates library.
For example, if we are using a new API function that was added in this revision (which is 12) then we can ensure we are using a sufficient API version by checking this at the beginning of our script:
if pygplates.Version.get_imported_version() < pygplates.Version(12):
    print 'pygplates version %s is not supported' % pygplates.Version.get_imported_version()

To print the version string of the imported pygplates library:

print 'imported pygplates version: %s' % pygplates.Version.get_imported_version()

...which for pygplates revision 12 (associated with GPlates version 1.5.0) will print 12 (GPlates 1.5.0). However, note that the associated GPlates version is only printed when using get_imported_version(). So the following example only prints the revision number 12:

print 'pygplates version: %s' % pygplates.Version(12)

There is also a pygplates.__version__ string equal to the concatenation of the GPlates version and the pygplates revision of the imported pygplates library. For pygplates revision 12 (associated with GPlates version 1.5.0) this would be '1.5.0.12'.

__init__(revision)

Create a Version instance from a revision number.

Parameters:revision (int) – the revision number

To check if the imported pygplates library is revision 12 or greater:

if pygplates.Version.get_imported_version() < pygplates.Version(12):
    print 'pygplates version %s is not supported' % pygplates.Version.get_imported_version()

Methods

__init__(revision) Create a Version instance from a revision number.
get_imported_version() [staticmethod] Return the version of the imported pygplates library.
get_revision() Returns the integer revision number.
get_imported_version()

[staticmethod] Return the version of the imported pygplates library.

Returns:a Version instance representing the revision number of the imported pygplates library
Return type:Version

To check if the imported pygplates library is revision 12 or greater:

if pygplates.Version.get_imported_version() < pygplates.Version(12):
    print 'pygplates version %s is not supported' % pygplates.Version.get_imported_version()
get_revision()

Returns the integer revision number.

Return type:int

Previous topic

pygplates.GeoTimeInstant

This Page