Rename compat.py to modules.py
🙂 Looking for an issue? Welcome! This issue is open for contribution. If this is the first time you’re requesting an issue, please:
- Read Contributing guidelines carefully. Pay extra attention to Using generative AI. Pull requests and comments that don’t follow the guidelines won’t be answered.
- Confirm that you’ve read the guidelines in your comment.
Overview
kolibri/utils/compat.py is named "compat" with a docstring "Compatibility layer for Python 2+3", but its only function (module_exists) has nothing to do with Python 2 compatibility. The module name is misleading.
Complexity: Low
Target branch: release-v0.19.x
Context
The module contains a single function module_exists(module_path) that uses importlib.util.find_spec to check if a module exists without loading it. It's imported in two places:
kolibri/plugins/utils/__init__.pykolibri/utils/cli.py
The Change
Rename kolibri/utils/compat.py to kolibri/utils/modules.py, update the docstring, and update the two import sites in kolibri/plugins/utils/__init__.py and kolibri/utils/cli.py.
Acceptance Criteria
- [ ]
kolibri/utils/compat.pyno longer exists - [ ]
kolibri/utils/modules.pycontains themodule_existsfunction with an accurate docstring - [ ] Imports in
kolibri/plugins/utils/__init__.pyandkolibri/utils/cli.pyare updated - [ ] No other changes to affected files
- [ ] All existing tests pass
🤖 This issue was written with AI assistance, under supervision, review and final edits by [@rtibbles] 🤖
Hi @rtibbles please assign this to me
hi @rtibbles, can i work on this one?
Hi @rtibbles , I’d like to contribute to this issue if it’s still available. Please let me know if I can take it.
Hi @rtibbles! I have successfully set up my local development environment on Ubuntu and verified it by running kolibri manage test. I’m interested in helping with the backend tech debt. May I be assigned to this issue to rename compat.py and update the corresponding imports? Thank you!"
Thanks all. Assigning @ketan0919.
Fixed in #14336