MetOffice / MetOffice/CMEW

Pull duplicated functions into a common directory

Open
#368 1 comment 0 reactions 0 assignees View on GitHub
technical debt
Dominant language
Python
Stars
5
Forks
3
Avg merge
5d 6h
Merged PRs (30d)
8

Description

As mentioned in this comment:
https://github.com/MetOffice/CMEW/issues/130#issuecomment-3861539221

The functions
- `write_recipe` in `CMEW/app/configure_for/bin/update_recipe_file.py` and
- `write_dict_to_yaml` in `CMEW/app/add_datasets/bin/add_datasets_to_share.py`
are actually the same function (one with a more generic name) and should be pulled into a common directory.

`CMEW/lib/python/` automatically gets added to PYTHONPATH when the workflow is run, so I initially experimented with writing `write_recipe` into `CMEW/lib/python/common.py`. The changes to unit tests (mostly the ability to run them locally) made this into a larger piece of work than anticipated, so I'm writing this as a separate issue.

Contributor guide

Open the contributing guide

Research direction

Start with write_recipe in CMEW/app/configure_for/bin/update_recipe_file.py and write_dict_to_yaml in CMEW/app/add_datasets/bin/add_datasets_to_share.py, then inspect CMEW/lib/python/common.py as the proposed shared location. Review the unit-test changes needed for local execution. Done means both callers use one common implementation and the unit tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.