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

Document exceptions raised by functions in packaging.utils #543

Closed
pradyunsg opened this issue May 6, 2022 · 1 comment · Fixed by #544
Closed

Document exceptions raised by functions in packaging.utils #543

pradyunsg opened this issue May 6, 2022 · 1 comment · Fixed by #544

Comments

@pradyunsg
Copy link
Member

Functions like parse_wheel_filename and parse_sdist_filename can raise exceptions, but this is not a documented detail. We should document the exceptions and add a Raises to the relevant functions.

@MrMino
Copy link
Contributor

MrMino commented May 6, 2022

I'm happy to PR this, I'm familiar with that part.

Let me know if I'm mistaken in any / missing something:

  • canonicalize_name - doesn't raise
  • canonicalize_version - doesn't raise
  • parse_wheel_filename - raises InvalidWheelFilename when:
    • given filename does not end with ".whl"
    • the number of dashes (parts) in the filename is different from 4 or 5
    • the distribution name contains unescaped non-alphanumerical characters (PEP427 escaping and unicode).
    • the build number doesn't start with a digit
  • parse_sdist_filename - raises InvalidSdistFilename when:
    • given filename does not end with a sdist-appropriate extension (.zip or .tar.gz)
    • if the distribution name and version are not separated by a - (dash).

Is there anything else? How detailed does this description need to be?

For convenience: https://packaging.pypa.io/en/latest/utils.html

brettcannon added a commit that referenced this issue Aug 19, 2022
CLoses #543 

Co-authored-by: Brett Cannon <brett@python.org>
KOLANICH pushed a commit to KOLANICH-libs/packaging that referenced this issue Nov 30, 2022
CLoses pypa#543 

Co-authored-by: Brett Cannon <brett@python.org>
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