feature(config|run_modules): make default_config flexible#1301
Merged
Conversation
Whilst developing entry points for [AFMSlicer](https://github.com/AFM-SPM/AFMSlicer) I found that the current implementation of the `config.reconcile_config_args()` function was too restrictive. Try and use it in another package and it will load the `default_config.yaml` from TopoStats. This pull-request changes the functionality and adds the parameter `default_config` to the `config.reconcile_config.args()`. This is loaded via `get_data(package=topostats.__package__, resource="default_config.yaml")` prior to calling `reconcile_config_args()` (and so AFMSlicer will use `get_data(package=afmslicer.__package__, resource="default_config.yaml")`). All pre-commit and unit/regression tests pass.
Ensures `TopoStats.config` attribute is `deepcopy()` of the configuration passed into the `LoadScans` class.
SylviaWhittle
approved these changes
Feb 18, 2026
Collaborator
SylviaWhittle
left a comment
There was a problem hiding this comment.
I haven't tested this locally, but this reads correct, and I assume you've tested it for what you're using it for.
This is a good improvement to interoperability as per FAIR4RS too. :)
(I also just like modularity and elegance of this kind of addition)
Collaborator
Author
|
Thanks @SylviaWhittle, yes works with AFMSlicer and I can now load the correct configuration. Working out how to build on and extend functionality is interesting, there are a few other places (such as creating configuration files) where I've already made things more flexible (I broke that in doing so before getting it right!). It's well worth it though. |
Collaborator
Author
|
Weird the test fail under Python 3.10 on M$-Win again, I'll re-run once but if it fails will 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.
Whilst developing entry points for AFMSlicer I found that the current
implementation of the
config.reconcile_config_args()function was too restrictive. Try and use it in another packageand it will load the
default_config.yamlfrom TopoStats.This pull-request changes the functionality and adds the parameter
default_configto theconfig.reconcile_config.args(). This is loaded viaget_data(package=topostats.__package__, resource="default_config.yaml")prior to callingreconcile_config_args()(and so AFMSlicer will useget_data(package=afmslicer.__package__, resource="default_config.yaml")).All pre-commit and unit/regression tests pass.
Before submitting a Pull Request please check the following.