Repository navigation
Conversation
ForceField(), ForceField.parse_sources() and ForceField.parse_smirnoff_from_source() accept a string containing OFFXML content: a string that does not resolve to a file name is parsed directly by ParameterIOHandler.parse_string(). The docstrings only described file paths and file-like objects. Describe the string form in all three places, and note that parse_sources iterates a bare string character by character, so a single string source must be wrapped in a list. Fixes openforcefield#2021 Signed-off-by: Atharva Tilewale <[email protected]>
Signed-off-by: Atharva Tilewale <[email protected]>
Member
|
Thanks for opening this @AtharvaTilewale - The CI failures are expected (we use a secret that isn't accessible from forks). I'll review this shortly! |
j-wags
approved these changes
Oct 27, 2026
j-wags
left a comment
Member
There was a problem hiding this comment.
Thanks @AtharvaTilewale , this looks good to me. I'll push one change and merge!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Documents that
ForceField(),ForceField.parse_sources()andForceField.parse_smirnoff_from_source()accept a string containing OFFXML content, in addition to file paths and file-like objects. As discussed in #2021, a string that does not resolve to a file name falls through toParameterIOHandler.parse_string()and this has been de facto public API since the beginning, but all threesources/sourcedocstrings described only files.The
parse_sourcesdocstring also now says that a bare string is iterated character by character (iter(str)succeeds), so a single string source has to be wrapped in a list;ForceField(<string>)is unaffected because*sourcesalready arrives as a tuple. This came out of checking each documented statement against the toolkit:The
__init__entry is also reflowed into a bullet list, per the whitespace comment on the issue.ruff checkpasses (one rewrapped line was over the 119-character limit) andpytest openff/toolkit/_tests/test_forcefield.py -k "string or parse_sources or xml"gives 164 passed, 4 skipped. Docstring-only change, so no new tests. The release-history entry references this PR's number.Fixes #2021
See our AI Policy. Please indicate whether LLMs or other AI-powered tools (beyond simple IDE use cases) were used in this contribution: