iamgreggarcia / codesherpa

A code interpreter and ChatGPT plugin.
MIT License
255 stars 34 forks source link

Multi language support #8

Closed iamgreggarcia closed 1 year ago

iamgreggarcia commented 1 year ago

Enhancements to CodeSherpa: Multi-language Support and Dockerfile Refactoring

Description:

This pull request introduces several significant changes to the CodeSherpa project. The main goal of these changes is to extend the support of the REPL environment to multiple languages including Python, C++, and Rust. Additionally, the Dockerfile has been refactored to use a base Ubuntu image instead of a Python-specific image, and to install the necessary compilers and interpreters for the supported languages.

Here are the key changes in detail:

  1. Multi-language Support: The project now supports executing code in Python, C++, and Rust. This is achieved by introducing a new Executor abstract base class and its subclasses for each supported language. These classes are responsible for executing code in the respective language.

  2. Dockerfile Refactoring: The Dockerfile has been refactored to start from a base Ubuntu image. It now installs Python, pip, g++, curl, make, and git. It also installs Rust using the official rustup installer. The Dockerfile now uses pip to install Python dependencies and pytest for testing.

  3. Testing: Unit tests have been added for the new Executor classes. These tests ensure that the executors can correctly execute code and handle errors in their respective languages.

  4. Makefile Updates: The Makefile has been updated to include commands for running tests both locally and in a Docker container.

  5. API Updates: The API has been updated to accept the programming language as a parameter. This allows clients to specify the language in which the code should be executed.

  6. Documentation Updates: The OpenAPI documentation and the AI plugin description have been updated to reflect the new multi-language support.

  7. Minor Changes: The .dockerignore file has been updated to no longer ignore the tests directory. The localserver/main.py file has been updated to use the new Executor classes for code execution.

Please review these changes and provide your feedback. If everything looks good, we can proceed with merging this pull request.

Checklist:

Type of changes:

Does this introduce a breaking change?

If yes, please describe the impact and migration path for existing applications: The API now requires a language parameter for code execution. Clients will need to be updated to provide this parameter.