Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functionality to find version add-on #1309

Closed
amontanez24 opened this issue Mar 13, 2023 · 0 comments · Fixed by #1343
Closed

Add functionality to find version add-on #1309

amontanez24 opened this issue Mar 13, 2023 · 0 comments · Fixed by #1343
Assignees
Labels
feature request Request for a new feature
Milestone

Comments

@amontanez24
Copy link
Contributor

Problem Description

As an enterprise user, it would be nice to see the version of public SDV 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 sdv_versioning 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('sdv_version'):
        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:

>>> sdv.version.public
0.18.0
@amontanez24 amontanez24 added the feature request Request for a new feature label Mar 13, 2023
@amontanez24 amontanez24 modified the milestone: 1.0.0 Mar 13, 2023
@amontanez24 amontanez24 added this to the 1.0.1 milestone Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request for a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants