diff --git a/python/opendht.pyx b/python/opendht.pyx index 17cf113b..88fd30ee 100644 --- a/python/opendht.pyx +++ b/python/opendht.pyx @@ -48,6 +48,9 @@ cdef inline _deinitialize_gnutls(): # Initialize GnuTLS when this module is imported _initialize_gnutls() +def version() -> str: + return cpp.version().decode() + cdef inline void lookup_callback(cpp.vector[cpp.shared_ptr[cpp.IndexValue]]* values, cpp.Prefix* p, void *user_data) noexcept with gil: cbs = user_data if 'lookup' in cbs and cbs['lookup']: diff --git a/python/opendht/__init__.py b/python/opendht/__init__.py index 81c21ea9..627290ba 100644 --- a/python/opendht/__init__.py +++ b/python/opendht/__init__.py @@ -8,4 +8,5 @@ pure-Python asyncio-friendly wrapper under ``opendht.aio``. from ._core import * # re-export core Cython bindings +__version__ = version() __all__ = [name for name in dir() if not name.startswith("_")] diff --git a/python/opendht_cpp.pxd b/python/opendht_cpp.pxd index c1cdc94a..73a111de 100644 --- a/python/opendht_cpp.pxd +++ b/python/opendht_cpp.pxd @@ -49,6 +49,7 @@ cdef extern from "" namespace "std" nogil: shared_future[T] share() cdef extern from "opendht/utils.h" namespace "dht": + const char* version() cdef cppclass time_point: @staticmethod time_point min() const