Unsloth Stubs is a collection of PEP 484 type stub files (.pyi) for the unsloth library. These stubs provide accurate type hints for improved autocompletion, static analysis, and developer experience in Python IDEs and type checkers.
Stub files are generated using stubgen and manually refined for correctness. Some tests and configs are contributed to Typeshed; see their contributors and license.
Install from PyPI:
pip install unsloth-stubs
Or from conda-forge:
conda install -c conda-forge unsloth-stubs
Once installed, type checkers (e.g., Mypy, Pytype1) and autocompletion tools (e.g., Jedi) will automatically use the stubs if they are on your PYTHONPATH. If you need to manually add stubs, copy the .pyi files next to their .py counterparts in your Unsloth installation directory, or add the stubs directory to your PYTHONPATH.
Refer to PEP 561 for details on distributing and packaging type information.
Unsloth Stubs versions follow Unsloth releases. For example, unsloth-stubs==2025.9.5 is compatible with unsloth>=2025.9.5. Maintenance releases (e.g., post1, post2, …) are reserved for annotation updates only.
The stubs cover the most commonly used classes and methods in Unsloth. Full coverage is not guaranteed, but contributions are welcome!
unsloth-stubs/
├── unsloth/
│ ├── __init__.pyi
│ ├── models/
│ ├── kernels/
│ ├── dataprep/
│ ├── registry/
│ └── utils/
└── ...
Contributions, bug reports, and suggestions are welcome! Please open an issue or pull request on GitHub.
Unsloth and the Unsloth logo are trademarks of their respective owners. This project is not affiliated with or endorsed by any other organization.
Pytype is not officially supported or tested. ↩