Skip to content

Automate Custom Kaggle Wheels Builds #10

@ShawnGeorge03

Description

@ShawnGeorge03

Is your feature request related to a problem? Please describe

The current process of updating the Kaggle Wheel that is used for the Public Leaderboard, requires one of the member to manually create the custom wheel each time an update is released. This is takes quite a bit of time and we might miss it from time to time as new updates come out.

Describe the solution you'd like

Creating a GitHub Actions that goes through and creates the custom wheel and setup a PR for it similar to Dependabot.

For all this to work, we will make use of the pypi.org api to pull the latest release

  1. Collect the filename and releaseURL

    filename=$(curl -s https://pypi.org/simple/kaggle/ | sed -n 's/.*<a[^>]*>\(.*\)<\/a>.*/\1/p' | tail -n 1)
    
    releaseURL=$(curl -s https://pypi.org/simple/kaggle/ | grep -oP '(?<=<a href=").*?(?=" >)' | tail -n 1)
  2. Check if $(basename $filename .tar.gz)-py3-none-any.whl exists in wheels

    • If file exists, then send a message stating: Latest Version Exists and STOP
    • If file does not exist, STEP 3
  3. Download and unzip the latest release

    curl -L $releaseURL > release.tar.gz
    
    tar -xvzf release.tar.gz
  4. Check if a specific line of code exists at a specific line number in kaggle/api/kaggle_api_extended.py

    sed -n "1837p" "$(basename $filename .tar.gz)/kaggle/api/kaggle_api_extended.py" | grep -Fxq "        remote_date = datetime.strptime(response.headers['Last-Modified']," && echo "Found" || echo "Not found"
    • We are trying to verify if the line causing the bug has been resolved or not.
    • If it does not exist then send a message stating: Verify new changes in this release and STOP
    • If it does exist, then STEP 5
  5. Make the line change

    sed -i "1837s/.*/        remote_date = datetime.strptime(response.headers['Date'],/" "$(basename $filename .tar.gz)/kaggle/api/kaggle_api_extended.py"
  6. Build the Python Wheel

    python -m build --wheel
  7. Create a new branch that includes the new wheel file

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions