Skip to content

Remove onnx, onnxruntime, skl2onnx from requirements and defer imports#833

Merged
jkgoodrich merged 4 commits intomainfrom
jg/defer_onnx_import
Apr 8, 2026
Merged

Remove onnx, onnxruntime, skl2onnx from requirements and defer imports#833
jkgoodrich merged 4 commits intomainfrom
jg/defer_onnx_import

Conversation

@jkgoodrich
Copy link
Copy Markdown
Contributor

Move onnx/onnxruntime/skl2onnx imports into the functions that use them so the module loads without these packages installed, avoiding the protobuf version conflict with Hail on Dataproc (see #831).

Move onnx/onnxruntime/skl2onnx imports into the functions that use them
so the module loads without these packages installed, avoiding the
protobuf version conflict with Hail on Dataproc (see #831).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jkgoodrich jkgoodrich requested a review from a team as a code owner April 7, 2026 15:51
@jkgoodrich jkgoodrich requested a review from mike-w-wilson April 7, 2026 15:51
jkgoodrich and others added 3 commits April 7, 2026 09:57
Lint environment doesn't install onnx/onnxruntime/skl2onnx since they
were removed from requirements.txt, so pylint flags the deferred imports.
Add inline disable comments scoped to those specific lines.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sphinx autodoc fails to resolve "onnx.ModelProto" forward references
since onnx is not installed in the docs build environment. Use Any
instead — the runtime isinstance check still validates the model type.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@mike-w-wilson mike-w-wilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good -- I just added a note to show up in the docs and also catching the import error to remind users they need to install the packages if they havent already.

@jkgoodrich jkgoodrich merged commit 39e8dd6 into main Apr 8, 2026
6 checks passed
@jkgoodrich jkgoodrich deleted the jg/defer_onnx_import branch April 8, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants