Always appreciate community involvement in making this project better.
We use uv for managing Python environments and dependencies, and ruff for linting and formatting.
-
Clone the repository:
git clone https://github.com/remsky/Kokoro-FastAPI.git cd Kokoro-FastAPI -
Install
uv: Follow the instructions on the officialuvdocumentation. -
Create a virtual environment and install dependencies: It's recommended to use a virtual environment.
uvcan create one for you. Install the base dependencies along with thetestandcpuextras (needed for running tests locally).# Create and activate a virtual environment (e.g., named .venv) uv venv source .venv/bin/activate # On Linux/macOS # .venv\Scripts\activate # On Windows # Install dependencies including test requirements uv pip install -e ".[test,cpu]"
Note: If you have an NVIDIA GPU and want to test GPU-specific features locally, you can install
.[test,gpu]instead, ensuring you have the correct CUDA toolkit installed.Note: If running via uv locally, you will have to install espeak and handle any pathing issues that arise. The Docker images handle this automatically
-
Install
ruff(if not already installed globally): Whileruffmight be included via dependencies, installing it explicitly ensures you have it available.uv pip install ruff
Before submitting changes, please ensure all tests pass as this is a automated requirement. The tests are run using pytest.
# Make sure your virtual environment is activated
uv run pytestNote: The CI workflow runs tests using uv run pytest api/tests/ --asyncio-mode=auto --cov=api --cov-report=term-missing. Running uv run pytest locally should cover the essential checks.
In addition to local pytest runs, test your changes using Docker Compose to ensure they work correctly within the containerized environment. If you aren't able to test on CUDA hardware, make note so it can be tested by another maintainer
docker compose -f docker/cpu/docker-compose.yml up --build
+
docker compose -f docker/gpu/docker-compose.yml up --buildThis command will build the Docker images (if they've changed) and start the services defined in the respective compose file. Verify the application starts correctly and test the relevant functionality.
We use ruff to maintain code quality and consistency. Please format and lint your code before committing.
-
Format the code:
# Make sure your virtual environment is activated ruff format .
-
Lint the code (and apply automatic fixes):
# Make sure your virtual environment is activated ruff check . --fix
Review any changes made by
--fixand address any remaining linting errors manually.
- Clone the repo
- Create a new branch for your feature or bug fix.
- Make your changes, following setup, testing, and formatting guidelines above.
- Please try to keep your changes inline with the current design, and modular. Large-scale changes will take longer to review and integrate, and have less chance of being approved outright.
- Push your branch to your fork.
- Open a Pull Request against the
masterbranch of the main repository.
Thank you for contributing!