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 alternative index handling. #124

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Commits on Jul 21, 2024

  1. Improve alternative index handling.

    This improve the handling of indexes and error messages.
    
    Before this PR all errors reaching an index would be ValueError, thus
    not finding a wheel was the same as the index page having a non-handled
    content type, or even failing to parse the html because of a typo.
    
    This made it hard to debug, or even realize that an index url was wrong,
    or that the pages served by the index were incorrect.
    
    I thus introduce 3 New Errors that do not inherit from `ValueError`:
     - IndexMetadataFetchError
     - UnsupportedParserContentTypeError
     - WheelNotFoundError
    
    The first two of which trigger real error, as they likely suggest a
    problem with the index or the user config, and should not be ignored.
    
    In addition the `verbose=` option was unconditionally setting the log
    level. I think this is improper as if the logging level is set somewhere
    else (to DEBUG, or something else), then it is overwritten.
    
    - This then adds the option to pass `verbose=None`, (and make it the
      default), in which case it will not change the default.
    
    python -m http.server will serve ContentType with `; charset=utf-8`,
    which is not recognized.
    
    - This now handle the case where the index ContentType header
      contains parameters for example `; charset=utf-8`, by discarding
      everything after the semicolon `;`; this is not proper parsing, but
      should be sufficient here.
    
     - I found that more debug logging would be useful and added a number
       of debug logs calls
    
    With this I appear to get proper error message and debug statements
    when trying to work on the Cors proxy.
    
    Should close pyodide#123, and pyodide#121, and help with pyodide/pyodide#4898
    Carreau committed Jul 21, 2024
    Configuration menu
    Copy the full SHA
    fe7a0a0 View commit details
    Browse the repository at this point in the history
  2. relax 404

    Carreau committed Jul 21, 2024
    Configuration menu
    Copy the full SHA
    ed88ce7 View commit details
    Browse the repository at this point in the history

Commits on Jul 23, 2024

  1. propagate non ValueError

    Carreau committed Jul 23, 2024
    Configuration menu
    Copy the full SHA
    14a4ae8 View commit details
    Browse the repository at this point in the history
  2. Update micropip/package_index.py

    Co-authored-by: Gyeongjae Choi <[email protected]>
    Carreau and ryanking13 authored Jul 23, 2024
    Configuration menu
    Copy the full SHA
    fbfe173 View commit details
    Browse the repository at this point in the history