Handle "optional" dependencies with no extra #176
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.
Versions of setuptools prior to 68.2 have an issue where they will misrepresent dependencies that have a constraint but no extra as optional dependencies with an empty extra string. For example, if a
setup.cfg
file includes this:that dependency should be parsed as a required dependency on all Python versions less than 3.8, but these old versions of setuptools parse it as if it were this instead:
(with an empty key under options.extras_require). This causes test failures on older versions of Python or anywhere else we have an old version of setuptools to work with.
To address this, in this PR I'm changing the logic that parses dependencies and optional dependencies so it adds anything associated with an empty extra to the set of required dependencies. I also added some logging statements that were helpful in diagnosing this error.
Additionally, I added a test (not a distribution package test) that reproduces the error when run with
setuptools<68.2
, and I changed the pre-/post-merge testing workflow to run tests with old versions of our dependencies on Python 3.8, in addition to Python 3.12 which we were already doing. This should give us a better chance at catching issues like this in the future.Closes #175