Skip to content

Commit 1a837fc

Browse files
authored
Build/publish binary wheels with cibuildwheel (#52)
* Create python-publish.yml * Modernize setuptools * Bump version number and dependabot warnings * Update test-ci workflow to match current versions * Skip PyPy wheel builds
1 parent 18c4686 commit 1a837fc

File tree

5 files changed

+111
-45
lines changed

5 files changed

+111
-45
lines changed

.github/dependabot.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly

.github/workflows/python-publish.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Build and upload to PyPI
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
release:
10+
types:
11+
- published
12+
13+
jobs:
14+
build_wheels:
15+
name: Build wheels on ${{ matrix.os }}
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
matrix:
19+
# macos-13 is an intel runner, macos-14 is apple silicon
20+
os: [ubuntu-latest, macos-13, macos-14]
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Build wheels
26+
uses: pypa/[email protected]
27+
28+
- name: Upload artifact
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
32+
path: ./wheelhouse/*.whl
33+
34+
build_sdist:
35+
name: Build source distribution
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
- name: Build sdist
40+
run: pipx run build --sdist
41+
42+
- name: Upload artifact
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: cibw-sdist
46+
path: dist/*.tar.gz
47+
48+
upload_pypi:
49+
needs: [build_wheels, build_sdist]
50+
runs-on: ubuntu-latest
51+
environment: pypi
52+
permissions:
53+
id-token: write
54+
if: github.event_name == 'release' && github.event.action == 'published'
55+
steps:
56+
- name: Download artifacts from other jobs
57+
uses: actions/download-artifact@v4
58+
with:
59+
# unpacks all CIBW artifacts into dist/
60+
pattern: cibw-*
61+
path: dist
62+
merge-multiple: true
63+
64+
- name: Publish to Pypi
65+
uses: pypa/gh-action-pypi-publish@release/v1
66+
with:
67+
repository-url: https://test.pypi.org/legacy/

.github/workflows/test-ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
strategy:
88
fail-fast: false
99
matrix:
10-
python-version: ['3.8', '3.9', '3.10']
10+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
1111
os: ['ubuntu-latest', 'macos-latest']
1212
runs-on: ${{ matrix.os }}
1313
steps:

pyproject.toml

+35-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,37 @@
11
[build-system]
2-
requires = ["setuptools", "wheel", "Cython"]
2+
requires = ["setuptools>=75.6.0", "wheel", "cython>=0.29"]
33
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "faster-fifo"
7+
version = "1.5.0"
8+
description = "A faster alternative to Python's standard multiprocessing.Queue (IPC FIFO queue)"
9+
readme = {file = "README.md", content-type = "text/markdown"}
10+
requires-python = ">=3.9"
11+
license = {text = "MIT"}
12+
authors = [
13+
{name = "Aleksei Petrenko"},
14+
{name = "Tushar Kumar"}
15+
]
16+
keywords = ["multiprocessing", "data structures"]
17+
urls = { homepage = "https://github.com/alex-petrenko/faster-fifo" }
18+
19+
[project.optional-dependencies]
20+
dev = ["twine", "numpy>=1.18.1,<2.0"]
21+
22+
[tool.setuptools]
23+
ext-modules = [
24+
{ name='faster_fifo', sources=['faster_fifo.pyx', 'cpp_faster_fifo/cpp_lib/faster_fifo.cpp'], language='c++', extra-compile-args=['-std=c++11'], include-dirs=['cpp_faster_fifo/cpp_lib']}
25+
]
26+
27+
[tool.setuptools.packages.find]
28+
where = ["./"]
29+
include = ["faster_fifo*"]
30+
31+
[tool.cython]
32+
language_level = 3
33+
34+
[tool.cibuildwheel]
35+
# Skip CPython 3.6, CPython 3.7, and CPython 3.8
36+
# Also skip PyPy on all Python versions because of setuptools bug
37+
skip = ["cp36-*", "cp37-*", "cp38-*", "pp*"]

setup.py

+2-43
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,3 @@
1-
import setuptools
2-
from Cython.Build import cythonize
3-
from setuptools import setup, Extension
1+
from setuptools import setup
42

5-
6-
extensions = [
7-
Extension(
8-
name='faster_fifo',
9-
sources=['faster_fifo.pyx', 'cpp_faster_fifo/cpp_lib/faster_fifo.cpp'],
10-
language='c++',
11-
extra_compile_args=['-std=c++11'],
12-
include_dirs=['cpp_faster_fifo/cpp_lib'],
13-
),
14-
]
15-
16-
with open('README.md', 'r') as fh:
17-
long_description = fh.read()
18-
19-
setup(
20-
# Information
21-
name='faster-fifo',
22-
version='1.4.7',
23-
url='https://github.com/alex-petrenko/faster-fifo',
24-
author='Aleksei Petrenko & Tushar Kumar',
25-
license='MIT',
26-
keywords='multiprocessing data structures',
27-
description='A faster alternative to Python\'s standard multiprocessing.Queue (IPC FIFO queue)',
28-
long_description=long_description,
29-
long_description_content_type='text/markdown',
30-
31-
# Build instructions
32-
ext_modules=cythonize(extensions),
33-
install_requires=[
34-
'setuptools>=45.2.0',
35-
'cython>=0.29'
36-
],
37-
extras_require={
38-
'dev': ['twine', 'numpy>=1.18.1,<2.0'],
39-
},
40-
python_requires='>=3.6',
41-
42-
packages=setuptools.find_packages(where='./', include='faster_fifo*'),
43-
# install_requires=["pip>=19.3"],
44-
)
3+
setup()

0 commit comments

Comments
 (0)