Skip to content

Replace deprecated pkg_resources #397

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

Closed
wants to merge 7 commits into from
Closed

Replace deprecated pkg_resources #397

wants to merge 7 commits into from

Conversation

Finesim97
Copy link

Closes #378

I just replaced the pkg_resources function with the corresponding Importlib.metadata calls.

Old code, explodes:

import pkg_resources

for entry_point in pkg_resources.iter_entry_points('jupyter_serverproxy_servers'):
    name = entry_point.name
    print(name)
    server_process_config = entry_point.load()()
    print(server_process_config)

New code, might explode behind closed doors:

from importlib.metadata import entry_points

for entry_point in entry_points().select(group='jupyter_serverproxy_servers'):
    name = entry_point.name
    print(name)
    server_process_config = entry_point.load()()
    print(server_process_config)

@welcome
Copy link

welcome bot commented Apr 14, 2023

Thanks for submitting your first pull request! You are awesome! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please make sure you followed the pull request template, as this will help us review your contribution more quickly.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also a intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@Finesim97
Copy link
Author

The tests fail, because under 3.8 the dict access to the entrypoints should be used, while from 3.10 onward the select function should be used, it produces a warning there. I will look at your code to try to find out how to do something like this.

@Finesim97
Copy link
Author

Just saw #396, closing this one

@Finesim97 Finesim97 closed this Apr 14, 2023
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.

DistributionNotFound(Requirement.parse('webcolors>=1.11; extra == "format-nongpl"'),
1 participant