Skip to content

Commit 50d4ea2

Browse files
authored
WIP: Add wheel builds (#16)
* ENH: Add Azure build * FIX: Set standard explicitly * FIX: Install PortAudio * ENH: Add Makefile to doc, bump version * FIX: build_sphinx and Makefile * FIX: requirements.txt * STY: Stick with python3 -m pip * MAINT: Remove v and merge * FIX: Missed one
1 parent 5d861c6 commit 50d4ea2

File tree

7 files changed

+164
-30
lines changed

7 files changed

+164
-30
lines changed

.circleci/config.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Adapted from MNE-Python (BSD 3-clause)
2+
version: 2
3+
jobs:
4+
build_docs:
5+
docker:
6+
- image: circleci/python:3.7-stretch
7+
steps:
8+
- checkout
9+
- run:
10+
name: Set BASH_ENV
11+
command: |
12+
echo "set -e" >> $BASH_ENV
13+
echo "BASH_ENV:"
14+
cat $BASH_ENV
15+
16+
- restore_cache:
17+
keys:
18+
- pip-cache
19+
20+
- run:
21+
name: Get Python running
22+
command: |
23+
pip install --user --upgrade --progress-bar off -r doc/requirements.txt
24+
25+
- save_cache:
26+
key: pip-cache
27+
paths:
28+
- ~/.cache/pip
29+
30+
# Build docs
31+
- run:
32+
name: make html
33+
command: |
34+
python setup.py build_sphinx
35+
36+
# Save the outputs
37+
- store_artifacts:
38+
path: build/sphinx/html/
39+
destination: html
40+
41+
workflows:
42+
version: 2
43+
44+
default:
45+
jobs:
46+
- build_docs

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
build
2+
doc/_build
3+
src/*.so
4+
src/*.egg-info
5+
__pycache__
6+
.eggs

README.rst

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Realtime Audio Mixer for Python
22
===============================
33

4-
**WARNING:** This is work in progress!
4+
.. warning:: This is work in progress!
55

66
Goal: Reliable low-latency audio playback and recording with Python, using
77
PortAudio_ via the sounddevice_ module.
@@ -75,22 +75,33 @@ Somewhat similar projects:
7575
* https://github.com/nvahalik/PyAudioMixer
7676
* http://www.pygame.org/docs/ref/mixer.html
7777

78-
.. _PortAudio: http://portaudio.com/
79-
.. _sounddevice: http://python-sounddevice.readthedocs.io/
80-
.. _CFFI: http://cffi.readthedocs.io/
81-
.. _soundfile: http://pysoundfile.readthedocs.io/
82-
8378
Installation
8479
------------
8580

86-
::
81+
On Windows, macOS, and Linux you can install a precompiled wheel with::
82+
83+
python3 -m pip install rtmixer
84+
85+
This will install ``rtmixer`` and its dependencies, including ``sounddevice``.
86+
87+
.. note:: On Linux, to use ``sounddevice`` and ``rtmixer`` you will need to
88+
have PortAudio installed, e.g. via ``sudo apt install libportaudio2``.
89+
On other platforms, PortAudio comes bundled with ``sounddevice``.
90+
91+
Developers can install in editable mode with some variant of::
8792

8893
git clone https://github.com/spatialaudio/python-rtmixer
8994
cd python-rtmixer
9095
git submodule update --init
91-
python3 -m pip install -e . --user
96+
python3 -m pip install -e .
9297

9398
Usage
9499
-----
95100

96-
See the examples in the `examples/` directory.
101+
See the list of `examples on GitHub`_.
102+
103+
.. _PortAudio: http://portaudio.com/
104+
.. _sounddevice: http://python-sounddevice.readthedocs.io/
105+
.. _CFFI: http://cffi.readthedocs.io/
106+
.. _soundfile: http://pysoundfile.readthedocs.io/
107+
.. _examples on GitHub: https://github.com/spatialaudio/python-rtmixer/tree/master/examples

azure-pipelines.yml

Lines changed: 82 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,83 @@
1-
# Starter pipeline
2-
# Start with a minimal pipeline that you can customize to build and deploy your code.
3-
# Add steps that build, run tests, deploy, and more:
4-
# https://aka.ms/yaml
5-
1+
# Originally adapted from github.com/vispy/vispy (BSD 3-clause)
62
trigger:
7-
- master
8-
9-
pool:
10-
vmImage: 'ubuntu-latest'
11-
12-
steps:
13-
- script: echo Hello, world!
14-
displayName: 'Run a one-line script'
15-
16-
- script: |
17-
echo Add other tasks to build, test, and deploy your project.
18-
echo See https://aka.ms/yaml
19-
displayName: 'Run a multi-line script'
3+
branches:
4+
include:
5+
- '*'
6+
tags:
7+
include:
8+
- '*'
9+
variables:
10+
CIBW_BUILDING: "true"
11+
CIBW_SKIP: "cp27-* cp34-*"
12+
CIBW_TEST_COMMAND: "python -c \"import rtmixer; print(rtmixer.__version__)\""
13+
CIBW_BUILD_VERBOSITY: "2"
14+
CIBW_BEFORE_BUILD: "pip install -U pip setuptools"
15+
CIBW_BEFORE_BUILD_LINUX: "yum install -y portaudio"
16+
jobs:
17+
- job: linux
18+
pool: {vmImage: 'Ubuntu-16.04'}
19+
steps:
20+
- task: UsePythonVersion@0
21+
- bash: |
22+
git submodule update --init --recursive
23+
python -m pip install --upgrade pip
24+
pip install cibuildwheel twine numpy Cython jupyter ipywidgets
25+
python setup.py sdist -d wheelhouse
26+
cibuildwheel --output-dir wheelhouse .
27+
- task: PublishPipelineArtifact@1
28+
inputs:
29+
path: $(System.DefaultWorkingDirectory)/wheelhouse
30+
artifact: deployLinux
31+
- job: macos
32+
pool: {vmImage: 'macOS-10.13'}
33+
steps:
34+
- task: UsePythonVersion@0
35+
- bash: |
36+
git submodule update --init --recursive
37+
python -m pip install --upgrade pip
38+
pip install cibuildwheel
39+
cibuildwheel --output-dir wheelhouse .
40+
- task: PublishPipelineArtifact@1
41+
inputs:
42+
path: $(System.DefaultWorkingDirectory)/wheelhouse
43+
artifact: deployMacOS
44+
- job: windows
45+
pool: {vmImage: 'vs2017-win2016'}
46+
steps:
47+
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.5', architecture: x86}}
48+
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.5', architecture: x64}}
49+
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.6', architecture: x86}}
50+
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.6', architecture: x64}}
51+
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.7', architecture: x86}}
52+
- {task: UsePythonVersion@0, inputs: {versionSpec: '3.7', architecture: x64}}
53+
- bash: |
54+
git submodule update --init --recursive
55+
python -m pip install --upgrade pip
56+
pip install cibuildwheel
57+
cibuildwheel --output-dir wheelhouse .
58+
- task: PublishPipelineArtifact@1
59+
inputs:
60+
path: $(System.DefaultWorkingDirectory)/wheelhouse
61+
artifact: deployWindows
62+
- job: deployPyPI
63+
pool: {vmImage: 'Ubuntu-16.04'}
64+
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
65+
dependsOn:
66+
- linux
67+
- macos
68+
- windows
69+
steps:
70+
- task: UsePythonVersion@0
71+
- task: DownloadPipelineArtifact@2
72+
inputs:
73+
patterns: |
74+
deployLinux/*
75+
deployMacOS/*.whl
76+
deployWindows/*.whl
77+
- bash: |
78+
cd $(Pipeline.Workspace)
79+
python -m pip install --upgrade pip
80+
pip install twine
81+
twine upload -u "__token__" --skip-existing deployLinux/* deployMacOS/* deployWindows/*
82+
env:
83+
TWINE_PASSWORD: $(pypiToken)

doc/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
pa-ringbuffer
2+
sphinx_rtd_theme
3+
sphinx

rtmixer_build.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,14 @@
2020
RINGBUFFER_CDEF + open('src/rtmixer.c').read(),
2121
include_dirs=['src', 'portaudio/include'],
2222
sources=['portaudio/src/common/pa_ringbuffer.c'],
23-
#extra_compile_args=['-Wconversion'],
23+
extra_compile_args=[
24+
'--std=c99',
25+
# '-Wconversion',
26+
],
2427
# TODO: release mode by default, option for using debug mode
25-
undef_macros=['NDEBUG'],
28+
undef_macros=[
29+
# 'NDEBUG'
30+
],
2631
)
2732

2833
if __name__ == '__main__':

src/rtmixer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
http://python-rtmixer.readthedocs.io/
44
55
"""
6-
__version__ = '0.0.0'
6+
__version__ = '0.1.0'
77

88
import sounddevice as _sd
99
from pa_ringbuffer import init as _init_ringbuffer

0 commit comments

Comments
 (0)