-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix building for Python version (#3)
* Update poetry and lock file * Fix wheel building for all Python versions Bump version * Add testing
- Loading branch information
1 parent
22b7476
commit 796cd57
Showing
10 changed files
with
182 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,4 +160,7 @@ cython_debug/ | |
#.idea/ | ||
|
||
# Automatically generated | ||
setup.py | ||
setup.py | ||
|
||
# Wheel directories | ||
wheelhouse/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM quay.io/pypa/manylinux2014_x86_64 | ||
|
||
# Install poetry | ||
RUN curl -sSL https://install.python-poetry.org | /opt/python/cp310-cp310/bin/python3 - && \ | ||
ln -s /root/.local/bin/poetry /usr/local/bin/poetry | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Copy project files | ||
COPY . . | ||
|
||
# Create directory for wheels | ||
RUN mkdir -p /app/wheelhouse && chmod +x /app/build_wheels.sh | ||
|
||
# Default command to build wheels | ||
CMD ["/app/build_wheels.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
set -e # Exit on any error | ||
|
||
# Build the Docker image | ||
echo "Building Docker image..." | ||
docker build -t lazyk-builder . | ||
|
||
# Create wheelhouse directory if it doesn't exist | ||
mkdir -p wheelhouse | ||
|
||
# Build the wheels | ||
echo "Building wheels..." | ||
docker run --rm -v $(pwd):/app lazyk-builder | ||
|
||
# List the built wheels | ||
echo "Built wheels:" | ||
ls -l wheelhouse/ | ||
|
||
echo "Build complete! Wheels are in ./wheelhouse/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
# Install dependencies and build wheels for each Python version | ||
for PYBIN in /opt/python/cp3*/bin; do | ||
"${PYBIN}/pip" install poetry pybind11 numpy cython wheel setuptools | ||
"${PYBIN}/poetry" config virtualenvs.create false | ||
"${PYBIN}/poetry" install --no-root | ||
"${PYBIN}/poetry" build -f wheel | ||
done | ||
|
||
# Bundle external shared libraries into the wheels | ||
for whl in dist/*.whl; do | ||
auditwheel repair "$whl" --plat manylinux2014_x86_64 -w /app/wheelhouse/ | ||
done |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
set -e # Exit on any error | ||
|
||
# Parse command line arguments | ||
IS_TEST=false | ||
if [ "$1" == "--test" ]; then | ||
IS_TEST=true | ||
fi | ||
|
||
# Set credentials based on environment | ||
if [ "$IS_TEST" = true ]; then | ||
USERNAME="$PYPI_TEST_USERNAME" | ||
PASSWORD="$PYPI_TEST_PASSWORD" | ||
REPO="https://test.pypi.org/legacy/" | ||
echo "Using TestPyPI environment..." | ||
else | ||
USERNAME="$PYPI_USERNAME" | ||
PASSWORD="$PYPI_PASSWORD" | ||
REPO="https://upload.pypi.org/legacy/" | ||
echo "Using production PyPI environment..." | ||
fi | ||
|
||
# Check if credentials are set | ||
if [ -z "$USERNAME" ] || [ -z "$PASSWORD" ]; then | ||
echo "Please set $([ "$IS_TEST" = true ] && echo "PYPI_TEST_USERNAME and PYPI_TEST_PASSWORD" || echo "PYPI_USERNAME and PYPI_PASSWORD") environment variables" | ||
exit 1 | ||
fi | ||
|
||
# Install twine if not already installed | ||
pip install --upgrade twine | ||
|
||
# Check the distribution files | ||
echo "Checking distribution files..." | ||
twine check wheelhouse/* | ||
|
||
# Prompt for confirmation | ||
echo "Ready to upload to PyPI. Please confirm (y/n)" | ||
read -r confirm | ||
if [ "$confirm" != "y" ]; then | ||
echo "Upload cancelled" | ||
exit 1 | ||
fi | ||
|
||
# Upload to PyPI | ||
echo "Uploading to $([ "$IS_TEST" = true ] && echo "TestPyPI" || echo "PyPI")..." | ||
twine upload --repository-url "$REPO" --username "$USERNAME" --password "$PASSWORD" wheelhouse/* | ||
|
||
echo "Upload complete!" |
Oops, something went wrong.