Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message when .* is used incorrectly #657

Closed
gaborbernat opened this issue Jan 10, 2023 · 5 comments · Fixed by #662
Closed

Improve error message when .* is used incorrectly #657

gaborbernat opened this issue Jan 10, 2023 · 5 comments · Fixed by #662

Comments

@gaborbernat
Copy link

gaborbernat commented Jan 10, 2023

The error message here complains about a right parenthesis missing, though that's not the issue:

    raise InvalidRequirement(str(e)) from e
packaging.requirements.InvalidRequirement: Expected closing RIGHT_PARENTHESIS
    black (>=20.*) ; extra == 'format'
          ~~~~~^
@pradyunsg
Copy link
Member

Does the following seem more understandable?

packaging.requirements.InvalidRequirement: Expected matching RIGHT_PARENTHESIS for LEFT_PARENTHESIS, after version specifier
    black (>=20.*) ; extra == 'format'
          ~~~~~^

@pradyunsg
Copy link
Member

packaging.requirements.InvalidRequirement: .* suffix can only be used with `==` or `!=` operators
    black (>=20.*) ; extra == 'format'
           ~~~~~^

TBH, we can also do this which is much clearer.

@pradyunsg
Copy link
Member

why-not-both

@pradyunsg
Copy link
Member

#662 does both these things

@pradyunsg pradyunsg changed the title Improve error message for when .* is used incorrectly Improve error message when .* is used incorrectly Jan 14, 2023
@gaborbernat
Copy link
Author

THanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants