Skip to content

Possible options to synchronize ASR in LFortran and LPython #15

@kp992

Description

@kp992

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 LFortran and LPython, add libasr as a submodule:
git submodule add libasr_github path/to/libasr
  • This will link both projects to the same version of libasr, and updates to libasr can be pulled into LPython and LFortran by running git submodule update.

Option 2: Use Git Subtree

  • Git Subtree allows to "merge" the library libasr into LFortran and LPython but without the dependency tracking of submodules. It simplifies some workflows but requires manual updates.
git subtree add --prefix=path/to/libasr libasr_github main --squash

Option 3: Use a Package Manager

  • If libasr can 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 in LFortran and LPython.

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 libasr of LFortran, trigger an automated pull request to LPython and vice-versa. If the pull request passes all the tests in LPython, then merge it automatically.
  • Apply the same to standalone libasr library 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions