Skip to content

Commit 87beb1b

Browse files
committed
Move parts of setup.py to pyproject.toml
1 parent 3adb6eb commit 87beb1b

File tree

5 files changed

+46
-43
lines changed

5 files changed

+46
-43
lines changed

.github/workflows/python-versions.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ jobs:
55
strategy:
66
matrix:
77
python-version:
8-
- "3.7"
8+
- "3.9"
99
- "3.13"
10-
- "pypy-3.7"
10+
- "pypy-3.9"
1111
- "pypy-3.11"
1212
runs-on: ubuntu-22.04
1313
steps:
@@ -28,7 +28,7 @@ jobs:
2828
- name: Install Python package
2929
working-directory: git-repo
3030
run: |
31-
python -m pip install .
31+
python -m pip install --group test .
3232
- name: Run tests
3333
run: |
3434
python -m sounddevice

.readthedocs.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ build:
66
jobs:
77
post_checkout:
88
- git fetch --unshallow || true
9-
python:
10-
install:
11-
- method: pip
12-
path: .
13-
- requirements: doc/requirements.txt
9+
install:
10+
- pip install --upgrade pip
11+
- pip install --group doc .
1412
sphinx:
1513
configuration: doc/conf.py
1614
formats: all

make_dist.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ PYTHON=python3
88

99
make_wheel()
1010
{
11+
# This makes sure that only the appropriate libraries are copied:
12+
rm -rf sounddevice.egg-info/
13+
1114
PYTHON_SOUNDDEVICE_PLATFORM=$1 PYTHON_SOUNDDEVICE_ARCHITECTURE=${2:-} \
1215
$PYTHON -m build
1316
}
@@ -19,8 +22,5 @@ make_wheel Windows 32bit
1922

2023
make_wheel Windows 64bit
2124

22-
# This makes sure that the libraries are not copied to the final sdist:
23-
rm -rf sounddevice.egg-info/
24-
2525
# This creates a "pure" wheel:
2626
make_wheel Linux

pyproject.toml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
11
[build-system]
2-
requires = ["setuptools >= 61.0"]
2+
requires = ["setuptools", "cffi"]
33
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "sounddevice"
7+
license = "MIT"
8+
dynamic = ["version"]
9+
description = "Play and Record Sound with Python"
10+
readme = "README.rst"
11+
keywords = ["sound", "audio", "PortAudio", "play", "record", "playrec"]
12+
authors = [{ name = "Matthias Geier", email = "[email protected]" }]
13+
classifiers = [
14+
"Operating System :: OS Independent",
15+
"Programming Language :: Python",
16+
"Programming Language :: Python :: 3",
17+
"Topic :: Multimedia :: Sound/Audio",
18+
]
19+
requires-python = ">=3.7"
20+
dependencies = ["cffi"]
21+
22+
[project.optional-dependencies]
23+
numpy = ["numpy"]
24+
25+
[dependency-groups]
26+
dev = [{ include-group = "test" }, { include-group = "doc" }]
27+
test = []
28+
doc = [
29+
"insipid-sphinx-theme",
30+
"sphinx-last-updated-by-git",
31+
]
32+
33+
[project.urls]
34+
Documentation = "https://python-sounddevice.readthedocs.io/"
35+
Repository = "https://github.com/spatialaudio/python-sounddevice/"
36+
Issues = "https://github.com/spatialaudio/python-sounddevice/issues"
37+
38+
[tool.setuptools.dynamic]
39+
version = { attr = "sounddevice.__version__" }

setup.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22
import platform
33
from setuptools import setup
44

5-
# "import" __version__
6-
__version__ = 'unknown'
7-
for line in open('sounddevice.py'):
8-
if line.startswith('__version__'):
9-
exec(line)
10-
break
11-
125
MACOSX_VERSIONS = '.'.join([
136
'macosx_10_6_x86_64', # for compatibility with pip < v21
147
'macosx_10_6_universal2',
@@ -63,34 +56,10 @@ def get_tag(self):
6356
cmdclass = {'bdist_wheel': bdist_wheel_half_pure}
6457

6558
setup(
66-
name='sounddevice',
67-
version=__version__,
6859
py_modules=['sounddevice'],
6960
packages=packages,
7061
package_data=package_data,
7162
zip_safe=zip_safe,
72-
python_requires='>=3.7',
73-
setup_requires=['CFFI>=1.0'],
74-
install_requires=['CFFI>=1.0'],
75-
extras_require={'NumPy': ['NumPy']},
7663
cffi_modules=['sounddevice_build.py:ffibuilder'],
77-
author='Matthias Geier',
78-
author_email='[email protected]',
79-
description='Play and Record Sound with Python',
80-
long_description=open('README.rst').read(),
81-
license='MIT',
82-
keywords='sound audio PortAudio play record playrec'.split(),
83-
url='http://python-sounddevice.readthedocs.io/',
84-
project_urls={
85-
'Source': 'https://github.com/spatialaudio/python-sounddevice',
86-
},
87-
platforms='any',
88-
classifiers=[
89-
'License :: OSI Approved :: MIT License',
90-
'Operating System :: OS Independent',
91-
'Programming Language :: Python',
92-
'Programming Language :: Python :: 3',
93-
'Topic :: Multimedia :: Sound/Audio',
94-
],
9564
cmdclass=cmdclass,
9665
)

0 commit comments

Comments
 (0)