Skip to content

Commit f4cff8e

Browse files
committedDec 16, 2020
provides wheels ⚙️
1 parent 9a7e53e commit f4cff8e

File tree

5 files changed

+106
-12
lines changed

5 files changed

+106
-12
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
set -e -x
4+
5+
PY_MAJOR=${PYTHON_VERSION%%.*}
6+
PY_MINOR=${PYTHON_VERSION#*.}
7+
8+
ML_PYTHON_VERSION="cp${PY_MAJOR}${PY_MINOR}-cp${PY_MAJOR}${PY_MINOR}"
9+
if [ "${PY_MAJOR}" -lt "4" -a "${PY_MINOR}" -lt "8" ]; then
10+
ML_PYTHON_VERSION+="m"
11+
fi
12+
13+
# Compile wheels
14+
PYTHON="/opt/python/${ML_PYTHON_VERSION}/bin/python"
15+
PIP="/opt/python/${ML_PYTHON_VERSION}/bin/pip"
16+
"${PIP}" install --upgrade setuptools pip wheel~=0.31.1
17+
cd "${GITHUB_WORKSPACE}"
18+
19+
rm -rf dist/
20+
"${PYTHON}" setup.py bdist_wheel
21+
22+
# Bundle external shared libraries into the wheels.
23+
for whl in "${GITHUB_WORKSPACE}"/dist/*.whl; do
24+
auditwheel repair $whl -w "${GITHUB_WORKSPACE}"/dist/
25+
rm "${GITHUB_WORKSPACE}"/dist/*-linux_*.whl
26+
done

‎.github/workflows/main.yml

+72-6
Original file line numberDiff line numberDiff line change
@@ -114,28 +114,94 @@ jobs:
114114
115115
- name: Install distribution dependencies
116116
run: pip install --upgrade twine setuptools wheel
117-
if: matrix.os == 'ubuntu-18.04' && (matrix.python-version == 3.8 || matrix.python-version == 3.9)
117+
if: matrix.os == 'ubuntu-18.04' && matrix.python-version == 3.9
118118

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

123123
- name: Upload distribution package
124124
uses: actions/upload-artifact@master
125125
with:
126-
name: dist-package-${{ matrix.python-version }}
126+
name: dist
127+
path: dist
128+
if: matrix.os == 'ubuntu-18.04' && matrix.python-version == 3.9
129+
130+
build-wheels:
131+
needs: build
132+
if: github.event_name == 'release'
133+
runs-on: ${{ matrix.os }}
134+
strategy:
135+
fail-fast: false
136+
matrix:
137+
python-version: [3.7, 3.8, 3.9]
138+
os: [ubuntu-18.04, macos-latest, windows-latest]
139+
140+
steps:
141+
- uses: actions/checkout@v1
142+
with:
143+
fetch-depth: 9
144+
145+
- name: Set up Python ${{ matrix.python-version }}
146+
uses: actions/setup-python@v1
147+
with:
148+
python-version: ${{ matrix.python-version }}
149+
150+
- name: Install dependencies
151+
run: |
152+
pip install cython==0.29.14 --install-option="--no-cython-compile"
153+
pip install -r requirements.txt
154+
155+
- name: Compile Cython extensions
156+
run: |
157+
make clean
158+
159+
cython blacksheep/url.pyx
160+
cython blacksheep/exceptions.pyx
161+
cython blacksheep/headers.pyx
162+
cython blacksheep/cookies.pyx
163+
cython blacksheep/contents.pyx
164+
cython blacksheep/messages.pyx
165+
cython blacksheep/scribe.pyx
166+
cython blacksheep/baseapp.pyx
167+
168+
- name: Install build dependencies
169+
run: |
170+
python -m pip install --upgrade setuptools pip wheel
171+
172+
- name: Build wheels (linux)
173+
if: startsWith(matrix.os, 'ubuntu')
174+
uses: docker://quay.io/pypa/manylinux1_x86_64
175+
env:
176+
PYTHON_VERSION: ${{ matrix.python-version }}
177+
with:
178+
entrypoint: /github/workspace/.github/workflows/build-manylinux-wheels.sh
179+
180+
- name: Build wheels (non-linux)
181+
if: "!startsWith(matrix.os, 'ubuntu')"
182+
run: |
183+
python setup.py bdist_wheel
184+
185+
- name: Test wheels
186+
if: |
187+
!startsWith(matrix.os, 'windows')
188+
run: |
189+
pip install --pre blacksheep -f "file:///${GITHUB_WORKSPACE}/dist"
190+
191+
- uses: actions/upload-artifact@v1
192+
with:
193+
name: dist
127194
path: dist
128-
if: matrix.os == 'ubuntu-18.04' && (matrix.python-version == 3.8 || matrix.python-version == 3.9)
129195

130196
publish:
131197
runs-on: ubuntu-18.04
132-
needs: build
198+
needs: [build, build-wheels]
133199
if: github.event_name == 'release'
134200
steps:
135201
- name: Download a distribution artifact
136202
uses: actions/download-artifact@v2
137203
with:
138-
name: dist-package-3.9
204+
name: dist
139205
path: dist
140206
- name: Publish distribution 📦 to Test PyPI
141207
uses: pypa/gh-action-pypi-publish@master

‎CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.3.0] - 2020-12-16 :gear:
9+
- Builds `wheels` and packs them in the distribution package.
10+
811
## [0.2.9] - 2020-12-12 🏳️
912
- Corrects inconsistent dependency causing an error in `pip-20.3.1`.
1013

‎README.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -217,16 +217,13 @@ loop.run_until_complete(client_example(loop))
217217
```
218218

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

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

231228
## Documentation
232229
Please refer to the [documentation website](https://www.neoteroi.dev/blacksheep/).

‎setup.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ def readme():
66
return f.read()
77

88

9-
COMPILE_ARGS = ["-O3"]
9+
COMPILE_ARGS = ["-O2"]
1010

1111

1212
setup(
1313
name="blacksheep",
14-
version="0.2.9",
14+
version="0.3.0",
1515
description="Fast web framework and HTTP client for Python asyncio",
1616
long_description=readme(),
1717
long_description_content_type="text/markdown",
@@ -21,9 +21,11 @@ def readme():
2121
"Programming Language :: Python :: 3.7",
2222
"Programming Language :: Python :: 3.8",
2323
"Programming Language :: Python :: 3.9",
24+
"Environment :: Web Environment",
2425
"Operating System :: OS Independent",
2526
"Framework :: AsyncIO",
2627
],
28+
setup_requires=["wheel"],
2729
url="https://github.com/RobertoPrevato/BlackSheep",
2830
author="Roberto Prevato",
2931
author_email="roberto.prevato@gmail.com",

0 commit comments

Comments
 (0)
Please sign in to comment.