microsoft / microsoft/onnxruntime

[Feature Request] Add `py.typed` and type annotations to Python package

Open
#32,615 3 comments 0 reactions 0 assignees View on GitHub
feature request
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 11h
Merged PRs (30d)
184

Description

### Describe the feature request

It would be great if the project included type annotations and a `py.typed` file. Currently, running Mypy generates an error:

```
main.py:7: error: Skipping analyzing "onnxruntime": module is installed, but missing library stubs or py.typed marker [import-untyped]
main.py:7: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
```

- https://mypy.readthedocs.io/en/stable/installed_packages.html
- https://peps.python.org/pep-0561/

### Describe scenario use case

Running Mypy against a Python application that imports `onnxruntime` to ensure proper use.

Contributor guide

Open the contributing guide

Research direction

Start by locating the Python package modules and packaging metadata in the onnxruntime repository, then review how the package is built and distributed. Use the reported Mypy scenario as the initial check. Done means the distribution includes a py.typed marker and its public Python interfaces provide annotations that Mypy can analyze without the missing-stubs error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
developer-experience, machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.