Skip to content

Commit

Permalink
chore: package stubs in whl (#486)
Browse files Browse the repository at this point in the history
* chore: don't use staticmethod decorator

* chore: bundle stubs in whl
  • Loading branch information
alex-liang3 authored Jan 6, 2025
1 parent d1c4ed4 commit da2b98f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 3 additions & 0 deletions bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Empty file added bindings/python/py.typed
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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)

0 comments on commit da2b98f

Please sign in to comment.