Project-MONAI / Project-MONAI/MONAI
Adding syntax for the json config files to actually merge, not override, entries
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.7k
- Forks
- 1.6k
- Avg merge
- 5d 1h
- Merged PRs (30d)
- 20
Description
I would like to see syntax for the json config files to actually merge, not override, entries.
Like to be able to just add a single import to the import list rather than overriding the whole list, or add a handler to the list of handlers via additional config .json.
Such an option would help a lot.
Describe the solution you'd like
I propose the following syntax:
Instead of having to override the whole list, e.g:
inference.json:
"imports": [
"$import numpy",
],
inference_trt.json:
"imports": [
"$import numpy",
"$from monai.networks import trt_compile"
],
let's allow :
inference_trt.json:
"+imports": [
"$from monai.networks import trt_compile"
],
Processing would be : let's add an extra merge pass after the 'override' step, where config entries are overridden by .update().
With '+' key prefix, both the original 'imports' and '+imports' entries will be in the dict.
Additional pass would find all the '+*' entries and perform merge of '+id" key entry into corresponding 'id' key.
Dictionaries will be update()'d, lists append()'ed, error otherwise.
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.
Research direction
Start by locating the JSON configuration override processing and any existing tests for configuration merging; the issue does not name specific files or entry points. Define done around the proposed +key syntax: dictionaries update, lists append, and unsupported value types report an error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100