From d186d5686845f0a35eeb1a8b7db95c3dd8cf689d Mon Sep 17 00:00:00 2001 From: Alex Liang Date: Mon, 30 Dec 2024 13:28:47 +0000 Subject: [PATCH 1/2] chore: don't use staticmethod decorator --- .../tools/python/ostk/astrodynamics/pytrajectory/pystate.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bindings/python/tools/python/ostk/astrodynamics/pytrajectory/pystate.py b/bindings/python/tools/python/ostk/astrodynamics/pytrajectory/pystate.py index 3d7b24be9..5920c298e 100644 --- a/bindings/python/tools/python/ostk/astrodynamics/pytrajectory/pystate.py +++ b/bindings/python/tools/python/ostk/astrodynamics/pytrajectory/pystate.py @@ -21,7 +21,6 @@ CANONICAL_FORMAT: str = r"(r|v)_(.*?)_(x|y|z)" -@staticmethod def custom_class_generator(frame: Frame, coordinate_subsets: list) -> type: """ Emit a custom class type for States. This is meta-programming syntactic sugar on top of the StateBuilder class. @@ -44,7 +43,6 @@ def __init__(self, instant: Instant, coordinates: np.ndarray): return StateTemplateType -@staticmethod def from_dict(data: dict) -> State: """ Create a State from a dictionary. @@ -247,5 +245,5 @@ def from_dict(data: dict) -> State: ) -State.from_dict = from_dict -State.template = custom_class_generator +State.from_dict = staticmethod(from_dict) +State.template = staticmethod(custom_class_generator) From d8882dc2b18c66d0749e871aa20f078c60c0df17 Mon Sep 17 00:00:00 2001 From: Alex Liang Date: Mon, 30 Dec 2024 13:28:59 +0000 Subject: [PATCH 2/2] chore: bundle stubs in whl --- bindings/python/CMakeLists.txt | 3 +++ bindings/python/py.typed | 0 2 files changed, 3 insertions(+) create mode 100644 bindings/python/py.typed diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt index 6fde34ef4..541a3669b 100755 --- a/bindings/python/CMakeLists.txt +++ b/bindings/python/CMakeLists.txt @@ -157,6 +157,9 @@ FUNCTION (PY_ADD_PACKAGE_DIRECTORY NAME) COMMAND cp "${CMAKE_SOURCE_DIR}/lib/${LIBRARY_TARGET}.*${EXTENSION}*.so" "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/${PROJECT_PATH}/" COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/requirements.txt" "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/requirements.txt" COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/README.md" "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/README.md" + COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/py.typed" "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/${PROJECT_PATH}/py.typed" + COMMAND cd "${CMAKE_CURRENT_BINARY_DIR}/${NAME}" && python${PYTHON_VERSION} -m pip install . + COMMAND python${PYTHON_VERSION} -m "pybind11_stubgen" -o "${CMAKE_CURRENT_BINARY_DIR}/${NAME}" "${PROJECT_GROUP}.${PROJECT_SUBGROUP}" # generate stubs in same dir as binaries COMMAND cd "${CMAKE_CURRENT_BINARY_DIR}/${NAME}" && python${PYTHON_VERSION} -m build --no-isolation -w COMMAND mkdir -p "${CMAKE_CURRENT_BINARY_DIR}/dist" COMMAND cp "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/dist/*" "${CMAKE_CURRENT_BINARY_DIR}/dist" diff --git a/bindings/python/py.typed b/bindings/python/py.typed new file mode 100644 index 000000000..e69de29bb