Type stubs for OpenImageIO Python bindings!
This package provides type stubs for oiio-python, enabling static type checking and better IDE support for OpenImageIO and OpenColorIO Python bindings.
- 🎯 Complete Type Coverage: Type hints for OpenImageIO and PyOpenColorIO modules
- 🚀 IDE Support: Enhanced code completion and type checking
- ✨ MyPy Compatible: Full support for static type checking
- 🔄 Version Matched: Stubs versions match
oiio-pythonreleases
pip install types-oiio-pythonIt is recommended to add this package to your project development dependencies.
Once installed, MyPy and your most IDEs will automatically use these stubs for type checking and code completion.
| Autocomplete | Type Checking |
|---|---|
![]() |
![]() |
| (Example in VS Code) | (Example in VS Code) |
Unfortunately Pylint does not (yet) support the use of stubs int the .pyi format.
If you use Pylint, you will need to add the following to your .pylintrc file:
extension-pkg-whitelist=OpenImageIO,PyOpenColorIOTo avoid getting E1101:no-member errors when using compiled modules.
The version numbers match the corresponding oiio-python releases. For example:
- types-oiio-python 2.5.12.0.x corresponds to oiio-python 2.5.12.0.x
- The stubs are generated using mypy's stubgen tool.
- Included
generate_stubs.pyscript is used to generate stubs for OpenImageIO and OpenColorIO modules. - Manual adjustments are made to improve the generated stubs.
- Clone the repository
- Install in interactive mode with dev dependencies
pip install -e .[dev]
- Test the stubs with MyPy stubtest
stubtest OpenImageIO --allowlist oiio-mypy-baseline.txt stubtest PyOpenColorIO --allowlist ocio-mypy-baseline.txt

