harshith1118 opened a new pull request, #1402:
URL: https://github.com/apache/hamilton/pull/1402
Closes ##1401
This PR adds support for loading configuration from TOML files,
including pyproject.toml, to the
Hamilton CLI.
## Changes
- Add support for .toml and .tml file extensions in the `load_context`
function
- Support both configuration formats:
1. Top-level Hamilton headers: `HAMILTON_CONFIG`,
`HAMILTON_FINAL_VARS`, etc.
2. Tool-specific section: `[tool.hamilton]` with `config`,
`final_vars`, etc. sub-sections
- Add comprehensive tests covering both configuration styles
- Update CLI help text to reflect the new supported file type
- Maintain full backward compatibility with existing .json and .py files
## Motivation
Many Python projects already use `pyproject.toml` for project
configuration. This change allows
users to keep Hamilton configuration in the standard location
following Python packaging
conventions, consolidating project configuration in one place.
## Testing
All existing tests continue to pass, and new tests have been added to
ensure proper
functionality for both TOML configuration formats.
## Files Changed
- `hamilton/cli/logic.py` - Enhanced `load_context` function with TOML
support
- `hamilton/cli/__main__.py` - Updated help text for context file options
- `tests/cli/test_logic.py` - Added comprehensive tests for TOML
functionality
- Added test TOML files in `tests/cli/resources/`
--
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]