microsoft / microsoft/onnxruntime

Support pathlib.Path when paths are required in python module

Open
#3,843 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api feature request
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 11h
Merged PRs (30d)
184

Description

Right now we only support string paths as in

rt.InferenceSession("myfile.pb")

We should support semantically accurate `pathlib.Path` types, too

rt.InferenceSession(Path("myfile.pb"))

and not throw an exception.

https://github.com/microsoft/onnxruntime/blob/f9bf546e3c19d1739590a24cfdf3b08a503f8c73/onnxruntime/python/session.py#L34-L42

Note: not just in InferenceSession but everywhere we require a path.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with onnxruntime/python/session.py at lines 34-42, then identify the other Python-module entry points that require paths. Check how those entry points handle string paths and determine the existing validation or test coverage before changing behavior. Done means pathlib.Path values are accepted everywhere paths are required without raising an exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.