Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d86f379
chore: move examples to dedicated directory
mttbernardini Aug 6, 2025
807c36d
chore: move unit tests to conventional directory
mttbernardini Aug 6, 2025
aea0fc6
chore: modernise packaging.
mttbernardini Aug 6, 2025
2e0f952
fix: include doc/ and examples/ in sdist
mttbernardini Aug 6, 2025
1670c6b
fix: add `ALSAAudioError` to type stubs
mttbernardini Aug 6, 2025
be7e203
chore(deps): add `pyright` for type-checking
mttbernardini Aug 6, 2025
177d9e1
fix: missing `self` in type stubs
mttbernardini Aug 6, 2025
2b090f0
fix: use `Final` for enum constants
mttbernardini Aug 6, 2025
b3730bc
chore(deps): add `mypy` (for `stubtest` utility)
mttbernardini Aug 6, 2025
a9cb7d8
fix: stub consistency to runtime
mttbernardini Aug 6, 2025
fb17a4e
fix(docs): add `sphinx` dep, fix version retrieval
mttbernardini Aug 6, 2025
0aa35bc
fix: `PCM` constructor stubs not coherent with runtime
mttbernardini Aug 6, 2025
39846bf
chore: make `pyright` happy on tests
mttbernardini Aug 6, 2025
4c75488
ci: workflow to automate releases on tags
mttbernardini Aug 24, 2025
b4e2ea4
chore: top-level makefile for common dev tasks
mttbernardini Aug 24, 2025
8c693f4
chore: stub workflow for automatic docs deployment
mttbernardini Aug 24, 2025
68203e9
ci: ensure alsa headers are installed
mttbernardini Sep 2, 2025
a3db924
ci: enforce `setuptools` version
mttbernardini Sep 3, 2025
1dfbc37
ci: use legacy `license` definition to allow building on py3.9
mttbernardini Sep 3, 2025
06e67cc
ci: auto-detect package manager to use
mttbernardini Sep 3, 2025
112885e
ci: remove unsupported setting
mttbernardini Sep 3, 2025
c89faf5
chore: split dependency groups
mttbernardini Sep 3, 2025
5e29c0d
ci: automatically build docs
mttbernardini Sep 3, 2025
06a8137
ci: install `uv`
mttbernardini Sep 3, 2025
e5f4008
ci: install ALSA headers
mttbernardini Sep 3, 2025
3889f27
ci: fix permissions
mttbernardini Sep 3, 2025
f0d9d2a
ci: deploy on tags only
mttbernardini Sep 3, 2025
04d6f8c
fix: drop py2 trove classifier
mttbernardini Sep 3, 2025
daf38e3
chore: use makefile for reference on building sdist and wheels
mttbernardini Sep 3, 2025
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
40 changes: 40 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
on:
workflow_dispatch:
push:
branches:
- main

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Install ALSA headers
run: sudo apt-get install libasound2-dev
- name: Build HTML documentation
run: make -C doc html
- name: Upload artifacts
uses: actions/upload-pages-artifact@v4
with:
path: doc/html

deploy:
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Adapted from: https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml

on:
workflow_dispatch:
push:
tags: "*"

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-24.04
- ubuntu-24.04-arm
steps:
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Build wheels
run: make build_wheels
- 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@v5
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Build sdist
run: make build_sdist
- 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
steps:
- uses: actions/download-artifact@v5
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
# TODO: delete below once workflow is proved functional
with:
repository-url: https://test.pypi.org/legacy/
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ doc/_build/
gh-pages/
build/
dist/
wheelhouse/
.vscode/
/__pycache__/
/pyalsaaudio.egg-info/
*.egg-info/
*.raw
8 changes: 2 additions & 6 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
include *.py
include *.pyi
include CHANGES
include TODO
include LICENSE
recursive-include doc *.html *.gif *.png *.css *.py *.rst *.js *.json Makefile
graft doc/
graft examples/
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.PHONY: lint test build_wheels build_sdist build

lint:
uv run --group lint pyright; \
uv run --group lint stubtest alsaaudio

test:
uv run tests/test.py

build_wheels:
uvx cibuildwheel==3.1.4

build_sdist:
uv build --sdist

build: build_sdist build_wheels
135 changes: 0 additions & 135 deletions alsaaudio.pyi

This file was deleted.

22 changes: 22 additions & 0 deletions ci/setup_cibuildwheel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

# NOTE: ensure to use the correct package manager depending on the manylinux
# image used.

if which yum; then
yum install -y alsa-lib-devel
exit
fi

if which apk; then
apk add alsa-lib-dev
exit
fi

if which apt-get; then
apt-get install -y libasound2-dev
exit
fi

echo "Cannot install ALSA headers! No package manager detected"
exit 1
8 changes: 1 addition & 7 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXBUILD = uv run --group doc sphinx-build
PAPER =

# Internal variables.
Expand Down Expand Up @@ -70,9 +70,3 @@ linkcheck:
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in linkcheck/output.txt."

gh-pages: html
cd gh-pages; git pull --rebase; cd ..; cp -r ./html/* gh-pages

publish: gh-pages
cd gh-pages; git commit -a; git push; cd ..
5 changes: 2 additions & 3 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
# import sys
# sys.path.insert(0, os.path.abspath('.'))

import sys
sys.path.insert(0, '..')
from setup import pyalsa_version
from importlib.metadata import version
pyalsa_version = version("pyalsaaudio")


# -- General configuration ------------------------------------------------
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
70 changes: 70 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
[project]
name = "pyalsaaudio"
version = "0.11.0"
description = "ALSA bindings"
readme.text = """
This package contains wrappers for accessing the ALSA API from Python.
It is fairly complete for PCM devices and Mixer access.
"""
readme.content-type = "text/plain"

license.file = "LICENSE"

# NOTE: license as a table has been deprecated by PEP-639, however support in
# setuptools has been introduced in v77.0 which is not installable on Python
# 3.9. Since this project doesn't constraint the minimum python version, we have
# to stick to the legacy `license` definition for now.

# license="PSF-2.0"
# license-files=["LICENSE"]

classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Topic :: Multimedia :: Sound/Audio",
"Topic :: Multimedia :: Sound/Audio :: Mixers",
"Topic :: Multimedia :: Sound/Audio :: Players",
"Topic :: Multimedia :: Sound/Audio :: Capture/Recording",
]

[[project.authors]]
name = "Casper Wilstrup"
email = "[email protected]"

[[project.maintainers]]
name = "Lars Immisch"
email = "[email protected]"

[project.urls]
homepage = "http://larsimmisch.github.io/pyalsaaudio/"
source = "https://github.com/larsimmisch/pyalsaaudio"
documentation = "https://larsimmisch.github.io/pyalsaaudio/"
issues = "https://github.com/larsimmisch/pyalsaaudio/issues"


[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"


[tool.setuptools]
ext-modules = [
{ name = "alsaaudio", sources = ["src/alsaaudio.c"], libraries = ["asound"] }
]


[tool.cibuildwheel]
build-frontend = "build[uv]"
before-all = "ci/setup_cibuildwheel.sh"


[dependency-groups]
lint = [
"mypy>=1.17.1",
"pyright>=1.1.403",
]
doc = [
"sphinx>=8.1.3",
]
Loading