Skip to content

Instantly share code, notes, and snippets.

@Ezio-Sarthak
Last active August 22, 2021 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ezio-Sarthak/5c48f50e0694db25cea97f82ec640c3c to your computer and use it in GitHub Desktop.
Save Ezio-Sarthak/5c48f50e0694db25cea97f82ec640c3c to your computer and use it in GitHub Desktop.
GSoC'21 Work Product

Work Product: Google Summer of Code 2021 with Zulip

It has been the best summer I've ever had! I'm thankful to my mentors, my peers, Zulip, and Google for providing me an opportunity of getting involved in the community!

I feel fortunate enough that I had Neil Pilgrim and Preet Mishra as my mentors, not only due to their comprehensive and outstanding reviews but most importantly due to their unique ways of explaining an underlying logic. You have helped and supported me to become a better software developer and a passionate open-source contributor. Apart from that, I made several friends and had fun participating in discussions on CZO.

During the summer, I worked on Zulip Terminal, Zulip's official terminal client, to improve its user experience. The work revolved around introducing new features, resolving high-priority issues, and improving upon its codebase and test suite.

Project Description πŸ’‘

Title

Improve User Experience in Zulip Terminal.

Abstract

Zulip Terminal (zulip-term) is a TUI-based Zulip client that allows users to chat with each other right from their terminal window, with minimum possible tools. In this project, I shall focus mainly on improving the User experience for zulip-terminal. Currently, there are some features for which a user tends to switch to the Webapp counterpart. In addition to this, the goal shall be to fix up major issues in the issue tracker, improving the test suite, refactoring code, and adding new features. 1

Mentors ❀️

Repository πŸ“

zulip/zulip-terminal

Work Done πŸš€

Summary

What work got merged? πŸŽ‰ (Merged PRs)

The goal of this project was to show a user profile, with basic user information, from the users' list. This helps identify a person pretty easily by a simple search in the users' list. This project also helped us refactor how user data is handled in the model, and add descriptive TypedDicts for user info as obtained from Zulip API. Overall, it was a great learning experience where I got to know more about how Zulip API functions, various refactoring practices, and many more things.

This project was to add a section in MessageInfoView dedicated to topic links if a message's topic contains a link. There was some groundwork done prior to merging this, thanks to Sumanth V Rao who configured and restructured the Zulip API to improve topic_links endpoint (zulip/zulip#17124 is the relevant PR). I did this project before getting accepted into GSoC.

While the backend work continued, I worked on handling the UI aspects, model flow, and supporting backward compatibility. After the successful merge of the backend part, I added useful tests to ensure expected behavior. In addition to this, the project also added a "message modernization" logic, which ensures the unified handling of deprecated and modern message API responses. Overall, it was a great learning experience for me. I got to know more about backward compatibility and how can we ensure it in production.

In this project, there were mainly two goals: 1. To let a user see and scroll large messages; 2. To show raw markdown content for users not familiar with it. Previously, all the messages crossing the maximum terminal height weren't visible entirely. I worked on adding two popups added called FullRenderedMsgView and FullRawMsgView, which show rendered and raw message content respectively.

Prior commits to this project's PR also performed a migration of PopUpView from urwid.ListBox to urwid.Frame, which helped certain relevant PRs to show header and footer elements in a popup in addition to the body.

With this project, I worked on refactoring our test suite. The path prefixes are now extracted as MODULE variables so that their use is clean and handy throughout the module tests. I got to learn more about good variable naming practices, and also effectively splitting commits.

In this mini UI project, I worked on adding some basic styles for the footer in ZT. I extracted frequent footer use-cases (success, error, warning) to general report_* methods, which avoid explicit parameter declaration while calling set_footer_text().

This project was to show a presence status marker just before a Sender's name in a message box, so as to quickly see if that user is available or not. Although the actual implementation was rather straightforward, I learned a lot about how Zulip Terminal handles presence updates, updating messages, and event handlings. I also made use of recently added ui_mappings.py to extract UI parts there.

