Skip to content

Commit a87bf4b

Browse files
Build wheel and pypi support (#475)
* added github action and toml mods * wrong location * changing setup.py * fix build dependencies for sdist build * added changelog * fix changelog * back to old setup.py * fix wheels for macos * Addressing Uwe's comments * Adding testpypi step before uploading to pypi * fix wrong pypi url
1 parent b6a3391 commit a87bf4b

File tree

4 files changed

+99
-6
lines changed

4 files changed

+99
-6
lines changed

.github/workflows/build_wheels.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Build and upload to PyPI
2+
3+
on:
4+
pull_request:
5+
release:
6+
types:
7+
- published
8+
9+
jobs:
10+
build_wheels:
11+
name: Build wheels on ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-20.04, macos-10.15, windows-2019]
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Build wheels
21+
uses: pypa/[email protected]
22+
23+
- uses: actions/upload-artifact@v2
24+
with:
25+
path: ./wheelhouse/*.whl
26+
27+
build_sdist:
28+
name: Build source distribution
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v2
32+
33+
- uses: actions/setup-python@v2
34+
name: Install Python
35+
with:
36+
python-version: '3.8'
37+
38+
- name: Install build dependencies
39+
run: python -m pip install setuptools setuptools-scm wheel Cython numpy scikit-learn
40+
- name: Build sdist
41+
run: python setup.py sdist
42+
43+
- uses: actions/upload-artifact@v2
44+
with:
45+
path: dist/*.tar.gz
46+
47+
upload_testpypi:
48+
needs: [build_wheels, build_sdist]
49+
runs-on: ubuntu-latest
50+
if: github.event_name == 'release' && github.event.action == 'published'
51+
steps:
52+
- uses: actions/download-artifact@v2
53+
with:
54+
name: artifact
55+
path: dist
56+
57+
- uses: pypa/[email protected]
58+
with:
59+
user: __token__
60+
password: ${{ secrets.GH_TESTPYPI_UPLOAD }}
61+
repository_url: https://test.pypi.org/legacy/
62+
63+
upload_pypi:
64+
needs: [build_wheels, build_sdist, upload_testpypi]
65+
runs-on: ubuntu-latest
66+
if: github.event_name == 'release' && github.event.action == 'published'
67+
steps:
68+
- uses: actions/download-artifact@v2
69+
with:
70+
name: artifact
71+
path: dist
72+
73+
- uses: pypa/[email protected]
74+
with:
75+
user: __token__
76+
password: ${{ secrets.GH_PYPI_UPLOAD }}

CHANGELOG.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,19 @@
77
Changelog
88
=========
99

10-
Unreleased
11-
----------
10+
2.0.2 - 2021-11-03
11+
------------------
1212

1313
**Bug fix:**
1414

1515
- Fixed the sign of the log likelihood of the Gaussian distribution (not used for fitting coefficients).
16-
- Renamed functions checking for qc.matrix compliance to refer to tabmat.
1716
- Fixed the wide benchmarks which had duplicated columns (categorical and numerical).
1817

18+
** Other:**
19+
20+
- The CI now builds the wheels and upload to pypi with every new release.
21+
- Renamed functions checking for qc.matrix compliance to refer to tabmat.
22+
1923
2.0.1 - 2021-10-11
2024
------------------
2125

pyproject.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,17 @@ line_length = 88
2727
known_first_party = "glum"
2828
skip_glob = '\.eggs/*,\.git/*,\.venv/*,build/*,dist/*'
2929
default_section = 'THIRDPARTY'
30+
31+
[tool.cibuildwheel]
32+
skip = ["cp310-*", "pp*"]
33+
test-requires = ["pytest", "pytest-xdist"]
34+
35+
[tool.cibuildwheel.macos]
36+
before-all = [
37+
"brew install llvm libomp",
38+
]
39+
40+
[tool.cibuildwheel.macos.environment]
41+
LDFLAGS="-L/usr/local/lib"
42+
CXX="/usr/local/opt/llvm/bin/clang++"
43+
CC="/usr/local/opt/llvm/bin/clang"

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import os
22
import sys
3-
from os import path
43

54
import numpy as np
65
from Cython.Build import cythonize
76
from setuptools import Extension, find_packages, setup
87

9-
here = path.abspath(path.dirname(__file__))
8+
here = os.path.abspath(os.path.dirname(__file__))
109

11-
with open(path.join(here, "README.md"), encoding="utf-8") as f:
10+
with open(os.path.join(here, "README.md"), encoding="utf-8") as f:
1211
long_description = f.read()
1312

1413
if sys.platform == "win32":

0 commit comments

Comments
 (0)