-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Possible options to synchronize ASR in LFortran and LPython
A common solution to keep a library like libasr synchronized between multiple projects (LFortran and LPython) on GitHub is to use dedicated repository of libasr and then include it in the projects as a dependency or submodule.
Options
Option 1: Use Git Submodules
- In both
LFortranandLPython, addlibasras a submodule:
git submodule add libasr_github path/to/libasr- This will link both projects to the same version of
libasr, and updates tolibasrcan be pulled intoLPythonandLFortranby runninggit submodule update.
Option 2: Use Git Subtree
- Git Subtree allows to "merge" the library
libasrintoLFortranandLPythonbut without the dependency tracking of submodules. It simplifies some workflows but requires manual updates.
git subtree add --prefix=path/to/libasr libasr_github main --squashOption 3: Use a Package Manager
- If
libasrcan be packaged (e.g., as a C++ library using CMake), we can publish it to a package repository (such as GitHub Packages), and reference the version inLFortranandLPython.
Option 4: Automated Sync workflows
All the above approaches provide a solution where we pull out libasr.
This approach is a bit different where we keep libasr in both the projects as we have currently.
We can add automated CI workflows in Github Actions to the following tasks:
- Check on every commit to main branch
- If there is a patch in
libasrofLFortran, trigger an automated pull request toLPythonand vice-versa. If the pull request passes all the tests inLPython, then merge it automatically. - Apply the same to standalone
libasrlibrary on github.
This steps ensure that all the three projects(LPython, LFortran and libasr) are in sync (may be with some delay of an hour).
The main drawback of this approach is that there can be several cases of merge conflicts when simultaneous development is going on both the projects at the same time.
Option 5: MonoRepo
This is the easiest approach both for developers and maintainers. We can merge all the projects in the single repository and provide a flag so that we can build/test individual projects to save developers' time. While merging the pull request we can run the whole pipeline.
What do you think @certik is the best way to move forward with?