-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
5 changed files
with
111 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
directory: / | ||
schedule: | ||
interval: weekly |
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,67 @@ | ||
name: Build and upload to PyPI | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
build_wheels: | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
# macos-13 is an intel runner, macos-14 is apple silicon | ||
os: [ubuntu-latest, macos-13, macos-14] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | ||
path: ./wheelhouse/*.whl | ||
|
||
build_sdist: | ||
name: Build source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build sdist | ||
run: pipx run build --sdist | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cibw-sdist | ||
path: dist/*.tar.gz | ||
|
||
upload_pypi: | ||
needs: [build_wheels, build_sdist] | ||
runs-on: ubuntu-latest | ||
environment: pypi | ||
permissions: | ||
id-token: write | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
steps: | ||
- name: Download artifacts from other jobs | ||
uses: actions/download-artifact@v4 | ||
with: | ||
# unpacks all CIBW artifacts into dist/ | ||
pattern: cibw-* | ||
path: dist | ||
merge-multiple: true | ||
|
||
- name: Publish to Pypi | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ |
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 |
---|---|---|
@@ -1,3 +1,37 @@ | ||
[build-system] | ||
requires = ["setuptools", "wheel", "Cython"] | ||
requires = ["setuptools>=75.6.0", "wheel", "cython>=0.29"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "faster-fifo" | ||
version = "1.5.0" | ||
description = "A faster alternative to Python's standard multiprocessing.Queue (IPC FIFO queue)" | ||
readme = {file = "README.md", content-type = "text/markdown"} | ||
requires-python = ">=3.9" | ||
license = {text = "MIT"} | ||
authors = [ | ||
{name = "Aleksei Petrenko"}, | ||
{name = "Tushar Kumar"} | ||
] | ||
keywords = ["multiprocessing", "data structures"] | ||
urls = { homepage = "https://github.com/alex-petrenko/faster-fifo" } | ||
|
||
[project.optional-dependencies] | ||
dev = ["twine", "numpy>=1.18.1,<2.0"] | ||
|
||
[tool.setuptools] | ||
ext-modules = [ | ||
{ 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']} | ||
] | ||
|
||
[tool.setuptools.packages.find] | ||
where = ["./"] | ||
include = ["faster_fifo*"] | ||
|
||
[tool.cython] | ||
language_level = 3 | ||
|
||
[tool.cibuildwheel] | ||
# Skip CPython 3.6, CPython 3.7, and CPython 3.8 | ||
# Also skip PyPy on all Python versions because of setuptools bug | ||
skip = ["cp36-*", "cp37-*", "cp38-*", "pp*"] |
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,44 +1,3 @@ | ||
import setuptools | ||
from Cython.Build import cythonize | ||
from setuptools import setup, Extension | ||
from setuptools import setup | ||
|
||
|
||
extensions = [ | ||
Extension( | ||
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'], | ||
), | ||
] | ||
|
||
with open('README.md', 'r') as fh: | ||
long_description = fh.read() | ||
|
||
setup( | ||
# Information | ||
name='faster-fifo', | ||
version='1.4.7', | ||
url='https://github.com/alex-petrenko/faster-fifo', | ||
author='Aleksei Petrenko & Tushar Kumar', | ||
license='MIT', | ||
keywords='multiprocessing data structures', | ||
description='A faster alternative to Python\'s standard multiprocessing.Queue (IPC FIFO queue)', | ||
long_description=long_description, | ||
long_description_content_type='text/markdown', | ||
|
||
# Build instructions | ||
ext_modules=cythonize(extensions), | ||
install_requires=[ | ||
'setuptools>=45.2.0', | ||
'cython>=0.29' | ||
], | ||
extras_require={ | ||
'dev': ['twine', 'numpy>=1.18.1,<2.0'], | ||
}, | ||
python_requires='>=3.6', | ||
|
||
packages=setuptools.find_packages(where='./', include='faster_fifo*'), | ||
# install_requires=["pip>=19.3"], | ||
) | ||
setup() |