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

Enhance Compatibility for Python Versions Below 3.8 #1135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TNTksals
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant