junrushao opened a new issue, #250:
URL: https://github.com/apache/tvm-ffi/issues/250

   Current path finding for `libtvm_ffi.so` and `libtvm_ffi_testing.so` heavily 
depends on hardcoded paths. More concretely, assuming `build/lib` as part of 
the path for editable development.
   
   
https://github.com/apache/tvm-ffi/blob/53a7fe9f64a96eacdb044b1d7ac1ed1d17f3da70/python/tvm_ffi/libinfo.py#L55-L58
   
   However, this is not an optimal strategy for editable builds, because:
   1) build directory could be different than `build/`, e.g. `build-release`, 
`build/release`, etc.
   2) the actual `.so` files are actually installed into Python's 
`site-packages` directory by `scikit-build-core`. The `.so` files can get 
outdated or mismatch inside `build/`
   
   Let's switch to a more standard practice in this case for both 
`apache-tvm-ffi` and the example extension in `my_ffi_extension` under 
`examples/packaging`, by using the snippet below:
   
   ```python
   import importlib.metadata as im
   
   def find_files(
     package: str,  # pass in `__package__`
     stem: str  # pass in `tvm_ffi`, so that it finds `lib{stem}.so`, 
`lib{stem}.so`, `{stem}.dll`
   ):
       owners: list[str] = im.packages_distributions().get(package)
       pkg = owners[0] if owners else package.replace("_", "-")
       for pth in im.files(pkg):
           print("File: ", pth.locate())
       ...
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to