DEV Community

Andrii Sych
Andrii Sych

Posted on

Fast-forward and three-way merges

While working on my project Infusion:
https://github.com/SychAndrii/infusion

I decided to implement 2 new features - streaming responses from LLM in real time and usage of appropriate exit codes upon program completion. However, instead of creating conventional pull requests to integrate changes into main branch, I was tasked to do the merges locally in my repo, and then push results of the merges to the remote repo.

The first issue was to implement exit codes:
https://github.com/SychAndrii/infusion/issues/34

Closed with merge commit:
https://github.com/SychAndrii/infusion/commit/b01f493a8eb3c86aad00760f41f8adf0b93b231e

This task was pretty easy to implement since python provides you with a sys package to return status codes. I have decided to have 4 error status codes for my program:

0 - Program ended successfully.
1 - Invalid options provided.
2 - Invalid files provided.
3 - Unknown error.

On top of adding status codes, I have also refactored the code to be more intuitive with use of more functions.

My second issue was to implement streaming:
https://github.com/SychAndrii/infusion/issues/33

Closed with merge commit:
https://github.com/SychAndrii/infusion/commit/b01f493a8eb3c86aad00760f41f8adf0b93b231e

This task was more difficult to do because of LangChain library I am using for my project. This library is relatively new, so documentation for streaming with astream function is very unintuitive and difficult to understand.

I have always hated python and will keep doing it for the rest of my life. I tried to become more comfortable using it with this project, but after languages like C#, TypeScript, or Kotlin - I just can't take Python seriously.

Top comments (0)