You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@hamilton.apache.org by "harshith1118 (via GitHub)" <gi...@apache.org> on 2025/10/04 04:01:43 UTC
[I] Support loading context from TOML files (including pyproject.toml) [hamilton]
harshith1118 opened a new issue, #1401:
URL: https://github.com/apache/hamilton/issues/1401
## Description
Currently, the Hamilton CLI only supports loading context files from `.json` and `.py` files. It
would be beneficial to add support for TOML files, especially since many Python projects use
`pyproject.toml` for project configuration.
## Motivation
- Many Python projects already have `pyproject.toml` files
- It would follow Python packaging conventions to keep Hamilton configuration in `
[tool.hamilton]` section
- Users could consolidate their project configuration in one place
- TOML is a more readable format than JSON for configuration files
## Implementation Plan
I've already implemented this feature in a fork which:
- Adds support for `.toml` file extension in the CLI context loading
- Supports both 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
Added comprehensive tests for both formats
Updated CLI help text to reflect the new supported file type
## Files Modified
- `hamilton/cli/logic.py` - Enhanced `load_context` function
- `hamilton/cli/__main__.py` - Updated help text
- Added test files and test functions
## Testing
All existing tests continue to pass, and new tests cover the TOML functionality.
I'd like to submit a pull request for this feature if the maintainers approve.
--
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: notifications-unsubscribe@hamilton.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Support loading context from TOML files (including pyproject.toml) [hamilton]
Posted by "harshith1118 (via GitHub)" <gi...@apache.org>.
harshith1118 commented on issue #1401:
URL: https://github.com/apache/hamilton/issues/1401#issuecomment-3367876405
Thank you for the positive feedback! I've already implemented the feature with full backwards
compatibility as requested.
I've created issue #1401 to track this feature request, and I'm now preparing to
submit the pull request with the implementation.
The changes:
- Add support for TOML files in the CLI context loading
- Support both top-level Hamilton headers and [tool.hamilton] section format
- Include comprehensive tests for both formats
- Maintain full backwards compatibility with existing .json and .py files
- Update CLI help text to reflect the new file type support
I'll submit the pull request shortly which will reference the issue.
--
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: notifications-unsubscribe@hamilton.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Support loading context from TOML files (including pyproject.toml) [hamilton]
Posted by "skrawcz (via GitHub)" <gi...@apache.org>.
skrawcz commented on issue #1401:
URL: https://github.com/apache/hamilton/issues/1401#issuecomment-3367868393
Sounds interesting. As long as we maintain backwards compatibility I don't see why we couldn't have this contribution.
--
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: notifications-unsubscribe@hamilton.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org