Skip to content

Conversation

@dbatten5
Copy link
Owner

@dbatten5 dbatten5 commented Oct 6, 2025

This PR adds support for using file streams in the config parsers, rather than
passing in file paths. This means the config parsers are only responsible for
parsing the file contents, rather than opening the file and then parsing the
content. This also allows us to move integration tests for the parsers (since
they depended on the filesystem) to unit tests as we can now pass in in-memory
file streams to the config parsers.

  • Add section_key to TomlParser
  • Simplify PyprojectParser
  • Update argument name
  • Use file streams instead of file paths
  • Remove unused error handling

This offers us a generic way to drill down the config values and return
only relevant sections if desired.
Since it's a `toml` file we can inherit from `TomlParser` and delegate
parsing the file to the parent class.
This name better reflects the style of a `pyproject.toml` file
This will be used to open config files to pass to config parsers
Using a file stream for the config parsers means we can separate
concerns more and have the parsers only responsible for parsing a file
stream, as opposed to opening and file and then parsing it.
We're not opening any files now in this parser so we can remove this
catch
@dbatten5 dbatten5 merged commit 6006c1b into main Oct 7, 2025
15 checks passed
@dbatten5 dbatten5 deleted the use-file-streams branch October 7, 2025 06:47
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.

2 participants