sdv-dev / Copulas

A library to model multivariate data using copulas.

Home Page:https://sdv.dev/Copulas/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add functionality to find version add-on

amontanez24 opened this issue · comments

Problem Description

As an enterprise user, it would be nice to see the version of public Copulas that is being used as well as the enterprise version.

The actual functionality for this will be added in SDV enterprise, however, this library will need to know to add that functionality to the proper name space.

Expected behavior

  • In this file, add and call a function that uses an entry point called copulas_module to add the version module to the namespace.
  • Add any necessary logging and error checking
  • Be careful not to override anything in the globals that is needed

Additional context

The code can look something like the following:

def _add_versioning():
    for entry_point in pkg_resources.iter_entry_points('copulas_module'):
        try:
            version_module = entry_point.load()
        except Exception:
            message = f'Failed to load "{entry_point.name}" from "{entry_point.module_name}". '
            continue

        if 'version' not in globals():
            globals()['version'] = version_module

_add_versioning()

In this case, the loaded entry point should return the module itself, so we can just add it directly to the globals() under the name version. This should enable the following:

>>> copulas.version.public
0.8.0