Install & Compatibility
Where this runs
tested against v2.11.0.15 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.6MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.7s · import 0.000s · 19MB
17MB installed
● package 17MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
format_date
✓ from babel_stubs.dates import format_date
✗ from babel-stubs.dates import format_date
This quickstart demonstrates how to use a function from the `babel` library (`format_date`) and implicitly leverage the type annotations provided by `types-babel` when running a type checker like MyPy. Ensure you have both `babel` and `mypy` installed. If your `babel` version is 2.12.1 or newer, `types-babel` is not needed.
from datetime import date
from babel.dates import format_date
def main():
today = date(2026, 4, 12)
# types-babel provides type information for functions like format_date
formatted_today: str = format_date(today, locale='en_US')
print(f"Today is: {formatted_today}")
# Example of a type error (uncomment to see mypy in action):
# invalid_type: int = format_date(today, locale='en_US')
if __name__ == '__main__':
main()
# To run type checking, install mypy and babel:
# pip install babel mypy
# Then, run: mypy your_script_name.py
Debug
Known issues
breakingThe `babel` package itself now includes its own type annotations starting from version 2.12.1. If you are using `babel` version 2.12.1 or newer, you should uninstall `types-babel` to avoid conflicts and ensure accurate type checking, as the native types are preferred.fixUninstall `types-babel`: `pip uninstall types-babel`.
affects: babel >= 2.12.1
gotchaVersion compatibility is crucial. The version number of `types-babel` (e.g., `2.11.0.x`) corresponds to the version of the `babel` runtime package it stubs (e.g., `babel==2.11.*`). Using mismatched versions can lead to incorrect or incomplete type checking results.fixEnsure that the major and minor version of `types-babel` closely matches your installed `babel` package version (e.g., `types-babel==2.11.x` for `babel==2.11.y`).
affects: <= 2.11.0 of types-babel with any babel version
gotcha`types-babel` is currently marked as a 'partial' stub package. This means that not all modules, classes, or functions within the `babel` library may have complete type annotations. Type checkers might infer `Any` for unannotated parts, potentially missing errors.fixRefer to the typeshed repository for details on the completeness of stubs. Contributions to complete missing annotations are welcome in typeshed.
affects: All versions of types-babel
gotchaTypeshed, the source for `types-babel`, supports specific Python versions (currently 3.10 to 3.14). Ensure your Python environment is compatible with both the `types-babel` stubs and the `babel` runtime library. For example, `babel` 2.15 and newer requires Python 3.8 or newer.fixVerify your Python version against the typeshed and `babel` documentation. Upgrade or downgrade your Python environment as necessary.
affects: All versions
Upgrade
Version history
2.11.0.15latest on PyPI · released Jul 20, 2023
Audit
Dependencies
babelrequiredProvides the runtime functionality for which these are type stubs.