Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fetch-depth: 0
- name: Install dependencies
run: |
python -m pip install -r doc/requirements.txt
python -m pip install --group doc
- name: Build HTML
run: |
python -m sphinx -W --keep-going --color -d _build/doctrees/ doc/ _build/html/ -b html
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Build and publish to PyPI
on: [push, pull_request]
env:
UV_PYTHON_DOWNLOADS: never
jobs:
build:
name: Build distribution
Expand All @@ -8,15 +10,11 @@ jobs:
- uses: actions/checkout@v5
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3"
- name: Install "build"
run: |
python -m pip install build
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Build binary wheels and a source tarball
run: ./make_dist.sh
run: |
./make_dist.sh
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/python-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ jobs:
strategy:
matrix:
python-version:
- "3.7"
- "3.9"
- "3.13"
- "pypy-3.7"
- "pypy-3.9"
- "pypy-3.11"
runs-on: ubuntu-22.04
steps:
Expand All @@ -28,7 +28,7 @@ jobs:
- name: Install Python package
working-directory: git-repo
run: |
python -m pip install .
python -m pip install --group test .
- name: Run tests
run: |
python -m sounddevice
Expand Down
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
_sounddevice.py
*.pyc
__pycache__/
build/
dist/
.eggs/
sounddevice.egg-info/
/build/
/_build/
/dist/
/src/_sounddevice.py
/src/sounddevice.egg-info/
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "portaudio-binaries"]
path = _sounddevice_data/portaudio-binaries
path = src/_sounddevice_data/portaudio-binaries
url = https://github.com/spatialaudio/portaudio-binaries.git
10 changes: 4 additions & 6 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
version: 2
build:
os: ubuntu-22.04
os: "ubuntu-24.04"
tools:
python: "3"
jobs:
post_checkout:
- git fetch --unshallow || true
python:
install:
- method: pip
path: .
- requirements: doc/requirements.txt
install:
- pip install --upgrade pip
- pip install --group doc .
sphinx:
configuration: doc/conf.py
formats: all
3 changes: 2 additions & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ newest development version (a.k.a. "master") from Github_::
git clone --recursive https://github.com/spatialaudio/python-sounddevice.git
cd python-sounddevice
python -m pip install -e .
python sounddevice_build.py

.. _PyPI: https://pypi.org/project/sounddevice/
.. _Github: https://github.com/spatialaudio/python-sounddevice/
Expand All @@ -118,7 +119,7 @@ If you make changes to the documentation, you can locally re-create the HTML
pages using Sphinx_.
You can install it and a few other necessary packages with::

python -m pip install -r doc/requirements.txt
python -m pip install -e . --group doc

To (re-)build the HTML files, use::

Expand Down
10 changes: 4 additions & 6 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
include LICENSE
include *.rst
include doc/requirements.txt
include sounddevice_build.py
recursive-include doc *.rst *.py
recursive-include examples *.py
prune .github
exclude .git*
exclude .readthedocs.yml
exclude src/_sounddevice_data/README
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
from subprocess import check_output

sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath('../src'))
sys.path.insert(0, os.path.abspath('.'))

# Fake import to avoid actually loading CFFI and the PortAudio library
Expand Down
2 changes: 0 additions & 2 deletions doc/requirements.txt

This file was deleted.

10 changes: 5 additions & 5 deletions make_dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ set -euo pipefail

# Create a source distribution and platform-specific wheel distributions.

PYTHON=python3
PYTHON="uv run --locked --with build python"

make_wheel()
{
# This makes sure that only the appropriate libraries are copied:
rm -rf sounddevice.egg-info/

PYTHON_SOUNDDEVICE_PLATFORM=$1 PYTHON_SOUNDDEVICE_ARCHITECTURE=${2:-} \
$PYTHON -m build
}
Expand All @@ -19,8 +22,5 @@ make_wheel Windows 32bit

make_wheel Windows 64bit

# This makes sure that the libraries are not copied to the final sdist:
rm -rf sounddevice.egg-info/

# This creates a "pure" wheel:
# This creates a "pure" wheel and an sdist without libraries:
make_wheel Linux
38 changes: 37 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
[build-system]
requires = ["setuptools >= 61.0"]
requires = ["setuptools", "setuptools-scm", "cffi"]
build-backend = "setuptools.build_meta"

[project]
name = "sounddevice"
license = "MIT"
dynamic = ["version"]
description = "Play and Record Sound with Python"
readme = "README.rst"
keywords = ["sound", "audio", "PortAudio", "play", "record", "playrec"]
authors = [{ name = "Matthias Geier", email = "[email protected]" }]
classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Topic :: Multimedia :: Sound/Audio",
]
requires-python = ">=3.7"
dependencies = ["cffi"]

[project.optional-dependencies]
numpy = ["numpy"]

[dependency-groups]
dev = [{ include-group = "test" }, { include-group = "doc" }]
test = []
doc = [
"insipid-sphinx-theme",
"sphinx-last-updated-by-git",
]

[project.urls]
Documentation = "https://python-sounddevice.readthedocs.io/"
Repository = "https://github.com/spatialaudio/python-sounddevice/"
Issues = "https://github.com/spatialaudio/python-sounddevice/issues"

[tool.setuptools.dynamic]
version = { attr = "sounddevice.__version__" }
34 changes: 2 additions & 32 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
import platform
from setuptools import setup

# "import" __version__
__version__ = 'unknown'
for line in open('sounddevice.py'):
if line.startswith('__version__'):
exec(line)
break

MACOSX_VERSIONS = '.'.join([
'macosx_10_6_x86_64', # for compatibility with pip < v21
'macosx_10_6_universal2',
Expand All @@ -27,7 +20,7 @@
else:
libname = None

if libname and os.path.isdir('_sounddevice_data/portaudio-binaries'):
if libname:
packages = ['_sounddevice_data']
package_data = {'_sounddevice_data': ['portaudio-binaries/' + libname,
'portaudio-binaries/README.md']}
Expand Down Expand Up @@ -63,34 +56,11 @@ def get_tag(self):
cmdclass = {'bdist_wheel': bdist_wheel_half_pure}

setup(
name='sounddevice',
version=__version__,
package_dir = {'': 'src'},
py_modules=['sounddevice'],
packages=packages,
package_data=package_data,
zip_safe=zip_safe,
python_requires='>=3.7',
setup_requires=['CFFI>=1.0'],
install_requires=['CFFI>=1.0'],
extras_require={'NumPy': ['NumPy']},
cffi_modules=['sounddevice_build.py:ffibuilder'],
author='Matthias Geier',
author_email='[email protected]',
description='Play and Record Sound with Python',
long_description=open('README.rst').read(),
license='MIT',
keywords='sound audio PortAudio play record playrec'.split(),
url='http://python-sounddevice.readthedocs.io/',
project_urls={
'Source': 'https://github.com/spatialaudio/python-sounddevice',
},
platforms='any',
classifiers=[
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Multimedia :: Sound/Audio',
],
cmdclass=cmdclass,
)
2 changes: 1 addition & 1 deletion sounddevice_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,4 +316,4 @@
""")

if __name__ == '__main__':
ffibuilder.compile(verbose=True)
ffibuilder.compile(tmpdir='src', verbose=True)
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading