Skip to content

Conversation

@tristan-f-r
Copy link
Collaborator

@tristan-f-r tristan-f-r commented Jun 25, 2025

Closes #299. I did want to keep this separate from #228 so that way those details didn't get lost, but this does the proper work of using structural parsing on the config, throwing useful errors on missing keys, wrongly-written keys, default paramaters, and with proper input validation and casting.

This doesn't clean up the parsing done in #228, but it lays the ground for cleaner configuration parsing.

I've also made some issues for suggestions for the configuration format #297 #298 #299 #309.
For users, this affects error messages: Now, we get good error messages for missing keys and too many keys, or improperly formatted values.

Note

The breaking change indicator in the PR header (!) is present because this will cause the config to raise an error if there are too many keys present inside any one of the objects (except for the runs... object). This also removes reconstruction_settings -> run.

@tristan-f-r tristan-f-r marked this pull request as draft June 25, 2025 20:51
@tristan-f-r tristan-f-r marked this pull request as draft June 25, 2025 20:51
@tristan-f-r
Copy link
Collaborator Author

It turns out that we had a good chunk of unspecified defaults in the config that are now being heavily caught.

@tristan-f-r tristan-f-r marked this pull request as ready for review June 25, 2025 21:52
@tristan-f-r tristan-f-r added the refactor Changes that don't actually improve anything except for code quality. label Jun 25, 2025
@tristan-f-r tristan-f-r changed the title refactor: config rework refactor: config parsing Jul 3, 2025
Copy link
Contributor

@annaritz annaritz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: rename raw_config to config_specs. Keep config.py as named for now, but a later refactor might be in order.

@agitter if you can take a look at this and give some comments, that would be great!

@tristan-f-r tristan-f-r added the P-high This is a blocker for many PRs/issues/features label Jul 24, 2025
@read-the-docs-community
Copy link

read-the-docs-community bot commented Jul 25, 2025

Documentation build overview

📚 spras | 🛠️ build #29005075 (e82eddf) | 🔍 preview

Files changed

Comparing with latest (32a0424...e82eddf)

Show files (3) | 3 modified | 0 added | 0 deleted
File Status
genindex.html 📝 modified
fordevs/modules.html 📝 modified
fordevs/spras.html 📝 modified

Copy link
Collaborator

@agitter agitter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The additional comments are helpful for me. I don't have any remaining major concerns. I am not sure how to test this beyond the test cases we have.

Neha, do you want to do more review before we merge?

@ntalluri
Copy link
Collaborator

I’ll do another review before merging.

@agitter
Copy link
Collaborator

agitter commented Jul 27, 2025

I’ll do another review before merging.

We could also discuss this and the follow up PRs at our Monday meeting if necessary

Co-authored-by: Neha Talluri <78840540+ntalluri@users.noreply.github.com>
Copy link
Collaborator

@ntalluri ntalluri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agitter Tristan addressed all of my remaining questions. This is ready to merge, but we should hold off until we look over the other PRs today in case we decide to wait on merging.

@tristan-f-r
Copy link
Collaborator Author

tristan-f-r commented Jul 28, 2025

(Is that to avoid merge conflicts?)

@ntalluri
Copy link
Collaborator

I have a feeling we’ll end up merging it later today, but it would be helpful to first have a conversation about all the PRs that depend on this one. There may be a reason not to merge it yet, though nothing comes to mind right now.

@tristan-f-r
Copy link
Collaborator Author

I think that's fine to merge then? I want to split off an independent chunk of #329 which depends on this PR that should lighten the diff on #329 a little (about 13 lines of actual code with a 1k line artifact), and begin writing some config documentation using this PR.

@tristan-f-r
Copy link
Collaborator Author

tristan-f-r commented Jul 28, 2025

Actually, I'll merge upstream first. (done, pre-commit passed 👍)

@tristan-f-r tristan-f-r mentioned this pull request Jul 28, 2025
2 tasks
@tristan-f-r
Copy link
Collaborator Author

I want to split off an independent chunk of #329 which depends on this PR that should lighten the diff on #329 a little (about 13 lines of actual code with a 1k line artifact),

#358.

Copy link
Collaborator

@agitter agitter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be helpful to first have a conversation about all the PRs that depend on this one

That was to understand the dependent changes and how much further restructuring was coming and what new maintenance burden, if any, would be introduced.

@agitter agitter merged commit a17865c into main Aug 1, 2025
20 checks passed
@agitter agitter deleted the config-pydantic branch August 1, 2025 15:05
@agitter agitter mentioned this pull request Aug 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P-high This is a blocker for many PRs/issues/features refactor Changes that don't actually improve anything except for code quality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make the config file parsing robust to missing required fields

5 participants