VOOZH about

URL: https://deepwiki.com/Uberi/speech_recognition/6.2-building-and-deployment

⇱ Building and Deployment | Uberi/speech_recognition | DeepWiki


Loading...
Menu

Building and Deployment

This document describes the build process, dependency management, and release workflow for the SpeechRecognition library. It covers how the library is packaged, built, and deployed to PyPI, as well as how dependencies are managed across different environments.

Package Structure

The SpeechRecognition library uses a standard Python package structure with some special considerations for the inclusion of binary executables (FLAC converters) that require specific handling during installation.


Sources: setup.py1-78 MANIFEST.in1-7

The package includes platform-specific FLAC executables that need special handling during installation. These executables are included in the repository and distributed with the package:

  • flac-linux-x86
  • flac-linux-x86_64
  • flac-mac
  • flac-win32.exe

Build Configuration

The build configuration is defined in setup.py, which uses setuptools to manage the build process. The setup script contains metadata about the package and defines how it should be built and installed.

Package Metadata


Sources: setup.py38-53

Dependencies Management

The SpeechRecognition library has minimal direct dependencies, as defined in the setup.py file:

DependencyRequirementPurpose
typing-extensionsAlwaysType hinting support
standard-aifcPython 3.13+Audio file format support for newer Python versions
audioop-ltsPython 3.13+Audio operations for newer Python versions

Sources: setup.py72-77

Python Version Support

The library officially supports Python versions 3.9 and newer, as indicated by the python_requires parameter and classifiers in the setup script:

Python VersionStatus
3.9Supported
3.10Supported
3.11Supported
3.12Supported

Sources: setup.py65-68 setup.py72

Build Process

The build process for SpeechRecognition involves several steps that prepare the package for distribution:


Sources: setup.py1-78 make-release.sh10

Custom Installation Steps

The library includes a custom installation command called InstallWithExtraSteps that extends the standard install command to handle platform-specific requirements:


The custom installation process:

  1. Runs the standard installation steps
  2. Identifies FLAC executables in the installed files
  3. Sets appropriate executable permissions on these files

This ensures that the FLAC executables have the correct permissions across different operating systems.

Sources: setup.py17-35

Release Workflow

The release process for SpeechRecognition is automated through the make-release.sh script, which handles building, signing, and publishing the package to PyPI:


The release workflow consists of these steps:

  1. Building a wheel distribution using python setup.py bdist_wheel
  2. Creating a detached GPG signature for the wheel
  3. Uploading both the wheel and signature to PyPI using twine

Sources: make-release.sh1-13

Release Script Details

The make-release.sh script takes a version number as an argument and performs the following operations:


Where $1 is the version number provided as an argument to the script.

Sources: make-release.sh10-12

Distribution Package Contents

The MANIFEST.in file controls which files are included in the source distribution of the package:


Sources: MANIFEST.in1-7

FLAC Executables Licensing

The FLAC executables included with SpeechRecognition are distributed under the GNU General Public License v2. The full license text is included in the LICENSE-FLAC.txt file in the repository root.

These executables are essential for audio conversion in the library and are used to convert audio to the FLAC format before sending it to recognition services.

Sources: LICENSE-FLAC.txt1-339

Development Setup

For developers wishing to contribute to the SpeechRecognition library, the following steps are recommended:

  1. Clone the repository from GitHub
  2. Create a virtual environment for development
  3. Install the package in development mode:
    
    
  4. Make changes to the code
  5. Run tests (see the Testing Framework page for details)
  6. Submit a pull request

When making changes that affect the build process, be sure to test installation on multiple platforms to ensure the platform-specific executables work correctly.

Sources: setup.py17-35