fix: Rename, extract checker into a separate script
This commit is contained in:
parent
263ecb9149
commit
f27dc0c91a
2 changed files with 20 additions and 21 deletions
20
cognee/tasks/code/get_local_dependencies_checker.py
Normal file
20
cognee/tasks/code/get_local_dependencies_checker.py
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
import argparse
|
||||||
|
import asyncio
|
||||||
|
from cognee.tasks.repo_processor.get_local_dependencies import get_local_script_dependencies
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
parser = argparse.ArgumentParser(description="Get local script dependencies.")
|
||||||
|
|
||||||
|
# Suggested path: .../cognee/examples/python/simple_example.py
|
||||||
|
parser.add_argument("script_path", type=str, help="Absolute path to the Python script file")
|
||||||
|
|
||||||
|
# Suggested path: .../cognee
|
||||||
|
parser.add_argument("repo_path", type=str, help="Absolute path to the repository root")
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
dependencies = asyncio.run(get_local_script_dependencies(args.script_path, args.repo_path))
|
||||||
|
|
||||||
|
print("Dependencies:")
|
||||||
|
for dependency in dependencies:
|
||||||
|
print(dependency)
|
||||||
|
|
@ -124,24 +124,3 @@ async def get_local_script_dependencies(script_path: str, repo_path: Optional[st
|
||||||
dependencies = await _extract_dependencies(script_path)
|
dependencies = await _extract_dependencies(script_path)
|
||||||
|
|
||||||
return [path for path in dependencies if path.startswith(str(repo_path))]
|
return [path for path in dependencies if path.startswith(str(repo_path))]
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
parser = argparse.ArgumentParser(description="Get local script dependencies.")
|
|
||||||
|
|
||||||
# Suggested path: .../cognee/examples/python/simple_example.py
|
|
||||||
parser.add_argument("script_path", type=str, help="Absolute path to the Python script file")
|
|
||||||
|
|
||||||
# Suggested path: .../cognee
|
|
||||||
parser.add_argument("repo_path", type=str, help="Absolute path to the repository root")
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
script_path = args.script_path
|
|
||||||
repo_path = args.repo_path
|
|
||||||
|
|
||||||
dependencies = asyncio.run(get_local_script_dependencies(script_path, repo_path))
|
|
||||||
|
|
||||||
print("Dependencies:")
|
|
||||||
for dependency in dependencies:
|
|
||||||
print(dependency)
|
|
||||||
Loading…
Add table
Reference in a new issue