Update deprecated distutils.version to packaging.version
#324
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When running test modules e.g.
test_Dataunderpytest(as can be done via$ pytest <test module>even though we don't strictly usepytestbutunittest), I get multiple deprecation warnings on several uses ofdistutils.version.LooseVersion, all incf/__init__.py:I have updated these here to
packaging.version.Version; it actually wasn't at all clear in any of the relevant documentation as to which class from that module would be the appropriate replacement, but from doing a full-GitHub search on relevant keywords I found the following comments (this and this) and corresponding PR to xarray, along with a few other similar PRs on major libraries, to confirm thatVersionis the best one to go with.Unfortunately
packagingisn't a built-in, so this change prompted by the deprecation warning does necessitate another dependency, which I have added to the requirements list and documentation of those.@davidhassell can I check with you that it is OK to add this new dependency? (I am not too pleased that an entire new dependency is required to upgrade deprecated API usage, but this is what the warning prompts us to use. If you can think of an alternative approach, do let me know...)