Import config functions on demand
@cpaniaguam is already working on this.
Since Feb 14, 2025.
- #677 by @cpaniaguam — closed without merging
- Dominant language
- Python
- Stars
- 124
- Forks
- 24
- Avg merge
- 19h 32m
- Merged PRs (30d)
- 60
Description
> As we discussed, wrapping the config dicts in the functions solves the problem of `deepcopy`ing the configs (we might also have to fix it somewhere in `config.py`, but this approach is not exactly lazy because the functions with the content of the config dicts are still loaded in memory. I think the best of both worlds is to use dynamic imports for these functions. You don't even have to write this map here. All you need to do is:
>
> 1. Move all the config functions to another file
> 2. Dynamically import these functions using `importlib`:
>
> ```python
> config_func = importlib.import_module("name_of_file_with_functions", f"get_{model_name}_config")
> ```
>
> Then the functions are not loaded into memory until imported.
_Originally posted by @digicosmos86 in https://github.com/lnccbrown/HSSM/pull/655#discussion_r1956354549_
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.