chore: modernise packaging.

- use pyproject.toml to define project metadata and setuptools-specific configuration, removing the need for a setup.py file
- move sources in conventional src/ directory
- rework stubs so that they're visible downstream. PEP-561 doesn't support top-level .pyi files, so I made a dummy package instead `alsaaudio-stubs`
This commit is contained in:
Matteo Bernardini
2025-08-06 13:05:52 +08:00
parent 807c36d133
commit aea0fc62e8
7 changed files with 56 additions and 49 deletions

2
.gitignore vendored
View File

@@ -10,5 +10,5 @@ build/
dist/
.vscode/
/__pycache__/
/pyalsaaudio.egg-info/
*.egg-info/
*.raw

View File

@@ -1,6 +0,0 @@
include *.py
include *.pyi
include CHANGES
include TODO
include LICENSE
recursive-include doc *.html *.gif *.png *.css *.py *.rst *.js *.json Makefile

47
pyproject.toml Normal file
View File

@@ -0,0 +1,47 @@
[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="PSF-2.0"
license-files=["LICENSE"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 2",
"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 = "cwi@aves.dk"
[[project.maintainers]]
name = "Lars Immisch"
email = "lars@ibp.de"
[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"] }
]

View File

@@ -1,40 +0,0 @@
#!/usr/bin/env python
'''This package contains wrappers for accessing the ALSA API from Python.
It is fairly complete for PCM devices and Mixer access.
'''
from setuptools import setup
from setuptools.extension import Extension
from sys import version
pyalsa_version = '0.11.0'
if __name__ == '__main__':
setup(
name = 'pyalsaaudio',
version = pyalsa_version,
description = 'ALSA bindings',
long_description = __doc__,
author = 'Casper Wilstrup',
author_email='cwi@aves.dk',
maintainer = 'Lars Immisch',
maintainer_email = 'lars@ibp.de',
license='PSF',
platforms=['posix'],
url='http://larsimmisch.github.io/pyalsaaudio/',
classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: Python Software Foundation License',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Topic :: Multimedia :: Sound/Audio',
'Topic :: Multimedia :: Sound/Audio :: Mixers',
'Topic :: Multimedia :: Sound/Audio :: Players',
'Topic :: Multimedia :: Sound/Audio :: Capture/Recording',
],
ext_modules=[Extension('alsaaudio',['alsaaudio.c'],
libraries=['asound'])]
)

View File

@@ -1,5 +1,3 @@
from typing import list
PCM_PLAYBACK: int
PCM_CAPTURE: int

8
uv.lock generated Normal file
View File

@@ -0,0 +1,8 @@
version = 1
revision = 2
requires-python = ">=3.10"
[[package]]
name = "pyalsaaudio"
version = "0.11.0"
source = { editable = "." }