Hi,
I've popped in a pull request to propose a small yet significant enhancement to the [umap package/project]. This enhancement aims to improve the package's compatibility with Python versions below 3.8, ensuring a broader user base can benefit from its powerful features without facing import errors.
Currently, the package utilizes importlib.metadata for importing version and PackageNotFoundError, which is available in Python 3.8 and newer versions. However, this leads to compatibility issues with older Python versions, as they lack this module, potentially alienating a segment of the user base still on these versions.
To address this issue, I have implemented a conditional import strategy in the __init__.py file. The code attempts to import version and PackageNotFoundError from importlib.metadata (available in Python 3.8+). If this import fails (indicating the user is on an older Python version), it falls back to importing the same modules from the importlib_metadata package, which is a backport of importlib.metadata for older Python versions.
Hi, I've popped in a pull request to propose a small yet significant enhancement to the [umap package/project]. This enhancement aims to improve the package's compatibility with Python versions below 3.8, ensuring a broader user base can benefit from its powerful features without facing import errors.
Currently, the package utilizes
importlib.metadata
for importingversion
andPackageNotFoundError
, which is available in Python 3.8 and newer versions. However, this leads to compatibility issues with older Python versions, as they lack this module, potentially alienating a segment of the user base still on these versions.To address this issue, I have implemented a conditional import strategy in the
__init__.py
file. The code attempts to importversion
andPackageNotFoundError
fromimportlib.metadata
(available in Python 3.8+). If this import fails (indicating the user is on an older Python version), it falls back to importing the same modules from theimportlib_metadata
package, which is a backport ofimportlib.metadata
for older Python versions.