Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to using protogen's .pyi file generator #6096

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Expand Up @@ -81,7 +81,6 @@ compile_commands.json
# generated files
onnx/version.py
compile_commands.json
tools/protoc-gen-mypy.sh

# test generated files
.cache
Expand Down Expand Up @@ -112,4 +111,4 @@ docs/docsgen/**/*.onnx
docs/docsgen/**/*.pb

# PyEnv files
.python-version
.python-version
4 changes: 2 additions & 2 deletions .reuse/dep5
Expand Up @@ -130,11 +130,11 @@ Files: cmake/ONNXConfig*.in CMakeLists.txt cmake/*cmake cmake/
COPYRIGHT: Copyright (c) ONNX Project Contributors
License: Apache-2.0

Files: .vscode/settings.json docs/docsgen/source/_templates/layout.html docs/docsgen/source/_templates/sidebar-nav-bs.html docs/images/onnx_hub_arch.svg docs/onnx-horizontal-color.png tools/protoc-gen-mypy.sh.in
Files: .vscode/settings.json docs/docsgen/source/_templates/layout.html docs/docsgen/source/_templates/sidebar-nav-bs.html docs/images/onnx_hub_arch.svg docs/onnx-horizontal-color.png
COPYRIGHT: Copyright (c) ONNX Project Contributors
License: Apache-2.0

Files: onnx/gen_proto.py tools/protoc-gen-mypy.bat onnx/reference/op_run.py
Files: onnx/gen_proto.py onnx/reference/op_run.py
COPYRIGHT: Copyright (c) ONNX Project Contributors
License: Apache-2.0

Expand Down
26 changes: 4 additions & 22 deletions CMakeLists.txt
Expand Up @@ -373,29 +373,11 @@ function(RELATIVE_PROTOBUF_GENERATE_CPP NAME SRCS HDRS ROOT_DIR DEPEND)
--cpp_out
${ONNX_DLLEXPORT_STR}${CMAKE_CURRENT_BINARY_DIR})
if(BUILD_ONNX_PYTHON)
list(APPEND PROTOC_ARGS --python_out
${CMAKE_CURRENT_BINARY_DIR})
list(APPEND PROTOC_ARGS --python_out)
if(ONNX_GEN_PB_TYPE_STUBS)
if(NOT WIN32)
# use PYTHON_EXECUTABLE to python protoc-gen-mypy.py
configure_file(
${ROOT_DIR}/tools/protoc-gen-mypy.sh.in
${PROJECT_BINARY_DIR}/tools/protoc-gen-mypy.sh
@ONLY)
execute_process(COMMAND chmod +x ${PROJECT_BINARY_DIR}/tools/protoc-gen-mypy.sh)
configure_file(
${ROOT_DIR}/tools/protoc-gen-mypy.py
${PROJECT_BINARY_DIR}/tools/protoc-gen-mypy.py
COPYONLY)
set(PROTOC_MYPY_PLUGIN_FILE ${PROJECT_BINARY_DIR}/tools/protoc-gen-mypy.sh)
else()
set(PROTOC_MYPY_PLUGIN_FILE ${ROOT_DIR}/tools/protoc-gen-mypy.bat)
endif()
list(APPEND PROTOC_ARGS
--plugin
protoc-gen-mypy=${PROTOC_MYPY_PLUGIN_FILE}
--mypy_out
${ONNX_DLLEXPORT_STR}${CMAKE_CURRENT_BINARY_DIR})
list(APPEND PROTOC_ARGS pyi_out:${CMAKE_CURRENT_BINARY_DIR})
else()
list(APPEND PROTOC_ARGS ${CMAKE_CURRENT_BINARY_DIR})
endif()
endif()
if(NOT ONNX_PROTOC_EXECUTABLE)
Expand Down
4 changes: 0 additions & 4 deletions tools/protoc-gen-mypy.bat

This file was deleted.