kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Rename compat.py to modules.py

Open rtibbles opened this issue 9 months ago • 6 comments

🙂 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__.py
  • kolibri/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.py no longer exists
  • [ ] kolibri/utils/modules.py contains the module_exists function with an accurate docstring
  • [ ] Imports in kolibri/plugins/utils/__init__.py and kolibri/utils/cli.py are 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] 🤖

rtibbles avatar Feb 16 '26 23:02 rtibbles

Hi @rtibbles please assign this to me

ketan0919 avatar Feb 17 '26 04:02 ketan0919

hi @rtibbles, can i work on this one?

sahibsiddiqui avatar Feb 17 '26 04:02 sahibsiddiqui

Hi @rtibbles , I’d like to contribute to this issue if it’s still available. Please let me know if I can take it.

deepakmarudi avatar Feb 17 '26 08:02 deepakmarudi

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!"

IslamHesham-Dev avatar Feb 17 '26 08:02 IslamHesham-Dev

Thanks all. Assigning @ketan0919.

MisRob avatar Feb 17 '26 10:02 MisRob

Fixed in #14336

rtibbles avatar Mar 06 '26 22:03 rtibbles