Skip to content

Conversation

@jld-adriano
Copy link

## Tracking issue
<!-- Remove this section if not applicable -->

## Why are the changes needed?

Currently, `pyflyte run` supports passing inputs via JSON and YAML files. Adding TOML support provides more flexibility for users who manage configurations in TOML format, aligning with existing capabilities and potentially simplifying local development workflows by allowing direct use of TOML config files as inputs. This also addresses a desire to avoid full image rebuilds when only config files change, by enabling them to be passed as inputs.

## What changes were proposed in this pull request?

This PR extends `pyflyte run` to support TOML files for the `--inputs-file` argument.
- Integrated `tomllib` (or `tomli` for Python < 3.11) for parsing TOML files.
- Modified the `load_inputs` function in `YamlFileReadingCommand` to attempt parsing as TOML if JSON and YAML parsing fail.
- Updated the `--inputs-file` help text and error messages to reflect TOML support.
- Added a new TOML input test file (`my_wf_input.toml`) and a corresponding unit test (`test_all_types_with_toml_input`) to verify the functionality.

## How was this patch tested?

New unit tests were added in `tests/flytekit/unit/cli/pyflyte/test_run.py` to cover the TOML input parsing functionality.

### Setup process

### Screenshots

## Check all the applicable boxes <!-- Follow the above conventions to check the box -->

- [x] I updated the documentation accordingly.
- [x] All new and existing tests passed.
- [ ] All commits are signed-off.

## Related PRs

Related to the existing JSON/YAML support introduced in flyteorg/flytekit#1606.

## Docs link

<!-- Add documentation link built by CI jobs here, and specify the changed place -->

Slack ThreadOpen in WebOpen in Cursor

Co-authored-by: adriano <adriano@exa.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants