fix: Incorrect type annotations — use Optional[T] instead of T for nullable defaults

Open Beginner friendly
#324 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python

Research direction

Read the affected annotations in src/voxcpm/modules/minicpm4/config.py, src/voxcpm/modules/locdit/local_dit.py, and src/voxcpm/core.py. Update each parameter that defaults to None to use Optional[T], then verify that all listed nullable parameters are annotated consistently for type checking.

Written by the indexing model from the issue text.

Description

Bug Report

Several parameters use bare type annotations with None as default value (e.g., int = None, str = None), which is incorrect. These should use Optional[T] = None to properly indicate nullable types per PEP 484.

Affected locations
  1. src/voxcpm/modules/minicpm4/config.py (line 29):

    • kv_channels: int = Nonekv_channels: Optional[int] = None
  2. src/voxcpm/modules/locdit/local_dit.py (line 30):

    • out_dim: int = Noneout_dim: Optional[int] = None
  3. src/voxcpm/core.py (lines 109, 183–185):

    • cache_dir: str = Nonecache_dir: Optional[str] = None
    • prompt_wav_path: str = Noneprompt_wav_path: Optional[str] = None
    • prompt_text: str = Noneprompt_text: Optional[str] = None
    • reference_wav_path: str = Nonereference_wav_path: Optional[str] = None
Expected behavior

All parameters that default to None should be annotated with Optional[T] for correct type checking.

Dominant language
Python
Stars
37.8k
Forks
4.3k
Avg merge
7m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OpenBMB/VoxCPM

All issues in OpenBMB/VoxCPM

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.