diff --git a/Dockerfile.package b/Dockerfile.package new file mode 100644 index 0000000..7e0c7eb --- /dev/null +++ b/Dockerfile.package @@ -0,0 +1 @@ +FROM quay.io/pypa/manylinux_2_28_x86_64 diff --git a/Dockerfile.pkg1 b/Dockerfile.pkg1 deleted file mode 100644 index 286fd14..0000000 --- a/Dockerfile.pkg1 +++ /dev/null @@ -1,27 +0,0 @@ -FROM ubuntu:20.04 - -RUN apt update && \ - DEBIAN_FRONTEND=noninteractive apt install -y python3 python3.8-venv python3.9 python3.9-venv python3-setuptools python3-pip git build-essential cmake wget python3.9-dev -RUN cd /tmp \ - && wget https://github.com/Kitware/CMake/releases/download/v3.30.4/cmake-3.30.4-linux-x86_64.tar.gz \ - && tar -xf cmake-3.30.4-linux-x86_64.tar.gz \ - && cp -r cmake-3.30.4-linux-x86_64/bin/* /usr/local/bin/ \ - && cp -r cmake-3.30.4-linux-x86_64/man/* /usr/local/man/ \ - && cp -r cmake-3.30.4-linux-x86_64/share/* /usr/local/share/ - -COPY . /grgl_src - -ENV PATH="/grgl_src/Env38/bin:$PATH" -# Build the Python 3.8 wheel -RUN cd /grgl_src \ - && python3.8 -m venv Env38 \ - && pip3 install wheel \ - && GRGL_GSL=1 GRGL_BGEN=1 python setup.py bdist_wheel -ENV PATH="/grgl_src/Env39/bin:$PATH" -# Build the Python 3.9 wheel -RUN cd /grgl_src \ - && python3.9 -m venv Env39 \ - && pip3 install wheel \ - && GRGL_GSL=1 GRGL_BGEN=1 python setup.py bdist_wheel -# Copy to an easily accesible location -RUN mkdir /output && cp /grgl_src/dist/*.whl /output/ diff --git a/Dockerfile.pkg2 b/Dockerfile.pkg2 deleted file mode 100644 index 4f03c35..0000000 --- a/Dockerfile.pkg2 +++ /dev/null @@ -1,21 +0,0 @@ -FROM ubuntu:22.04 - -RUN apt update && \ - DEBIAN_FRONTEND=noninteractive apt install -y python3.10 python3.10-venv python3.10-dev python3.11 python3.11-venv python3.11-dev python3-setuptools python3-pip git build-essential cmake wget - -COPY . /grgl_src - -ENV PATH="/grgl_src/Env310/bin:$PATH" -# Build the Python 3.10 wheel -RUN cd /grgl_src \ - && python3.10 -m venv Env310 \ - && pip3 install wheel \ - && GRGL_GSL=1 GRGL_BGEN=1 python setup.py bdist_wheel -ENV PATH="/grgl_src/Env311/bin:$PATH" -# Build the Python 3.11 wheel -RUN cd /grgl_src \ - && python3.11 -m venv Env311 \ - && pip3 install wheel \ - && GRGL_GSL=1 GRGL_BGEN=1 python setup.py bdist_wheel -# Copy to an easily accesible location -RUN mkdir /output && cp /grgl_src/dist/*.whl /output/ diff --git a/RELEASING.md b/RELEASING.md index c39e4f5..9b28a76 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -16,29 +16,28 @@ Steps: ## Packaging for PyPi -Build the package distributions for PyPi. We build a source dist and then Linux binary distributions for recent Python versions. +Build the package distributions for PyPi. We build a source dist and then Linux binary distributions for recent Python versions. The container is based on the [manylinux](https://github.com/pypa/manylinux) project. ``` # Remove dist/ to start fresh rm -rf dist -# Build the source distribution (for MacOS, mostly) -python setup.py sdist +# Build the container based on the manylinux project +docker build . -f Dockerfile.pkg -t grgl_pkg:latest -# Build the Python3.8 and Python3.9 packages on an older Docker image -docker build . -f Dockerfile.pkg1 -t grgl_pkg1:latest -docker run -v $PWD/dist:/dist -it grgl_pkg1:latest bash -c "cp /output/*.whl /dist/" - -# Build the Python3.10+ packages on a newer Docker image -docker build . -f Dockerfile.pkg2 -t grgl_pkg2:latest -docker run -v $PWD/dist:/dist -it grgl_pkg2:latest bash -c "cp /output/*.whl /dist/" +# Run the packaging inside the container +docker run -v $PWD:/io -it grgl_pkg:latest /io/package.sh # Fix file permissions from Docker -sudo chown ddehaas dist/*.whl -sudo chgrp ddehaas dist/*.whl +sudo chown -R ddehaas dist/ +sudo chgrp -R ddehaas dist/ + +# Copy the source wheel to wheelhouse +cp ./dist/*.tar.gz ./dist/wheelhouse/ + ``` -To upload to PyPi, ensure that your dist directory is clean (only has the packages you _just_ built), then upload via twine: +To upload to PyPi: ``` -python3 -m twine upload dist/* +python3 -m twine upload dist/wheelhouse/* ``` diff --git a/package.sh b/package.sh new file mode 100755 index 0000000..36ccba1 --- /dev/null +++ b/package.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +set -ev + +cd /io + +# Build the source distribution +/opt/python/cp38-cp38/bin/python setup.py sdist + +echo "Building for Python 3.8" +GRGL_GSL=1 GRGL_BGEN=1 /opt/python/cp38-cp38/bin/python setup.py bdist_wheel +echo "Building for Python 3.9" +GRGL_GSL=1 GRGL_BGEN=1 /opt/python/cp39-cp39/bin/python setup.py bdist_wheel +echo "Building for Python 3.10" +GRGL_GSL=1 GRGL_BGEN=1 /opt/python/cp310-cp310/bin/python setup.py bdist_wheel +echo "Building for Python 3.11" +GRGL_GSL=1 GRGL_BGEN=1 /opt/python/cp311-cp311/bin/python setup.py bdist_wheel +echo "Building for Python 3.12" +GRGL_GSL=1 GRGL_BGEN=1 /opt/python/cp312-cp312/bin/python setup.py bdist_wheel + +cd /io/dist +auditwheel repair --plat manylinux_2_24_x86_64 pygrgl-1.1-cp38-cp38-linux_x86_64.whl +auditwheel repair --plat manylinux_2_24_x86_64 pygrgl-1.1-cp39-cp39-linux_x86_64.whl +auditwheel repair --plat manylinux_2_24_x86_64 pygrgl-1.1-cp310-cp310-linux_x86_64.whl +auditwheel repair --plat manylinux_2_24_x86_64 pygrgl-1.1-cp311-cp311-linux_x86_64.whl +auditwheel repair --plat manylinux_2_24_x86_64 pygrgl-1.1-cp312-cp312-linux_x86_64.whl