Integrating YAML Configuration in Foundry: How to Resolve File Not Found Error?

Hello,

I am working with Foundry and have a YAML file intended for configuration in my code repository. My current repository structure is as follows:
|–my_folder
|–python_file.py
|–parameters.yaml

I am attempting to load this YAML file within my Python script using the following code:

params = resource_stream(__name__, "parameters.yaml")
config = yaml.safe_load(params)

While the YAML file loads correctly and the dataset transformation appears as expected when I preview, I encounter an error during the build process indicating that the YAML file cannot be found.

Does Foundry support loading configuration from YAML files? If so, could you provide guidance on how to correctly reference the YAML file in my script and resolve this build error?

Thank you

https://www.palantir.com/docs/foundry/transforms-python/read-files-repository/ includes appropriate instructions here (specifically, regarding the need to add an appropriate entry to package_data in the repository’s setup.py file). If you haven’t followed those steps yet, please give them a try!

4 Likes