-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(Stage 1) Python Wheels for PyPi (#2010)
- Loading branch information
Showing
6 changed files
with
379 additions
and
93 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 |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: "Create Python Wheels" | ||
|
||
on: | ||
release: | ||
types: [ created ] | ||
workflow_dispatch: {} | ||
|
||
env: | ||
STAN_BACKEND: "PYSTAN,CMDSTANPY" | ||
CMDSTAN_VERSION: "2.26.1" | ||
|
||
jobs: | ||
make-wheels-macos-linux: | ||
name: ${{ matrix.python-version }}-${{ matrix.architecture }}-${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: | ||
- "macos-latest" | ||
- "ubuntu-latest" | ||
python-version: | ||
- "3.6" | ||
- "3.7" | ||
- "3.8" | ||
architecture: | ||
- x64 | ||
|
||
fail-fast: false | ||
|
||
steps: | ||
- name: "Get OS version (Linux)" | ||
if: startsWith(runner.os, 'Linux') | ||
run: | | ||
echo "OS_VERSION=`lsb_release -sr`" >> $GITHUB_ENV | ||
echo "PIP_DEFAULT_CACHE=$HOME/.cache/pip" >> $GITHUB_ENV | ||
echo "DEFAULT_HOME=$HOME" >> $GITHUB_ENV | ||
- name: "Get OS version (macOS)" | ||
if: startsWith(runner.os, 'macOS') | ||
run: | | ||
echo "OS_VERSION=`sw_vers -productVersion`" >> $GITHUB_ENV | ||
echo "PIP_DEFAULT_CACHE=$HOME/Library/Caches/pip" >> $GITHUB_ENV | ||
echo "DEFAULT_HOME=$HOME" >> $GITHUB_ENV | ||
- name: "Checkout repo" | ||
uses: actions/checkout@v2 | ||
|
||
- name: "Set up Python" | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
architecture: ${{ matrix.architecture }} | ||
|
||
- name: "Restore pip cache" | ||
id: cache-pip | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ env.PIP_DEFAULT_CACHE }} | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/python/requirements.txt') }}-v1 | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: "Install pip" | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install cibuildwheel build | ||
- name: "Restore cmdstan cache" | ||
id: cache-cmdstan | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ env.DEFAULT_HOME }}/.cmdstan | ||
key: ${{ runner.os }}-cmdstan-${{ env.CMDSTAN_VERSION }}-v1 | ||
|
||
- name: "Download cmdstan" | ||
if: steps.cache-cmdstan.outputs.cache-hit != 'true' | ||
run: | | ||
wget https://github.com/stan-dev/cmdstan/releases/download/v${{ env.CMDSTAN_VERSION }}/cmdstan-${{ env.CMDSTAN_VERSION }}.tar.gz -O /tmp/cmdstan.tar.gz &> /dev/null | ||
mkdir $HOME/.cmdstan | ||
tar -xf /tmp/cmdstan.tar.gz -C $HOME/.cmdstan &> /dev/null | ||
- name: "Build wheel" | ||
run: | | ||
cd python && python -m cibuildwheel --output-dir wheelhouse | ||
env: | ||
CIBW_ENVIRONMENT: > | ||
STAN_BACKEND="${{ env.STAN_BACKEND }}" | ||
CMDSTAN_VERSION=${{ env.CMDSTAN_VERSION }} | ||
# Linux builds run in a Docker container, need to point the cache to the host machine. | ||
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | ||
CIBW_ENVIRONMENT_LINUX: > | ||
STAN_BACKEND="${{ env.STAN_BACKEND }}" | ||
CMDSTAN_VERSION=${{ env.CMDSTAN_VERSION }} | ||
HOME="/host/${{ env.DEFAULT_HOME }}" | ||
PIP_CACHE_DIR="/host/${{ env.PIP_DEFAULT_CACHE }}" | ||
CIBW_BEFORE_ALL_LINUX: sudo chmod -R a+rwx ${{ env.PIP_DEFAULT_CACHE }} | ||
CIBW_ARCHS: native | ||
CIBW_BUILD_FRONTEND: build | ||
CIBW_TEST_REQUIRES: pytest | ||
CIBW_TEST_COMMAND: pytest --pyargs prophet | ||
|
||
- name: "Upload wheel as artifact" | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ matrix.os }}-wheel | ||
path: "./**/*.whl" |
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,8 @@ | ||
[build-system] | ||
requires = [ | ||
"setuptools>=42", | ||
"wheel", | ||
"pystan~=2.19.1.1", | ||
"cmdstanpy==0.9.77", | ||
] | ||
build-backend = "setuptools.build_meta" |
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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
Cython>=0.22 | ||
cmdstanpy==0.9.68 | ||
cmdstanpy==0.9.77 | ||
pystan~=2.19.1.1 | ||
numpy>=1.15.4 | ||
pandas>=1.0.4 | ||
matplotlib>=2.0.0 | ||
LunarCalendar>=0.0.9 | ||
convertdate>=2.1.2 | ||
holidays>=0.11.3.1 | ||
setuptools>=42 | ||
setuptools-git>=1.2 | ||
python-dateutil>=2.8.0 | ||
tqdm>=4.36.1 | ||
wheel>=0.37.0 |
Oops, something went wrong.