Griffe fails to parse the class init signature for pydantic dataclasses that allow extra kwargs.
The result is missing types in the documentation and everything marked as required.
allow_extra = ConfigDict(extra="allow", str_strip_whitespace=True, allow_inf_nan=False, arbitrary_types_allowed=True)
@dataclass(config=allow_extra)
class FDK_AAC(Encoder):
"""
Uses the libFDK implementation in ffmpeg to encode audio to AAC.
It's strongly recommended to use qAAC if you're on windows because its straight up the best AAC encoder.
:param bitrate_mode: Any int value from 0 - 5
0 will be CBR and using the bitrate below, 1 - 5 are true VBR modes
See https://wiki.hydrogenaud.io/index.php?title=Fraunhofer_FDK_AAC#Bitrate_Modes
:param bitrate: Any int value representing kbps
:param cutoff: Hard frequency cutoff. 20 kHz is a good default and setting it to 0 will let it choose automatically.
:param preprocess: Any amount of preprocessors to run before passing it to the encoder.
:param use_binary: Whether to use the fdkaac encoder binary or ffmpeg.
If you don't have ffmpeg compiled with libfdk it will try to fall back to the binary.
:param append: Any other args one might pass to the encoder
:param output: Custom output. Can be a dir or a file.
Do not specify an extension unless you know what you're doing.
"""
bitrate_mode: int = 5
bitrate: int = 256
cutoff: int = 20000
preprocess: Preprocessor | Sequence[Preprocessor] | None = None
use_binary: bool = False
append: str = ""
output: PathLike | None = None
Install the package with the dynamic-dataclasses
branch.
pip install git+https://github.com/Jaded-Encoding-Thaumaturgy/muxtools.git@dynamic-dataclasses
And then either use the docs repo itself like
git clone https://github.com/Vodes/muxtools-doc.git
cd muxtools-doc
pip install mkdocs-material mkdocstrings[python]
pip install --no-deps git+https://github.com/Jaded-Encoding-Thaumaturgy/vs-muxtools.git
pip install --no-deps git+https://github.com/Vodes/vodesfunc.git
mkdocs serve
http://localhost:8000/muxtools/audio/encoders/ will then show the issue.
or just use a blanket docs setup that just embeds the encoders file like this
WARNING - griffe: C:\Users\Alex\AppData\Roaming\Python\Python312\site-packages\muxtools\audio\encoders.py:274: Parameter 'bitrate_mode' does not appear in the function signature
WARNING - griffe: C:\Users\Alex\AppData\Roaming\Python\Python312\site-packages\muxtools\audio\encoders.py:274: No matching parameter for 'bitrate_mode'
WARNING - griffe: C:\Users\Alex\AppData\Roaming\Python\Python312\site-packages\muxtools\audio\encoders.py:274: Parameter 'bitrate' does not appear in the function signature
WARNING - griffe: C:\Users\Alex\AppData\Roaming\Python\Python312\site-packages\muxtools\audio\encoders.py:274: No matching parameter for 'bitrate'
WARNING - griffe: C:\Users\Alex\AppData\Roaming\Python\Python312\site-packages\muxtools\audio\encoders.py:274: Parameter 'cutoff' does not appear in the function signature
WARNING - griffe: C:\Users\Alex\AppData\Roaming\Python\Python312\site-packages\muxtools\audio\encoders.py:274: No matching parameter for 'cutoff'
...
Properly parse types in the signature.
Using a vanilla python dataclass results in the wanted behavior.
- __System__: Windows-11-10.0.22631-SP0
- __Python__: cpython 3.12.3 (Z:\Program Files\Python312\python.exe)
- __Environment variables__:
- __Installed packages__:
- `griffe` v0.47.0
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too