diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..11a0da8f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,79 @@ +[build-system] +build-backend = "setuptools.build_meta" +requires = [ "setuptools>=61.2" ] + +[project] +name = "speechrecognition" +description = "Library for performing speech recognition, with support for several engines and APIs, online and offline." +readme.content-type = "text/x-rst" +readme.file = "README.rst" +keywords = [ + "api", + "bing", + "google", + "houndify", + "ibm", + "recognition", + "snowboy", + "speech", + "sphinx", + "voice", + "wit", +] +license = { text = "BSD" } +authors = [ { name = "Anthony Zhang (Uberi)", email = "azhang9@gmail.com" } ] +requires-python = ">=3.9" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Natural Language :: English", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Operating System :: Other OS", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "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", + "Topic :: Multimedia :: Sound/Audio :: Speech", + "Topic :: Software Development :: Libraries :: Python Modules", +] +dynamic = [ "version" ] +dependencies = [ + "standard-aifc; python_version>='3.13'", + "typing-extensions", +] + +optional-dependencies.assemblyai = [ "requests" ] +optional-dependencies.audio = [ "pyaudio>=0.2.11" ] +optional-dependencies.dev = [ + "flake8", + "pytest", + "pytest-randomly", + "respx", + "rstcheck", +] +optional-dependencies.groq = [ + "groq", + "httpx<0.28", +] +optional-dependencies.openai = [ + "httpx<0.28", + "openai", +] +optional-dependencies.pocketsphinx = [ "pocketsphinx<5" ] +optional-dependencies.whisper-local = [ + "openai-whisper", + "soundfile", +] +urls.Homepage = "https://github.com/Uberi/speech_recognition#readme" + +[tool.setuptools] +dynamic.version = { attr = "speech_recognition.__init__.__version__" } +include-package-data = true +packages.find.exclude = [ "tests.*" ] +packages.find.namespaces = false diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 8de63858..00000000 --- a/setup.cfg +++ /dev/null @@ -1,22 +0,0 @@ -[options.extras_require] -dev = - flake8 - rstcheck - pytest - pytest-randomly - respx -audio = - PyAudio >= 0.2.11 -pocketsphinx = - pocketsphinx < 5 -whisper-local = - openai-whisper - soundfile -openai = - openai - httpx < 0.28 -groq = - groq - httpx < 0.28 -assemblyai = - requests diff --git a/setup.py b/setup.py deleted file mode 100644 index efd463ea..00000000 --- a/setup.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python3 - -import logging -import os -import stat - -from setuptools import find_packages, setup -from setuptools.command.install import install - -import speech_recognition - -logger = logging.getLogger("SpeechRecognition.setup") - -FILES_TO_MARK_EXECUTABLE = ["flac-linux-x86", "flac-linux-x86_64", "flac-mac", "flac-win32.exe"] - - -class InstallWithExtraSteps(install): - def run(self): - install.run(self) # do the original install steps - - # mark the FLAC executables as executable by all users (this fixes occasional issues when file permissions get messed up) - for output_path in self.get_outputs(): - if os.path.basename(output_path) in FILES_TO_MARK_EXECUTABLE: - logger.info("setting executable permissions on %s", output_path) - stat_info = os.stat(output_path) - OWNER_CAN_READ_EXECUTE = stat.S_IRUSR | stat.S_IXUSR - GROUP_CAN_READ_EXECUTE = stat.S_IRGRP | stat.S_IXGRP - OTHERS_CAN_READ_EXECUTE = stat.S_IROTH | stat.S_IXOTH - os.chmod( - output_path, - stat_info.st_mode - | OWNER_CAN_READ_EXECUTE - | GROUP_CAN_READ_EXECUTE - | OTHERS_CAN_READ_EXECUTE, - ) - - -setup( - name="SpeechRecognition", - version=speech_recognition.__version__, - packages=find_packages(exclude=["tests.*", "test"]), - include_package_data=True, - cmdclass={"install": InstallWithExtraSteps}, - - # PyPI metadata - author=speech_recognition.__author__, - author_email="azhang9@gmail.com", - description=speech_recognition.__doc__, - long_description=open("README.rst").read(), - long_description_content_type="text/x-rst", - license=speech_recognition.__license__, - keywords="speech recognition voice sphinx google wit bing api houndify ibm snowboy", - url="https://github.com/Uberi/speech_recognition#readme", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "Natural Language :: English", - "License :: OSI Approved :: BSD License", - "Operating System :: Microsoft :: Windows", - "Operating System :: POSIX :: Linux", - "Operating System :: MacOS :: MacOS X", - "Operating System :: Other OS", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Topic :: Software Development :: Libraries :: Python Modules", - "Topic :: Multimedia :: Sound/Audio :: Speech", - ], - python_requires=">=3.9", - install_requires=[ - "typing-extensions", - "standard-aifc; python_version>='3.13'", - "audioop-lts; python_version>='3.13'", - ], -)