Skip to content

Commit

Permalink
provides wheels ⚙️
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertoPrevato committed Dec 16, 2020
1 parent 9a7e53e commit f4cff8e
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 12 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build-manylinux-wheels.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

set -e -x

PY_MAJOR=${PYTHON_VERSION%%.*}
PY_MINOR=${PYTHON_VERSION#*.}

ML_PYTHON_VERSION="cp${PY_MAJOR}${PY_MINOR}-cp${PY_MAJOR}${PY_MINOR}"
if [ "${PY_MAJOR}" -lt "4" -a "${PY_MINOR}" -lt "8" ]; then
ML_PYTHON_VERSION+="m"
fi

# Compile wheels
PYTHON="/opt/python/${ML_PYTHON_VERSION}/bin/python"
PIP="/opt/python/${ML_PYTHON_VERSION}/bin/pip"
"${PIP}" install --upgrade setuptools pip wheel~=0.31.1
cd "${GITHUB_WORKSPACE}"

rm -rf dist/
"${PYTHON}" setup.py bdist_wheel

# Bundle external shared libraries into the wheels.
for whl in "${GITHUB_WORKSPACE}"/dist/*.whl; do
auditwheel repair $whl -w "${GITHUB_WORKSPACE}"/dist/
rm "${GITHUB_WORKSPACE}"/dist/*-linux_*.whl
done
78 changes: 72 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,28 +114,94 @@ jobs:
- name: Install distribution dependencies
run: pip install --upgrade twine setuptools wheel
if: matrix.os == 'ubuntu-18.04' && (matrix.python-version == 3.8 || matrix.python-version == 3.9)
if: matrix.os == 'ubuntu-18.04' && matrix.python-version == 3.9

- name: Create distribution package
run: python setup.py sdist
if: matrix.os == 'ubuntu-18.04' && (matrix.python-version == 3.8 || matrix.python-version == 3.9)
if: matrix.os == 'ubuntu-18.04' && matrix.python-version == 3.9

- name: Upload distribution package
uses: actions/upload-artifact@master
with:
name: dist-package-${{ matrix.python-version }}
name: dist
path: dist
if: matrix.os == 'ubuntu-18.04' && matrix.python-version == 3.9

build-wheels:
needs: build
if: github.event_name == 'release'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9]
os: [ubuntu-18.04, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v1
with:
fetch-depth: 9

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install cython==0.29.14 --install-option="--no-cython-compile"
pip install -r requirements.txt
- name: Compile Cython extensions
run: |
make clean
cython blacksheep/url.pyx
cython blacksheep/exceptions.pyx
cython blacksheep/headers.pyx
cython blacksheep/cookies.pyx
cython blacksheep/contents.pyx
cython blacksheep/messages.pyx
cython blacksheep/scribe.pyx
cython blacksheep/baseapp.pyx
- name: Install build dependencies
run: |
python -m pip install --upgrade setuptools pip wheel
- name: Build wheels (linux)
if: startsWith(matrix.os, 'ubuntu')
uses: docker://quay.io/pypa/manylinux1_x86_64
env:
PYTHON_VERSION: ${{ matrix.python-version }}
with:
entrypoint: /github/workspace/.github/workflows/build-manylinux-wheels.sh

- name: Build wheels (non-linux)
if: "!startsWith(matrix.os, 'ubuntu')"
run: |
python setup.py bdist_wheel
- name: Test wheels
if: |
!startsWith(matrix.os, 'windows')
run: |
pip install --pre blacksheep -f "file:///${GITHUB_WORKSPACE}/dist"
- uses: actions/upload-artifact@v1
with:
name: dist
path: dist
if: matrix.os == 'ubuntu-18.04' && (matrix.python-version == 3.8 || matrix.python-version == 3.9)

publish:
runs-on: ubuntu-18.04
needs: build
needs: [build, build-wheels]
if: github.event_name == 'release'
steps:
- name: Download a distribution artifact
uses: actions/download-artifact@v2
with:
name: dist-package-3.9
name: dist
path: dist
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@master
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.3.0] - 2020-12-16 :gear:
- Builds `wheels` and packs them in the distribution package.

## [0.2.9] - 2020-12-12 🏳️
- Corrects inconsistent dependency causing an error in `pip-20.3.1`.

Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,13 @@ loop.run_until_complete(client_example(loop))
```

## Supported platforms and runtimes
The following Python versions are supported and tested by [validation
pipeline](./azure-pipelines.yml):
* Python 3.7 (cpython)
* Python 3.8 (cpython)
* Python 3.9 (cpython)

The following platforms are supported and tested by [validation
pipeline](./azure-pipelines.yml):
* Ubuntu 18.04
* Windows 10
* macOS

## Documentation
Please refer to the [documentation website](https://www.neoteroi.dev/blacksheep/).
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ def readme():
return f.read()


COMPILE_ARGS = ["-O3"]
COMPILE_ARGS = ["-O2"]


setup(
name="blacksheep",
version="0.2.9",
version="0.3.0",
description="Fast web framework and HTTP client for Python asyncio",
long_description=readme(),
long_description_content_type="text/markdown",
Expand All @@ -21,9 +21,11 @@ def readme():
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Environment :: Web Environment",
"Operating System :: OS Independent",
"Framework :: AsyncIO",
],
setup_requires=["wheel"],
url="https://github.com/RobertoPrevato/BlackSheep",
author="Roberto Prevato",
author_email="roberto.prevato@gmail.com",
Expand Down

0 comments on commit f4cff8e

Please sign in to comment.