Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ include CMakeLists.txt
include Doxyfile
recursive-include src *
recursive-include dsf *.pyi
include src/dsf/py.typed
global-exclude *.pyc
global-exclude __pycache__
global-exclude *.so
32 changes: 31 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,12 +442,42 @@
f"Warning: Stub file not found at {stub_file} and no package dir at {package_stub_dir}"
)

# Copy all .pyi files from source to build_lib so they're included in the wheel
build_lib_dsf = Path(self.build_lib) / "dsf"
build_lib_dsf.mkdir(parents=True, exist_ok=True)

Check warning

Code scanning / Pylint (reported by Codacy)

Instance of 'PurePath' has no 'mkdir' member Warning

Instance of 'PurePath' has no 'mkdir' member
for pyi_file in source_pkg_dir.glob("**/*.pyi"):

Check warning

Code scanning / Pylint (reported by Codacy)

Instance of 'PurePath' has no 'glob' member Warning

Instance of 'PurePath' has no 'glob' member
rel_path = pyi_file.relative_to(source_pkg_dir)
dest_file = build_lib_dsf / rel_path
dest_file.parent.mkdir(parents=True, exist_ok=True)
print(f"Copying stub to build_lib: {pyi_file} -> {dest_file}")
shutil.copy2(pyi_file, dest_file)

except subprocess.CalledProcessError as e:
print(f"Warning: Stub generation failed: {e}")
print(f"stdout: {e.stdout}")
print(f"stderr: {e.stderr}")
# Don't fail the build if stub generation fails

# Always copy existing .pyi files from source to build_lib (even if stubgen failed)
# This ensures pre-existing stubs like mdt.pyi and mobility.pyi are included in the wheel
source_pkg_dir = Path(__file__).parent / "src" / "dsf"
build_lib_dsf = Path(self.build_lib) / "dsf"
build_lib_dsf.mkdir(parents=True, exist_ok=True)

Check warning

Code scanning / Pylint (reported by Codacy)

Instance of 'PurePath' has no 'mkdir' member Warning

Instance of 'PurePath' has no 'mkdir' member
for pyi_file in source_pkg_dir.glob("**/*.pyi"):

Check warning

Code scanning / Pylint (reported by Codacy)

Instance of 'PurePath' has no 'glob' member Warning

Instance of 'PurePath' has no 'glob' member
rel_path = pyi_file.relative_to(source_pkg_dir)
dest_file = build_lib_dsf / rel_path
dest_file.parent.mkdir(parents=True, exist_ok=True)
if not dest_file.exists():
print(f"Copying existing stub to build_lib: {pyi_file} -> {dest_file}")
shutil.copy2(pyi_file, dest_file)

# Copy py.typed marker for PEP 561 compliance
py_typed_src = source_pkg_dir / "py.typed"
py_typed_dest = build_lib_dsf / "py.typed"
if py_typed_src.exists() and not py_typed_dest.exists():

Check warning

Code scanning / Pylint (reported by Codacy)

Instance of 'PurePath' has no 'exists' member Warning

Instance of 'PurePath' has no 'exists' member
print(f"Copying py.typed marker to build_lib: {py_typed_dest}")
shutil.copy2(py_typed_src, py_typed_dest)


# Read long description from README.md if available
LONG_DESCRIPTION = ""
Expand Down Expand Up @@ -508,7 +538,7 @@
package_dir={"": "src"},
cmdclass={"build_ext": CMakeBuild},
package_data={
"dsf": ["*.pyi"],
"dsf": ["*.pyi", "py.typed", "**/*.pyi"],
"": ["*.pyi"],
},
include_package_data=True,
Expand Down
2 changes: 1 addition & 1 deletion src/dsf/dsf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

static constexpr uint8_t DSF_VERSION_MAJOR = 4;
static constexpr uint8_t DSF_VERSION_MINOR = 7;
static constexpr uint8_t DSF_VERSION_PATCH = 3;
static constexpr uint8_t DSF_VERSION_PATCH = 4;

static auto const DSF_VERSION =
std::format("{}.{}.{}", DSF_VERSION_MAJOR, DSF_VERSION_MINOR, DSF_VERSION_PATCH);
Expand Down
Empty file added src/dsf/py.typed
Empty file.
Loading