mirror of https://github.com/astral-sh/uv
## Summary When missing an operator for version parsing, it would give an error that was hard to know how to fix if you were not familiar with version specifiers / PEP-440: ``` Unexpected end of version specifier, expected operator ``` Now, it will attempt to provide a more useful hint if it can parse the version from the remaining scanner: ``` Unexpected end of version specifier, expected operator (did you mean "==3.12"?) ``` ## Test Plan Unit tests in `version_specifier.rs` were added/updated for the following cases: - `test_parse_specifier_missing_operator_error` - `test_parse_specifier_missing_operator_invalid_version_error` - `test_invalid_word` - `test_invalid_specifier` - `error_message_version_specifiers_parse_error` A test in `edit.rs` for failing to parse the `pyproject.toml` when using `add` was also included to match the request in the original issue: - `add_invalid_requires_python` I didn't add cases where no version specifier is provided because it seemed like it doesn't get to the point of parsing in that case, so it should not happen. ## Reference Fixes #13126 --------- Co-authored-by: Jacob Woliver <jacob@jmw.sh> Co-authored-by: konstin <konstin@mailbox.org> |
||
|---|---|---|
| .. | ||
| lib.rs | ||
| version.rs | ||
| version_ranges.rs | ||
| version_specifier.rs | ||