Skip to content

Commit a59f6ee

Browse files
committed
Transition to pyproject.toml
1 parent 147f8f5 commit a59f6ee

File tree

11 files changed

+100
-65
lines changed

11 files changed

+100
-65
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ jobs:
1717
runs-on: ubuntu-latest
1818
strategy:
1919
matrix:
20-
python_version: ["3.8", "3.9", "3.10", "3.11"]
20+
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
2121
steps:
2222
- uses: actions/checkout@v4.1.1
2323
- uses: actions/setup-python@v5
2424
with:
2525
python-version: "${{ matrix.python_version }}"
2626
cache: "pip"
27-
cache-dependency-path: requirements_dev.txt
27+
cache-dependency-path: pyproject.toml
2828
- run: script/setup --dev
2929
- run: script/lint
3030
- run: script/test

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Changelog
22

3-
## 1.7.0
3+
## 1.6.1
44

5+
- Migrate to pyproject.toml
56
- Add `language` to `transcript`
67

78
## 1.6.0

pyproject.toml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
[project]
2+
name = "wyoming"
3+
version = "1.6.1"
4+
description = "Peer-to-peer protocol for voice assistants"
5+
readme = "README.md"
6+
requires-python = ">=3.8.1,<3.13"
7+
license = {text = "MIT"}
8+
authors = [
9+
{name = "Michael Hansen", email = "mike@rhasspy.org"}
10+
]
11+
keywords = ["voice", "assistant", "protocol"]
12+
classifiers = [
13+
"Development Status :: 3 - Alpha",
14+
"Intended Audience :: Developers",
15+
"Topic :: Text Processing :: Linguistic",
16+
"Programming Language :: Python :: 3.8",
17+
"Programming Language :: Python :: 3.9",
18+
"Programming Language :: Python :: 3.10",
19+
"Programming Language :: Python :: 3.11",
20+
"Programming Language :: Python :: 3.12",
21+
]
22+
23+
[project.urls]
24+
Homepage = "http://github.com/OHF-voice/wyoming"
25+
26+
[tool.setuptools.packages.find]
27+
include = ["wyoming", "wyoming.*"]
28+
exclude = ["tests", "tests.*"]
29+
30+
[build-system]
31+
requires = ["setuptools>=42", "wheel"]
32+
build-backend = "setuptools.build_meta"
33+
34+
[tool.black]
35+
line-length = 88
36+
37+
[tool.isort]
38+
profile = "black"
39+
40+
[tool.pytest.ini_options]
41+
asyncio_mode = "auto"
42+
43+
[tool.mypy]
44+
check_untyped_defs = true
45+
disallow_untyped_defs = true
46+
47+
[project.optional-dependencies]
48+
dev = [
49+
"black==22.12.0",
50+
"flake8==6.0.0",
51+
"isort==5.11.3",
52+
"mypy==0.991",
53+
"pylint==2.15.9",
54+
"pytest==7.4.4",
55+
"pytest-asyncio==0.23.3",
56+
"build==1.2.2.post1",
57+
]
58+
zeroconf = [
59+
"zeroconf==0.88.0"
60+
]
61+
http = [
62+
"Flask==3.0.2",
63+
"swagger-ui-py==23.9.23",
64+
]

requirements_dev.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

script/package

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ _VENV_DIR = _PROGRAM_DIR / ".venv"
99

1010
context = venv.EnvBuilder().ensure_directories(_VENV_DIR)
1111
subprocess.check_call(
12-
[context.env_exe, _PROGRAM_DIR / "setup.py", "bdist_wheel", "sdist"]
12+
[context.env_exe, "-m", "build", "--wheel", "--sdist"]
1313
)

script/setup

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env python3
2+
import argparse
23
import subprocess
34
import venv
45
from pathlib import Path
@@ -7,6 +8,13 @@ _DIR = Path(__file__).parent
78
_PROGRAM_DIR = _DIR.parent
89
_VENV_DIR = _PROGRAM_DIR / ".venv"
910

11+
parser = argparse.ArgumentParser()
12+
parser.add_argument("--dev", action="store_true", help="Install dev requirements")
13+
parser.add_argument("--http", action="store_true", help="Install http requirements")
14+
parser.add_argument(
15+
"--zeroconf", action="store_true", help="Install zeroconf requirements"
16+
)
17+
args = parser.parse_args()
1018

1119
# Create virtual environment
1220
builder = venv.EnvBuilder(with_pip=True)
@@ -19,4 +27,18 @@ subprocess.check_call(pip + ["install", "--upgrade", "pip"])
1927
subprocess.check_call(pip + ["install", "--upgrade", "setuptools", "wheel"])
2028

2129
# Install requirements
22-
subprocess.check_call(pip + ["install", "-r", str(_PROGRAM_DIR / "requirements_dev.txt")])
30+
extras = []
31+
if args.dev:
32+
extras.append("dev")
33+
34+
if args.http:
35+
extras.append("http")
36+
37+
if args.zeroconf:
38+
extras.append("zeroconf")
39+
40+
extras_str = ""
41+
if extras:
42+
extras_str = "[" + ",".join(extras) + "]"
43+
44+
subprocess.check_call(pip + ["install", "-e", f"{_PROGRAM_DIR}{extras_str}"])

setup.py

Lines changed: 0 additions & 39 deletions
This file was deleted.

wyoming/VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

wyoming/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
"""The Wyoming protocol for Rhasspy."""
1+
"""Peer-to-peer protocol for voice assistants."""
22
from .version import __version__
33

4+
45
__author__ = "Michael Hansen"
56
__email__ = "mike@rhasspy.org"
67

wyoming/http/intent_server.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
"""HTTP server for intent recognition/handling."""
22

3-
import io
43
import logging
5-
import wave
64
from pathlib import Path
7-
from typing import Any, Dict, Optional
5+
from typing import Any, Dict
86

9-
from flask import Response, request
7+
from flask import request
108

119
from wyoming.asr import Transcript
1210
from wyoming.client import AsyncClient
1311
from wyoming.error import Error
14-
from wyoming.intent import Intent, NotRecognized
1512
from wyoming.handle import Handled, NotHandled
13+
from wyoming.intent import Intent, NotRecognized
1614

1715
from .shared import get_app, get_argument_parser
1816

@@ -29,7 +27,7 @@ def main():
2927
app = get_app("intent", CONF_PATH, args)
3028

3129
@app.route("/api/recognize-intent", methods=["POST", "GET"])
32-
async def api_stt() -> Response:
30+
async def api_stt() -> Dict[str, Any]:
3331
uri = request.args.get("uri", args.uri)
3432
if not uri:
3533
raise ValueError("URI is required")

0 commit comments

Comments
 (0)