diff --git a/README.md b/README.md index f96bc4f..d1a3378 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,16 @@ To install Together Python Library from PyPI, simply run: pip install together ``` +### Type hints + +This package ships inline type annotations and a [PEP 561](https://peps.python.org/pep-0561/) `py.typed` marker, so type checkers such as mypy and pyright use them automatically — no separate stub package and no `follow_untyped_imports` override needed: + +```python +from together import Together + +client = Together() # fully typed +``` + ### Setting up API Key > 🚧 You will need to create an account with [Together.ai](https://api.together.xyz/) to obtain a Together API Key. diff --git a/src/together/py.typed b/src/together/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/tests/unit/test_py_typed.py b/tests/unit/test_py_typed.py new file mode 100644 index 0000000..ee85ebb --- /dev/null +++ b/tests/unit/test_py_typed.py @@ -0,0 +1,14 @@ +from pathlib import Path + +import together + + +def test_py_typed_marker_ships_with_package() -> None: + """PEP 561 requires the marker to sit inside the installed package. + + Checking it relative to the imported module (rather than the repo tree) + means this also fails if the marker is ever dropped from the built + distribution. + """ + package_root = Path(together.__file__).parent + assert (package_root / "py.typed").is_file()