Skip to content

feature(config|run_modules): make default_config flexible#1301

Merged
ns-rse merged 2 commits intomainfrom
ns-rse/reconcile-config-flexible-default-args
Feb 18, 2026
Merged

feature(config|run_modules): make default_config flexible#1301
ns-rse merged 2 commits intomainfrom
ns-rse/reconcile-config-flexible-default-args

Conversation

@ns-rse
Copy link
Collaborator

@ns-rse ns-rse commented Feb 17, 2026

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 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.

Before submitting a Pull Request please check the following.

  • Existing tests pass.
  • Pre-commit checks pass.

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.
@ns-rse ns-rse added the enhancement New feature or request label Feb 17, 2026
Ensures `TopoStats.config` attribute is `deepcopy()` of the configuration passed into the `LoadScans` class.
Copy link
Collaborator

@SylviaWhittle SylviaWhittle left a comment

Choose a reason for hiding this comment

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

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)

@ns-rse
Copy link
Collaborator Author

ns-rse commented Feb 18, 2026

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.

@ns-rse
Copy link
Collaborator Author

ns-rse commented Feb 18, 2026

Weird the test fail under Python 3.10 on M$-Win again, I'll re-run once but if it fails will merge.

@ns-rse ns-rse merged commit e268c37 into main Feb 18, 2026
12 of 13 checks passed
@ns-rse ns-rse deleted the ns-rse/reconcile-config-flexible-default-args branch February 18, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants