Skip to content

Commit

Permalink
Merge pull request #25 from klarman-cell-observatory/yiming
Browse files Browse the repository at this point in the history
reorg setup for linux wheel building
  • Loading branch information
yihming committed Jun 19, 2020
2 parents cfaa6b4 + c62ebe2 commit 72df0e0
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 22 deletions.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ exclude .*
exclude tests/*
exclude docs/**
exclude notebooks/*
exclude wheel_build/*
exclude build_linux.sh
4 changes: 4 additions & 0 deletions build_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
docker pull quay.io/pypa/manylinux2014_x86_64
docker run -it --rm -e PLAT=manylinux2014_x86_64 -v `pwd`:/src -v `pwd`/dist:/wheelhouse quay.io/pypa/manylinux2014_x86_64 /bin/sh -c "/src/wheel_build/build_wheel_for_linux.sh"
docker pull quay.io/pypa/manylinux2014_i686
docker run -it --rm -e PLAT=manylinux1_i686 -v `pwd`:/src -v `pwd`/dist:/wheelhouse quay.io/pypa/manylinux2014_i686 /bin/sh -c "/src/wheel_build/build_wheel_for_linux.sh"
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[build-system]
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4", "Cython"]

[tool.setuptools_scm]
write_to = "pegasusio/version.py"
18 changes: 11 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
anndata>=0.6.22rc1
matplotlib>=2.0.0
pandas>=0.21
scipy<1.3
scikit-learn>=0.21.3
umap-learn>=0.3.9
lightgbm==2.2.1
Cython
anndata
loompy
docopt
natsort
numpy
pandas
scipy
setuptools
importlib-metadata
zarr
20 changes: 5 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,14 @@
from setuptools.extension import Extension
from Cython.Build import cythonize
from codecs import open
from pathlib import Path
import os


here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "README.rst"), encoding="utf-8") as f:
long_description = f.read()

requires = [
"Cython",
"anndata",
"loompy",
"docopt",
"natsort",
"numpy",
"pandas",
"scipy",
"setuptools",
"importlib-metadata",
"zarr"
]

extensions = [
Extension("pegasusio.cylib.funcs", ["ext_modules/fast_funcs.pyx"]),
Extension("pegasusio.cylib.io", ["ext_modules/io_funcs.pyx"])
Expand All @@ -46,6 +33,7 @@
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Framework :: Jupyter",
"Natural Language :: English",
"Operating System :: MacOS :: MacOS X",
Expand All @@ -56,7 +44,9 @@
packages=find_packages(),
ext_modules=cythonize(extensions),
setup_requires=["Cython", "setuptools_scm"],
install_requires=requires,
install_requires=[
l.strip() for l in Path("requirements.txt").read_text("utf-8").splitlines()
],
python_requires="~=3.6",
entry_points={"console_scripts": ["pegasusio=pegasusio.__main__:main"]},
)
34 changes: 34 additions & 0 deletions wheel_build/build_wheel_for_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
set -e -u -x

function repair_wheel {
wheel="$1"
if ! auditwheel show "$wheel"; then
echo "Skipping non-platform wheel $wheel"
else
auditwheel repair "$whl" --plat "$PLAT" -w /wheelhouse/
rm "$whl"
fi
}

if [[ $PLAT =~ .*_x86_64 ]]; then
declare -a PythonVersions=("cp36-cp36m" "cp37-cp37m" "cp38-cp38")
else
declare -a PythonVersions=("cp36-cp36m" "cp37-cp37m")
fi

for val in ${PythonVersions[@]}; do
/opt/python/$val/bin/pip install -r /src/requirements.txt
/opt/python/$val/bin/pip wheel /src/ --no-deps -w /wheelhouse/
done


if [[ $PLAT =~ .*_x86_64 ]]; then
suffix=*_x86_64.whl
else
suffix=*_i686.whl
fi

for whl in /wheelhouse/$suffix; do
repair_wheel "$whl"
done

0 comments on commit 72df0e0

Please sign in to comment.