Skip to content

Commit

Permalink
Fix wheel to include stubs (#54)
Browse files Browse the repository at this point in the history
* add pyi

* fix missing stubs

* remove submod
  • Loading branch information
tlambert03 authored Feb 10, 2025
1 parent 9a2bb90 commit 1931fe3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,9 @@ testpaths = [
]

[tool.setuptools]
zip-safe = false
zip-safe = false
packages = ["acquire_zarr"]
package-dir = { "" = "python" }

[tool.setuptools.package-data]
acquire_zarr = ["*.pyi", "py.typed"]
1 change: 1 addition & 0 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ target_include_directories(acquire_zarr PRIVATE ${PROJECT_SOURCE_DIR}/include)
target_link_libraries(acquire_zarr PRIVATE acquire-zarr)

set_target_properties(acquire_zarr PROPERTIES
OUTPUT_NAME "__init__"
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
)
File renamed without changes.
Empty file added python/acquire_zarr/py.typed
Empty file.
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ def build_extension(self, ext):
subprocess.check_call(["cmake", "--build", "."] + build_args, cwd=build_dir)

if self.compiler.compiler_type == "msvc":
built_ext = str(Path(build_dir) / "python" / cfg / "acquire_zarr*.pyd")
built_ext = str(Path(build_dir) / "python" / cfg / "__init__*.pyd")
else:
built_ext = str(Path(build_dir) / "python" / "acquire_zarr*.so")
built_ext = str(Path(build_dir) / "python" / "__init__*.so")
matching_files = glob.glob(built_ext)
if not matching_files:
raise RuntimeError(f"Could not find any files matching {built_ext}")
Expand All @@ -67,6 +67,6 @@ def move_file(self, src_files, dst, level=1):


setup(
ext_modules=[CMakeExtension("acquire_zarr")],
ext_modules=[CMakeExtension("acquire_zarr.__init__")],
cmdclass=dict(build_ext=CMakeBuild),
)

0 comments on commit 1931fe3

Please # to comment.