Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Mikejmnez
Copy link
Collaborator

@Mikejmnez Mikejmnez commented Aug 9, 2024

The following Pull Request:

  • Migrates away from the deprecated pkg_resources and adds importlib-metadata and importlib-resources, which remain compatible with Python 3.9. In the near future (when Python 3.9 is no longer actively maintained), we can drop these new dependencies. In theory we should be able to replace them withimportlib.metadata and importlib.resources with very minimal syntax changes (importlib is already included within setuptools`, but changed behavior starting with Python 3.10).

Broadly,

@Mikejmnez Mikejmnez marked this pull request as draft August 9, 2024 00:59
@Mikejmnez Mikejmnez changed the title Implicit Implicit discovery of entry points Aug 9, 2024
@Mikejmnez
Copy link
Collaborator Author

Mikejmnez commented Aug 9, 2024

A bit of context to the failed test on Ubuntu:

Test only fail for Python 3.9, and that is why these do not fail with MacOS. When I run these tests on OSX with Python < 3.10 tests also fail, but we already removed testing for OSX for Python<3.10 because of a changing behavior in GH workflows.

The reason test fail is because a change in behavior in the library importlib.metadata for Python >=3.10.

One solution to this problem that I have seen around, is to try:

try:
    from importlib.metadata import entry_points
except ImportError:  # Python < 3.10 (backport)
    from importlib_metadata import entry_points

However this does not work because importlib.metadata does not throw an Exception during import, and even if it did,importlib_metadata is not installed. importlib_metadata would need to be added either as a dependency for all python versions.

But I do not want to drop support/compat with Python 3.9, which is still one of the stable versions until 2025.

Fix

For now, I will add importlib_metadata as a dependency to pydap until Python 3.9 is no longer a stable version. This allows pydap to provide support for all stable Python versions until Python 3.13 comes along later in 2025.

some additional resources

@Mikejmnez Mikejmnez marked this pull request as ready for review August 9, 2024 22:12
Copy link
Member

@jgallagher59701 jgallagher59701 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready to merge. Thanks!

@Mikejmnez
Copy link
Collaborator Author

I just checked, and there are some (external) deprecation warnings for Python >= 3.12 so I will suppress the Deprecation Warnings and merge :)

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.

Resolve Deprecation Warnings

2 participants