Pyproject.toml optional dependencies redundancy aka DRY extras

Circular dependency is a feature that Python packaging is explicitly designed to allow, so it works and should continue to work. But I agree with Brett, duplication is not undesired in your example. There are cases where de-duplication is desired (as you mentioned), but in all situations I’ve encountered, it is a sign a project should be broken into smaller parts (so each extra becomes basically a separate package) instead of being a monolith that each extra set only uses a subset of the code. So I’m inclined to say this could be a good idea, but only if there is a concrete real-world example that makes it required instead of wanted.

4 Likes