Refactor dependency handling#203
Open
srittau wants to merge 5 commits into
Open
Conversation
Don't let `Metadata`, `verify_typeshed_req`, `verify_external_req`, and `verify_external_req_not_in_typeshed` read the typeshed directory themselves. Instead, expect the names of typeshed packages as an argument. This will not only allow easier testing in the future, it's also a first step towards a less confusing dependencies interface. It also means that `Metadata` is now a pure (side-effect free) class, making it easier to reason about.
* We now wrap `packaging.requirements.Requirements` instances with a `Dependency` class that allows us to distinguish between typeshed and external dependencies. In the future, it's planned that this also gains a `optional` flag for support of `optional-dependencies`. * `Metadata` now only has a `dependencies` property. This will perform all necessary validation and return a list of all dependencies as needed by the pyproject.toml template. The tests now also verify just this field. * Some verification functions have become methods on the `Metadata` class, so they can access "private" fields. * Some verification has moved onto the `Dependency` class as an invariant. Typeshed dependencies need to start with `types-`, and external depencies must not start with `types-`.
Member
Author
|
See python/typeshed#15549 for the ticket. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 a prerequisite for optional-dependencies handling.
The dependency handling has evolved in the past. Unfortunately that made it quite convoluted over time and it's now hard to add features to it. This PR is supposed to simplify dependency handling. It is best reviewed commit-by-commit. The commit comments have additional information.