banesullivan / scooby

🐶 🕵️ Great Dane turned Python environment detective
MIT License
47 stars 12 forks source link

Remove use of pkg_resources for importlib.metadata #104

Open banesullivan opened 1 year ago

banesullivan commented 1 year ago

Follow up to #101 to use importlib.metadata as it is preferred. This refactors get_version() and the knowledge module quite a bit to remove unneeded logic as importlib.metadata.version can do much of (all?) what we need!

Further this, necessarily, drops support for Python 3.7.

Do not merge until we are ready to drop Python 3.7 support, which, IMO should match when PyVista drops 3.7 as that's the primary downstream dependency from my perspective

prisae commented 1 year ago

Earliest in July 2023: https://devguide.python.org/versions/#supported-versions (not that far away actually)

banesullivan commented 1 year ago

@prisae, so now importlib.metadata cannot find the dummy_module which makes sense, because it is not installed in the environment.... I'm tempted to remove that and say it's an invalid scenario. But first, I'd like to do some testing to make sure all of this works with conda as well

prisae commented 1 year ago

It should work. And I don't think it is that an uncommon scenario, in my experience working with people...

banesullivan commented 1 year ago

But first, I'd like to do some testing to make sure all of this works with conda as well

All works with conda-installed packages

prisae commented 1 year ago

It is an interesting PR. So ideally every "detective" work within scooby should be replaced by things from the standard library, if they are implemented. So scooby will become, over time, less and less "detective" and reduces to "report". It is a good long-term goal! ;-)