Currently, in order to create a repository object for a repo a given language, you have to import and instantiate a different object for each language. For example:
from plum.environments.py_repo import PythonRepository
from plum.environments.js_repo import JavascriptRepository
from plum.actions.js_actions import JavascriptActions
from plum.actions.py_actions import PythonActions
if language == "python":
repo = PythonRepository(base_path, repo_folder_name)
repo.setup(cleanup=False)
actions = PythonActions(repo)
elif language in ("javascript", "typescript"):
repo = JavascriptRepository(base_path, repo_folder_name, language=language)
repo.setup(install_reqs=True, cleanup=False)
actions = JavascriptActions(repo)
Update the code to instead be:
from plum.environments import Repository
from plum.actions import Actions
repo = Repository(base_path, repo_folder_name, language)
actions = Actions(repo)
This will involve adding the Repository and Actions classes to the init.py files in the environment and actions directories respectively. It will also involve making the language attribute a required input to the Repository object, and changing the init function to call and create the child correct class given the language.
Do you think we could just make a factory method instead? Because otherwise since PythonRepository etc inherits from Repository wouldn't we either need to make a new base class or deal with circular imports?
Currently, in order to create a repository object for a repo a given language, you have to import and instantiate a different object for each language. For example:
Update the code to instead be:
This will involve adding the Repository and Actions classes to the init.py files in the environment and actions directories respectively. It will also involve making the language attribute a required input to the Repository object, and changing the init function to call and create the child correct class given the language.