You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected Behavior: Importing the module works without bundling Package Metadata in application
Actual Behavior: Stripping Package Metadata breaks imports
Cause:
The pattern of directly using importlib.metadata to set the version assumes that package metadata is included in the location where the package is being used. As a result, this breaks when using slimmed down deployment artifacts, as package metadata is not bundled. I have seen a standard approach to this to be to wrap this self-referential version within a try/except block, e.g.