-
Notifications
You must be signed in to change notification settings - Fork 44
fix: Fixes Issue 89 with missing find_module #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
gentleman can you help me out prioritizing this fix? @lukasmasuch @raethlein @JanKalkan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes issue #89 by replacing deprecated find_module
calls with a new get_module
helper function and updates the minimum Python version requirement from 3.6 to 3.9.
- Introduces a new
get_module
helper function usingfind_spec
instead of the deprecatedfind_module
- Updates minimum Python version requirement from 3.6 to 3.9 in setup.py and README
- Adds integration test coverage for the
generate_docs
function
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/lazydocs/generation.py | Introduces get_module helper function and replaces deprecated find_module calls |
setup.py | Updates minimum Python version requirement from 3.6 to 3.9 |
README.md | Updates documentation to reflect new Python 3.9+ requirement |
tests/test_generation.py | Adds integration test for generate_docs function |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
def get_module(loader, module_name: str) -> Optional[Any]: | ||
spec = loader.find_spec(module_name) | ||
if spec is None: | ||
raise ImportError(f"Cannot find module {module_name}") |
Copilot
AI
Aug 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function may raise an AttributeError if spec.loader
is None. Consider adding a null check for spec.loader
before calling load_module
.
def get_module(loader, module_name: str) -> Optional[Any]: | |
spec = loader.find_spec(module_name) | |
if spec is None: | |
raise ImportError(f"Cannot find module {module_name}") | |
raise ImportError(f"Cannot find module {module_name}") | |
if spec.loader is None: | |
raise ImportError(f"Cannot load module {module_name}: spec.loader is None") |
Copilot uses AI. Check for mistakes.
spec = loader.find_spec(module_name) | ||
if spec is None: | ||
raise ImportError(f"Cannot find module {module_name}") | ||
return spec.loader.load_module(spec.name) |
Copilot
AI
Aug 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The load_module
method is deprecated. Consider using importlib.util.module_from_spec
and spec.loader.exec_module
pattern that's already used in the main code paths.
return spec.loader.load_module(spec.name) | |
module = importlib.util.module_from_spec(spec) | |
spec.loader.exec_module(module) | |
return module |
Copilot uses AI. Check for mistakes.
What kind of change does this PR introduce?
Description:
Fixes #89
Checklist: