Closed edwardalee closed 1 day ago
The recent updates introduce two new functions, py_source_directory
and py_package_directory
, in the python/include/pythontarget.h
and python/lib/pythontarget.c
files. These functions are designed to return directory paths as Python strings, enhancing the module's capabilities in handling directory paths.
Files | Change Summary |
---|---|
python/include/pythontarget.h | Added declarations for py_source_directory and py_package_directory . |
python/lib/pythontarget.c | Implemented py_source_directory and py_package_directory to return decoded paths. |
sequenceDiagram
participant User
participant PythonModule
User->>PythonModule: Call py_source_directory()
PythonModule-->>User: Return source directory path as string
User->>PythonModule: Call py_package_directory()
PythonModule-->>User: Return package directory path as string
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
This is needed so that a reactor can access a data file. The motivating application is an ML model. Do you have an alternative suggestion?
Why not provide the path via runtime parameters? This could be done via CLI arguments (I guess this is not supported for the python and C targets) or by reading an environment variable.
@cmnrd:I think the conclusion we reached during our last call was that we can admit this as a temporary solution?
This PR adds to Python a mechanism to obtain the path of the source directory (the main .lf file) and the package root (where src and bin are). This mirrors the constants available in the C target
LF_SOURCE_DIRECTORY
andLF_PACKAGE_DIRECTORY
.This PR is joint with @vinzbarbuto.
Summary by CodeRabbit
py_source_directory
andpy_package_directory
.