Here, I worked on adding support for stream+topic autocomplete in the application. I spent my time learning more about what are regexes and how I could extract and use meaningful information from a given prefix string. The project also ended up fixing a bug (generic autocompletes didn't work as expected for prefix strings containing whitespaces).

While this small side project started off with just a bugfix, it ended up in good styling support for katex/math text. I got introduced to what is a TDD approach, and how we could use it to safely add a feature. Although the PR was short, I explored HTML -> urwid markup logic in the application, understood how UI tests are added and came to know about xfails in pytest.

In this project, I worked on adding a Message Formatting Tips View (MarkdownHelpView), which is a helpful tool for beginners to Zulip/Zulip Terminal or markdown in general. I exploited the existing method soup2markup to convert raw -> urwid markups for the help menu.

Contributions to Docs πŸ“œ

What work is left? (Open PRs) πŸ“

This project adds support to download and open media in Zulip Terminal. I enjoyed the most working on this project! I learned a whole lot of things, starting from Data File handling in Python to cross-platform dependency support. Thanks to Preet Mishra for his prior work on media links and Zeeshan Equbal for his work on Platform handling, which immensely helped this project progress further.

This side project started with the intent to add a handy tool, followed by screen-grabbing module improvements. It helped me dig deeper into understanding the use-case and using resources provided by PyPI efficiently.

This project was about rendering spoilers in Zulip Terminal, another missing rendering that our end-users switch to the web app for. I worked on reviving the existing work of Preet Mishra and further refinement of tests. This is still a WIP and I'm planning to finish it soon.

This project is about validating emoji data as fetched from the server, on a regular basis, so that we are notified on CZO whenever CI checks fail. Through this project, I explored what CI and Github action are, and how we could use them to automate things! Later, my work with Github actions got simplified now that Zulip has its own Actions integration.

This project is about adding support of narrowing to PMs via PM links in the application. With this project, I deeply understood the flow of validation, switch, and handling of narrow links in the Zulip Terminal. While working on the project, I found a need for refactoring in the infrastructure of narrow links, and so went ahead opening a PR for the same:

  • Improve internal handling of narrow links: I worked on refactoring the flow of handling narrow links in the application. Previously, the validation and patching methods weren't explicit. This PR aims to separate independent aspects to their own methods.

This refactor project is about adding urwid types for general text markups throughout the application. As the discussion led to a specific area of work, I ended up filing an issue for the same: Testing tool for urwid types.

Post GSoC Work :octocat:

There are various high-priority issues and very good features that are still either a WIP or not yet have a PR in Zulip Terminal. As now I have a relatively fair knowledge of the codebase, I'll be working on some of the issues that in my opinion would be a great addition to ZT, or are one of my incomplete goals for GSoC. In the coming weeks, I will be working on adding support for multiple drafts, adding PM sub-view (similar to Topics view), and finishing my close-to-merge pull requests.

Closing Notes πŸ‘¨β€πŸŽ“

This may be the end of GSoC but actually, it is the start of a new journey at Zulip for me. GSoC provided me a perfect platform to get started contributing to Zulip and Open source in general, and I wish to learn more and grow more. Personally, it has always been a pleasure to help others and review their code. I have had the opportunity to review a couple of pull requests over the summer: Pull Requests reviewed by Sarthak Garg: zulip/zulip-terminal.

I would like to thank Zulip and GSoC for providing me an opportunity to learn and grow as a developer by working on some interesting issues and projects. I learned a lot of things which include how to work as a team and develop maintainable code. In nutshell, I was able to make good use of my summer break because of this opportunity. Contributing to Zulip has been the most exciting way to learn about software development. Moreover, it is always exciting to see your code being used in production πŸ˜„. I would continue contributing to the project and helping other new contributors getting started with Zulip and open-source to the best of my ability. At last, I'll recommend everyone reading this article to join the Zulip family and experience the definition of community growth πŸš€.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment