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

ENH: drop pkg_resources ? #4287

Closed
neutrinoceros opened this issue Jan 9, 2023 · 2 comments · Fixed by #4292
Closed

ENH: drop pkg_resources ? #4287

neutrinoceros opened this issue Jan 9, 2023 · 2 comments · Fixed by #4292

Comments

@neutrinoceros
Copy link
Member

There a a couple places where yt depends on pkg_resources, which is notorious for having a large import overhead.
We've been mitigating this by moving such imports statements where they are actually used instead of at module level so it doesn't currently impact yt's own import time, but there are alternatives (importlib.metadata, importlib.resources) in the standard library that may be worth exploring.

@matthewturk
Copy link
Member

What do we use it for? Just getting locations of individual files bundled with yt?

@neutrinoceros
Copy link
Member Author

neutrinoceros commented Jan 9, 2023

It's used in

  • yt.funcs.get_yt_version
  • yt.utilities.command_line.py (commands yt version and update)
  • yt.load_sample (via yt.sample_data.api.get_data_registry_table and yt.sample_data.api._get_pooch_instance)

The latter cases are indeed where we locate data files from the package (most likely this can be done with importlib.resources), and the first two are just about obtaining version numbers which should be doable with importlib.metadata.

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 a pull request may close this issue.

2 participants