From 2c72ad0e012751a3dad599b4288363fae25ffe35 Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Fri, 24 Jan 2025 09:28:51 -0600 Subject: [PATCH] Migrate to pyproject.toml --- pyproject.toml | 50 +++++++++++++++++++++++ requirements.txt | 3 -- requirements_audio_enhancement.txt | 1 - requirements_dev.txt | 1 + requirements_vad.txt | 1 - script/package | 2 +- script/setup | 5 +-- setup.py | 64 ------------------------------ tox.ini | 2 +- wyoming_satellite/VERSION | 1 - wyoming_satellite/__init__.py | 4 +- 11 files changed, 58 insertions(+), 76 deletions(-) create mode 100644 pyproject.toml delete mode 100644 requirements.txt delete mode 100644 requirements_audio_enhancement.txt delete mode 100644 requirements_vad.txt delete mode 100644 setup.py delete mode 100644 wyoming_satellite/VERSION diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..8024772 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,50 @@ +[build-system] +requires = ["setuptools>=62.3"] +build-backend = "setuptools.build_meta" + +[project] +name = "wyoming_satellite" +version = "1.3.1" +license = {text = "MIT"} +description = "Wyoming server for remote voice satellite" +readme = "README.md" +authors = [ + {name = "Michael Hansen", email = "mike@rhasspy.org"} +] +keywords = ["rhasspy", "wyoming", "satellite"] +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", +] +requires-python = ">=3.9.0" +dependencies = [ + "wyoming==1.5.4", + "zeroconf==0.88.0", + "pyring-buffer>=1,<2", +] + +[project.optional-dependencies] +all = ["pysilero-vad==1.0.0", "webrtc-noise-gain==1.2.3"] +silerovad = ["pysilero-vad==1.0.0"] +webrtc = ["webrtc-noise-gain==1.2.3"] + +[project.scripts] +wyoming-satellite = "wyoming_satellite:__main__.run" + +[project.urls] +"Source Code" = "http://github.com/rhasspy/wyoming-satellite" + +[tool.setuptools] +platforms = ["any"] +zip-safe = true +include-package-data = true + +[tool.setuptools.packages.find] +include = ["wyoming_satellite"] +exclude = ["tests", "tests.*"] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index a1bbfef..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -wyoming==1.5.4 -zeroconf==0.88.0 -pyring-buffer==1.0.0 diff --git a/requirements_audio_enhancement.txt b/requirements_audio_enhancement.txt deleted file mode 100644 index b1c879a..0000000 --- a/requirements_audio_enhancement.txt +++ /dev/null @@ -1 +0,0 @@ -webrtc-noise-gain==1.2.3 diff --git a/requirements_dev.txt b/requirements_dev.txt index d77919f..758342f 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -5,3 +5,4 @@ mypy==0.991 pylint==2.15.9 pytest==7.4.3 pytest-asyncio==0.23.3 +build==1.2.2 diff --git a/requirements_vad.txt b/requirements_vad.txt deleted file mode 100644 index 1bcf838..0000000 --- a/requirements_vad.txt +++ /dev/null @@ -1 +0,0 @@ -pysilero-vad==1.0.0 diff --git a/script/package b/script/package index 1f04c1f..b124a6b 100755 --- a/script/package +++ b/script/package @@ -8,4 +8,4 @@ _PROGRAM_DIR = _DIR.parent _VENV_DIR = _PROGRAM_DIR / ".venv" context = venv.EnvBuilder().ensure_directories(_VENV_DIR) -subprocess.check_call([context.env_exe, _PROGRAM_DIR / "setup.py", "bdist_wheel"]) +subprocess.check_call([context.env_exe, "-m", "build", "--wheel", "--sdist"]) diff --git a/script/setup b/script/setup index 4928364..f55fbb8 100755 --- a/script/setup +++ b/script/setup @@ -20,7 +20,6 @@ builder.create(_VENV_DIR) # Upgrade dependencies pip = [context.env_exe, "-m", "pip"] subprocess.check_call(pip + ["install", "--upgrade", "pip"]) -subprocess.check_call(pip + ["install", "--upgrade", "setuptools", "wheel"]) # Install requirements subprocess.check_call( @@ -31,8 +30,8 @@ subprocess.check_call( "https://www.piwheels.org/simple", "-f", "https://synesthesiam.github.io/prebuilt-apps/", - "-r", - str(_PROGRAM_DIR / "requirements.txt"), + "-e", + ".", ] ) diff --git a/setup.py b/setup.py deleted file mode 100644 index 8aba9bd..0000000 --- a/setup.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python3 -from pathlib import Path -from typing import List - -import setuptools -from setuptools import setup - -this_dir = Path(__file__).parent -module_dir = this_dir / "wyoming_satellite" -version_path = module_dir / "VERSION" -version = version_path.read_text(encoding="utf-8").strip() - - -def get_requirements(req_path: Path) -> List[str]: - if not req_path.is_file(): - return [] - - requirements: List[str] = [] - with open(req_path, "r", encoding="utf-8") as req_file: - for line in req_file: - line = line.strip() - if not line: - continue - - requirements.append(line) - - return requirements - - -install_requires = get_requirements(this_dir / "requirements.txt") -extras_require = { - "silerovad": get_requirements(this_dir / "requirements_vad.txt"), - "webrtc": get_requirements(this_dir / "requirements_audio_enhancement.txt"), -} - - -# ----------------------------------------------------------------------------- - -setup( - name="wyoming_satellite", - version="1.1.0", - description="Wyoming server for remote voice satellite", - url="http://github.com/rhasspy/wyoming-satellite", - author="Michael Hansen", - author_email="mike@rhasspy.org", - packages=setuptools.find_packages(), - package_data={ - "wyoming_satellite": [str(p.relative_to(module_dir)) for p in (version_path,)] - }, - install_requires=install_requires, - classifiers=[ - "Development Status :: 3 - Alpha", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - ], - keywords="rhasspy wyoming satellite", - extras_require=extras_require, - entry_points={ - "console_scripts": ["wyoming-satellite = wyoming_satellite:__main__.run"] - }, -) diff --git a/tox.ini b/tox.ini index 80dd236..7f338b7 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] env_list = - py{39,310,311} + py{39,310,311,312,313} minversion = 4.12.1 [testenv] diff --git a/wyoming_satellite/VERSION b/wyoming_satellite/VERSION deleted file mode 100644 index f0bb29e..0000000 --- a/wyoming_satellite/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.3.0 diff --git a/wyoming_satellite/__init__.py b/wyoming_satellite/__init__.py index 45a9101..2ca5bb5 100644 --- a/wyoming_satellite/__init__.py +++ b/wyoming_satellite/__init__.py @@ -1,4 +1,6 @@ """Voice satellite using the Wyoming protocol.""" + +import importlib.metadata from pathlib import Path from .satellite import ( @@ -17,7 +19,7 @@ from .settings import ( ) _DIR = Path(__file__).parent -__version__ = (_DIR / "VERSION").read_text(encoding="utf-8").strip() +__version__ = importlib.metadata.version("wyoming-satellite") __all__ = [ "__version__",