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

drop pkg_resources in favour of importlib.metadata #5923

Merged
merged 3 commits into from Mar 16, 2022

Conversation

graingert
Copy link
Member

@graingert graingert commented Mar 10, 2022

re: https://setuptools.pypa.io/en/latest/pkg_resources.html

Use of pkg_resources is discouraged in favor of importlib.resources, importlib.metadata, and their backports (resources, metadata). Please consider using those libraries instead of pkg_resources.

  • Closes #xxxx
  • Tests added / passed
  • Passes pre-commit run --all-files

@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2022

Unit Test Results

       12 files  ±0         12 suites  ±0   6h 4m 15s ⏱️ + 11m 58s
  2 653 tests ±0    2 571 ✔️ +1    80 💤 ±0  2  - 1 
13 021 runs  ±0  12 380 ✔️ ±0  638 💤 +1  3  - 1 

For more details on these failures, see this check.

Results for commit 266c14e. ± Comparison against base commit 7a69b5e.

♻️ This comment has been updated with latest results.

distributed/comm/registry.py Show resolved Hide resolved
distributed/comm/registry.py Outdated Show resolved Hide resolved
@graingert graingert force-pushed the drop-pkg-resources-dep branch 2 times, most recently from 7f66f83 to 7c5e8f7 Compare March 15, 2022 09:57
@graingert graingert marked this pull request as ready for review March 15, 2022 09:57
Comment on lines -1317 to -1318
# Code adapted from pandas backend entry point testing
# https://github.com/pandas-dev/pandas/blob/2470690b9f0826a8feb426927694fa3500c3e8d2/pandas/tests/plotting/test_backend.py#L50-L76
Copy link
Member Author

Choose a reason for hiding this comment

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

pandas test_register_entrypoint now looks like this: https://github.com/pandas-dev/pandas/blob/48d515958d5805f0e62e34b7424097e5575089a8/pandas/tests/plotting/test_backend.py#L47-L62

I used:

    monkeypatch.syspath_prepend(tmp_path)
    monkeypatch.setitem(sys.modules, "pandas_dummy_backend", dummy_backend)

in the pandas version of this PR because they already do a lot of mutating of sys.modules so figured a sys.path mutation wasn't so bad. Here I use a multiprocessing.Pool(1) to isolate sys.modules and sys.path changes

Copy link
Collaborator

@crusaderky crusaderky left a comment

Choose a reason for hiding this comment

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

This looks good

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.

None yet

2 participants