lincc-frameworks / lincc-frameworks/hyrax
Refactor function migration code into reusable utility
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 41
- Forks
- 7
- Avg merge
- 5d 1h
- Merged PRs (30d)
- 8
Description
In a [review comment](https://github.com/lincc-frameworks/hyrax/pull/607#discussion_r2737986455) it was noted that it could be valuable for the migration renaming of an existing function, in `src/hyrax/models/model_registry.py`, to be a reusable function that could be employed in similar cases in the future.
For context, we do hope that even this particular check can be deprecated in the future, as we intend to drop support entirely for `to_tensor`, and the same approach would apply to any other foundational interface changes. However, during the transition, it could be good to have and reuse the same migration utilities.
The code presently does a text replacement on the function, which is safe enough for these purposes (and for Python); for a fully general migration function we might want to use an AST or similar. (The current approach, for example, assumes that `inspect.getsource` does not emit whitespace between the function name and the opening parenthesis that follows.)
Contributor guide
No contributing guide indexed for this repository
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 src/hyrax/models/model_registry.py and inspect the existing function-renaming migration described in the linked review comment. Determine which parts can become a reusable migration utility while preserving the current to_tensor transition behavior. Done means the existing migration still works through the shared utility and the reusable interface is suitable for similar foundational API changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100