From 98fda4cb5251492569630f1e3ec61b3c1a1aff15 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Wed, 13 Nov 2024 21:32:11 -0600 Subject: [PATCH] enforce wheel size limits, README formatting in CI (#1482) Contributes to https://github.com/rapidsai/build-planning/issues/110 Proposes adding 2 types of validation on wheels in CI, to ensure we continue to produce wheels that are suitable for PyPI. * checks on wheel size (compressed), - *to be sure they're under PyPI limits* - *and to prompt discussion on PRs that significantly increase wheel sizes* * checks on README formatting - *to ensure they'll render properly as the PyPI project homepages* - *e.g. like how https://github.com/scikit-learn/scikit-learn/blob/main/README.rst becomes https://pypi.org/project/scikit-learn/* Authors: - James Lamb (https://github.com/jameslamb) Approvers: - Mark Harris (https://github.com/harrism) - Bradley Dice (https://github.com/bdice) URL: https://github.com/rapidsai/cuspatial/pull/1482 --- ci/build_wheel_cuproj.sh | 5 ++++- ci/build_wheel_cuspatial.sh | 5 ++++- ci/build_wheel_libcuspatial.sh | 4 +++- ci/validate_wheel.sh | 21 +++++++++++++++++++++ python/cuproj/pyproject.toml | 8 ++++++++ python/cuspatial/pyproject.toml | 8 ++++++++ python/libcuspatial/pyproject.toml | 8 ++++++++ 7 files changed, 56 insertions(+), 3 deletions(-) create mode 100755 ci/validate_wheel.sh diff --git a/ci/build_wheel_cuproj.sh b/ci/build_wheel_cuproj.sh index 6001e44e9..4b29fbb46 100755 --- a/ci/build_wheel_cuproj.sh +++ b/ci/build_wheel_cuproj.sh @@ -3,4 +3,7 @@ set -euo pipefail -ci/build_wheel.sh cuproj python/cuproj python +package_dir="python/cuproj" + +ci/build_wheel.sh cuproj ${package_dir} python +ci/validate_wheel.sh ${package_dir} final_dist diff --git a/ci/build_wheel_cuspatial.sh b/ci/build_wheel_cuspatial.sh index e581a3e76..780ac0710 100755 --- a/ci/build_wheel_cuspatial.sh +++ b/ci/build_wheel_cuspatial.sh @@ -3,6 +3,8 @@ set -euo pipefail +package_dir="python/cuspatial" + RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" # Downloads libcuspatial wheel from this current build, @@ -14,4 +16,5 @@ RAPIDS_PY_WHEEL_NAME="libcuspatial_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-whe echo "libcuspatial-${RAPIDS_PY_CUDA_SUFFIX} @ file://$(echo /tmp/libcuspatial_dist/libcuspatial_*.whl)" > /tmp/constraints.txt export PIP_CONSTRAINT="/tmp/constraints.txt" -ci/build_wheel.sh cuspatial python/cuspatial python +ci/build_wheel.sh cuspatial ${package_dir} python +ci/validate_wheel.sh ${package_dir} final_dist diff --git a/ci/build_wheel_libcuspatial.sh b/ci/build_wheel_libcuspatial.sh index ed3822207..b6582d87f 100755 --- a/ci/build_wheel_libcuspatial.sh +++ b/ci/build_wheel_libcuspatial.sh @@ -3,6 +3,7 @@ set -euo pipefail +package_dir="python/libcuspatial" package_name="libcuspatial" rapids-logger "Generating build requirements" @@ -25,4 +26,5 @@ python -m pip install \ # 0 really means "add --no-build-isolation" (ref: https://github.com/pypa/pip/issues/5735) export PIP_NO_BUILD_ISOLATION=0 -ci/build_wheel.sh "${package_name}" python/libcuspatial cpp +ci/build_wheel.sh "${package_name}" ${package_dir} cpp +ci/validate_wheel.sh ${package_dir} final_dist diff --git a/ci/validate_wheel.sh b/ci/validate_wheel.sh new file mode 100755 index 000000000..5910a5c59 --- /dev/null +++ b/ci/validate_wheel.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Copyright (c) 2024, NVIDIA CORPORATION. + +set -euo pipefail + +package_dir=$1 +wheel_dir_relative_path=$2 + +cd "${package_dir}" + +rapids-logger "validate packages with 'pydistcheck'" + +pydistcheck \ + --inspect \ + "$(echo ${wheel_dir_relative_path}/*.whl)" + +rapids-logger "validate packages with 'twine'" + +twine check \ + --strict \ + "$(echo ${wheel_dir_relative_path}/*.whl)" diff --git a/python/cuproj/pyproject.toml b/python/cuproj/pyproject.toml index 35a95c728..c8049eadb 100644 --- a/python/cuproj/pyproject.toml +++ b/python/cuproj/pyproject.toml @@ -126,3 +126,11 @@ requires = [ "ninja", "wheel", ] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. + +[tool.pydistcheck] +select = [ + "distro-too-large-compressed", +] + +# PyPI limit is 100 MiB, fail CI before we get too close to that +max_allowed_size_compressed = '75M' diff --git a/python/cuspatial/pyproject.toml b/python/cuspatial/pyproject.toml index c497434c4..662648337 100644 --- a/python/cuspatial/pyproject.toml +++ b/python/cuspatial/pyproject.toml @@ -145,3 +145,11 @@ requires = [ "rmm==24.12.*,>=0.0.0a0", "wheel", ] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. + +[tool.pydistcheck] +select = [ + "distro-too-large-compressed", +] + +# PyPI limit is 100 MiB, fail CI before we get too close to that +max_allowed_size_compressed = '75M' diff --git a/python/libcuspatial/pyproject.toml b/python/libcuspatial/pyproject.toml index 1de8df8c1..725d2d882 100644 --- a/python/libcuspatial/pyproject.toml +++ b/python/libcuspatial/pyproject.toml @@ -75,3 +75,11 @@ requires = [ "ninja", "wheel", ] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. + +[tool.pydistcheck] +select = [ + "distro-too-large-compressed", +] + +# PyPI limit is 100 MiB, fail CI before we get too close to that +max_allowed_size_compressed = '75M'