Skip to content

Commit 588a749

Browse files
Add script to automatically download wheels (#50859)
1 parent 7aee076 commit 588a749

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

doc/source/development/maintaining.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,8 @@ which will be triggered when the tag is pushed.
465465

466466
7. Download all wheels from the Anaconda repository where MacPython uploads them:
467467
https://anaconda.org/multibuild-wheels-staging/pandas/files?version=<version>
468-
to the ``dist/`` directory in the local pandas copy.
468+
to the ``dist/`` directory in the local pandas copy. You can use the script
469+
``scripts/download_wheels.sh`` to download all wheels at once.
469470

470471
8. Upload wheels to PyPI:
471472

scripts/download_wheels.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
#
3+
# Download all wheels for a pandas version.
4+
#
5+
# This script is mostly useful during the release process, when wheels
6+
# generated by the MacPython repo need to be downloaded locally to then
7+
# be uploaded to the PyPI.
8+
#
9+
# There is no API to access the wheel files, so the script downloads the
10+
# website, extracts the file urls from the html, and then downloads it
11+
# one by one to the dist/ directory where they would be generated.
12+
13+
VERSION=$1
14+
DIST_DIR="$(realpath $(dirname -- $0)/../dist)"
15+
16+
if [ -z $VERSION ]; then
17+
printf "Usage:\n\t$0 <version>\n\nWhere <version> is for example 1.5.3"
18+
exit 1
19+
fi
20+
21+
curl "https://anaconda.org/multibuild-wheels-staging/pandas/files?version=${VERSION}" | \
22+
grep "href=\"/multibuild-wheels-staging/pandas/${VERSION}" | \
23+
sed -r 's/.*<a href="([^"]+\.whl)">.*/\1/g' | \
24+
awk '{print "https://anaconda.org" $0 }' | \
25+
xargs wget -P $DIST_DIR
26+
27+
printf "\nWheels downloaded to $DIST_DIR\nYou can upload them to PyPI using:\n\n"
28+
printf "\ttwine upload ${DIST_DIR}/pandas-${VERSION}*.{whl,tar.gz} --skip-existing"

0 commit comments

Comments
 (0)