Skip to content

Conversation

@barnabasdomozi
Copy link
Collaborator

This PR implements the Python plugin for CodeCompass.

Plugin components:

Parser:

  • The main parser component is pyparser written in Python, uses the Jedi static analysis library. Moreover, pyparser also parses the Python AST in order to achieve better results.
  • During parsing, the pyparser module gets loaded using the Python C API
  • The nodes are inserted to a database table named PYName

Service:

  • PythonService implements most Language Service functionality with a few missing
  • PythonDiagram class to generate the following diagrams: function call, class overview, usage, module dependency diagram.

WebGUI:

  • It mainly targets the legacy WebGUI, however Info Tree functionality works fine in the new WebGUI

Tests:

  • Implemented test for the Parser and Service components.

Documentation:

  • Added documentation to doc/pythonplugin.md.

The missing part is the diagrams in the new WebGUI, however the diagrams component file needs some refactoring to use the new language-service instead of CppService (similarly to #759).
I think we should implement that in a separate PR.

@barnabasdomozi barnabasdomozi added Kind: Enhancement 🌟 Plugin: Python Issues related to the parsing and presentation of Python projects. labels Feb 27, 2025
@mcserep
Copy link
Collaborator

mcserep commented Mar 4, 2025

@wbqpk3 Nice and large 😅 work, I will try to find some time to review it.

Meanwhile please rebase it to master, as some used GitHub Actions had to be updated for the CI to run. So we can see whether the CI passes or not.

@barnabasdomozi
Copy link
Collaborator Author

@mcserep Rebased to master.

@mcserep mcserep requested review from Copilot and mcserep April 8, 2025 04:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 40 out of 46 changed files in this pull request and generated 5 comments.

Files not reviewed (6)
  • Config.cmake: Language not supported
  • plugins/python/CMakeLists.txt: Language not supported
  • plugins/python/model/CMakeLists.txt: Language not supported
  • plugins/python/parser/.gitignore: Language not supported
  • plugins/python/parser/CMakeLists.txt: Language not supported
  • plugins/python/parser/requirements.txt: Language not supported

@mcserep
Copy link
Collaborator

mcserep commented Apr 8, 2025

Copilot reviewed 40 out of 46 changed files in this pull request and generated 5 comments.

Files not reviewed (6)

@wbqpk3 I just tried out this Copilot-based review feature of GitHub. The suggestions maybe worth a check, but feel free to ignore them in case they look unimportant.

@mcserep
Copy link
Collaborator

mcserep commented Apr 8, 2025

@wbqpk3 The CI fails for Ubuntu 20.04. While we should drop support for Ubuntu 20.04, it should still be checked why the build fails there.

[ 84%] Building CXX object plugins/python/test/CMakeFiles/pythonservicetest.dir/src/pythonservicetest.cpp.o
In file included from /home/runner/work/CodeCompass/CodeCompass/plugins/python/service/include/service/pythonservice.h:15,
from /home/runner/work/CodeCompass/CodeCompass/plugins/python/test/src/pythonservicetest.cpp:4:
/home/runner/cc-build/service/language/gen-cpp/LanguageService.h:10:10: fatal error: thrift/TDispatchProcessor.h: No such file or directory
10 | #include <thrift/TDispatchProcessor.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [plugins/python/test/CMakeFiles/pythonservicetest.dir/build.make:93: plugins/python/test/CMakeFiles/pythonservicetest.dir/src/pythonservicetest.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:3021: plugins/python/test/CMakeFiles/pythonservicetest.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

@mcserep
Copy link
Collaborator

mcserep commented Apr 8, 2025

@wbqpk3 The CI fails for Ubuntu 20.04. While we should drop support for Ubuntu 20.04, it should still be checked why the build fails there.

UPDATE: CI jobs for Ubuntu 20.04 already started to skip, due to image unavailability. I have disabled the CI build for Ubuntu 20.04 in b9e6733, and added an issue #789 to deprecate it completely.

Fixing this CI fail is not required.

@barnabasdomozi
Copy link
Collaborator Author

@mcserep

Rebased this patch to master.
I also reviewed the AI's suggestions and there was actually a good finding.
It's now fixed in commit: 4ddb215

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Kind: Enhancement 🌟 Plugin: Python Issues related to the parsing and presentation of Python projects.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants