Rehome `_numpy_allclose` so it can be decorated
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 150
- Forks
- 23
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 2
Description
I would like to decorate the function _numpy_allclose() with _manage_log_level_via_verbosity as a standard & consistent way to manage the output of the log messages there with overriding by the verbose kwarg.
But as-is this cannot be done because _numpy_isclose() lives in the functions module & importing the decorator would lead to a circular dependency on imports, as per the comment I added there:
https://github.com/NCAS-CMS/cf-python/blob/7fed0abf184093024eb35d17036a08dc812c8f47/cf/functions.py#L1067-L1070
We tentatively agreed we should move the function to another module. It is internal so the location is not user-facing but we should try to collect it into the most sensible module as a new home.
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 in functions.py around the linked comment at lines 1067–1070 and trace _numpy_allclose(), _numpy_isclose(), and _manage_log_level_via_verbosity. Identify a module that avoids the circular import, move the internal function there, and verify that the decorator can be applied without breaking imports or existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100