altair icon indicating copy to clipboard operation
altair copied to clipboard

fix(#2675): replace entrypoints with importlib.metadata

Open daylinmorgan opened this issue 3 years ago • 1 comments

As mentioned in #2675, entrypoints is now in maintenance mode. We can replace it with importlib.metadata and remove the extra dependency for python < 3.8.

daylinmorgan avatar Oct 01 '22 15:10 daylinmorgan

Ah! Tested locally with 3.10 and 3.6. Missed that the selection interface was added in 3.10. I'll update this to parse the dict from entry_points() instead.

daylinmorgan avatar Oct 01 '22 17:10 daylinmorgan

Thanks for the PR @daylinmorgan! Can you synchronize this PR with the latest changes on master? Hopefully @joelostblom can do a review here. A bit of explanation of the suggested changes would help as well.

mattijn avatar Oct 29 '22 18:10 mattijn

This has been rebased on master.

PR drops unnecessary (and the now in maintenance mode) entrypoints module for a standard library equivalent where possible and otherwise relies on the backport (python <3.8).

daylinmorgan avatar Nov 01 '22 15:11 daylinmorgan

Thanks @daylinmorgan! Honestly, I'm not very familiar with the entrypoints concept. Reading https://amir.rachum.com/amp/blog/2017/07/28/python-entry-points.html was a fun introduction. I am interested in approaches where and how this is being used in corporation with Altair. Are you aware of any examples of this usage? In other words, how to test this?

mattijn avatar Nov 01 '22 19:11 mattijn

The entrypoints I'm aware of are in altair_saver and altair_viewer

daylinmorgan avatar Nov 01 '22 20:11 daylinmorgan

Thanks! It is out of scope of this PR, but it seems the entry points in these packages also require updating once Altair is going to vegalite 5. The entry points should become "altair.vegalite.v5.renderer" I think.

Again out of scope, but I'm wondering if it already breaks on the main repo of Altair if a specific VL5 spec is parsed through these entry points.

I'm fine with this PR, you also @joelostblom?

mattijn avatar Nov 01 '22 22:11 mattijn

Thank you @daylinmorgan!

mattijn avatar Dec 27 '22 20:12 mattijn