Remove attrdict3 build dependency and use plain dict #2675
Merged
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.
While converting the project to pyproject.toml, I stumbled upon a missing dependency (that I was able to add as a build dependency). But when investigating it further, there was only one function using that import, and it doesn't do very much. There are multiple packages on PyPI with similar code, published under different names. But we don't really need it, there's only three places where it is used, so simply replacing it with a dictionary access is way enough.
Here's how I verified the equivalence between the two ways:
In buildtools/config.py, I renamed the info variable to info2, and populated info with a dict. I used pprint (prettyprint) to show the output, as it was too long otherwise.
During the CI builds on Windows machines, I noted the two outputs. They are exacly the same, except for my print that has the label:
Details: with dict
Details
Only the title is different ("getMSVCInfo is: " vs "getMSVCInfo info2 is (pprint): "), so it is equivalent. Before having all usages found (at first I missed the places where the global variable was used instead of the function), CI on my fork failed (documentation at first), but then passed.
So, it is safe to do that replacement, and not depend on a not widely used package.