-
Notifications
You must be signed in to change notification settings - Fork 7
Fix relative paths and imports to make code work as a package #23
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
Fix relative paths and imports to make code work as a package #23
Conversation
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 refactors the codebase to function as a proper Python package by converting absolute imports to relative imports and fixing path handling. This enables distribution via PyPi and allows users to run the package with python -m seclab-taskflow-agent.
- Converted absolute imports to relative imports across multiple modules
- Added dynamic log directory creation for package execution from any location
- Added
__main__.pyto enable module execution viapython -m
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| mcp_utils.py | Changed import from env_utils to relative import .env_utils |
| main.py | Updated all internal imports to relative imports and added dynamic log directory creation |
| agent.py | Changed import from capi to relative import .capi |
| main.py | Added entry point for module execution using runpy |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| import runpy | ||
|
|
||
| if __name__ == "__main__": | ||
| runpy.run_module("seclab_taskflow_agent.main", run_name="__main__") |
Copilot
AI
Oct 17, 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 module name 'seclab_taskflow_agent.main' is hardcoded and doesn't match the actual package structure. This should use a relative import or derive the module name dynamically to avoid breaking if the package is renamed.
| runpy.run_module("seclab_taskflow_agent.main", run_name="__main__") | |
| module_name = (__package__ + ".main") if __package__ else "main" | |
| runpy.run_module(module_name, run_name="__main__") |
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
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
release_tools/HOWTO.md
Outdated
| We need all the code to be in a separate directory to build it into a package, so we create a new dir and copy what is need for the build. | ||
| For pacakges, only underscores are a allowed as legal python idnetifiers and not dashes, so we need to rename the folder. |
Copilot
AI
Oct 17, 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.
Removed extra 'a' in 'are a allowed' - should be 'are allowed'.
| For pacakges, only underscores are a allowed as legal python idnetifiers and not dashes, so we need to rename the folder. | |
| For pacakges, only underscores are allowed as legal python idnetifiers and not dashes, so we need to rename the folder. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Closing this PR because it has been superseded by #41. |
For the code to work as a PyPi package, we need to fix relative imports and relative paths.
The init.py is added to make the code work as a module.
The main.py file will allow us to run the code with
python -m seclab-taskflow-agent -p assistant "how do modems work"