Experiment: "deselecting" default dependencies using extras #18
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.
This is an experiment to test the waters regarding the possibility discussed in pypa/setuptools#4457 (comment):
Although we don't yet have the concept of "default" extras in Python, we can implement "exclusion" extras with an environment marker:
dependency==0.42; extra != "xyz"
.This does however mean that the code has to be written in a way that it allows for the "deselected dependency" to lazily evaluated or not evaluated at all. When the import statement resides in an isolated submodule that is easy and does not require many changes. However if the import statement is in
__init__.py
or in a submodule that is imported in other parts of the codebase, things start to be more complicated.The reason why I decided to try the experiment with
jaraco.text
is because it seems to be the dependency of setuptools that brings most transient dependencies with itself. According topipdeptree
:This PR is by no means exhaustive, I only implemented the 2 most obvious optional exclusions to me.