Page MenuHomePhabricator

GSoC 2022 Proposal: Command-line interface (CLI) for Canasta
Closed, DeclinedPublic

Description

Profile Information

Name: Abhinav Sharma
IRC nickname on libera.chat IRC: Abhinav3
Web Profile: https://www.abhinav.engineer/
Resume: https://bit.ly/37BEJct
Location (country or state): Jaipur, Rajasthan, India
Time Zone: UTC+05:30
Typical working hours (include your timezone): 12 PM to 1 AM (UTC+05:30)
LinkedIn Handle: https://www.linkedin.com/in/abhinavsharma0/

Synopsis

Abstract

A command-line interface (CLI) is a text-based user interface (UI) used to run programs, manage computer files and interact with the computer. Command-line interfaces are also called command-line user interfaces, console user interfaces and character user interfaces.
Canasta CLI will be proven very helpful as it will offer users a concise and efficient mode of interacting with the OS, without requiring the overhead of GUI or set of instructions need to be followed.

There are multiple ways to design Canasta CLI using Node, Bash, Python and many more. But, I propose to create a CLI using Python, and we can also integrate Bash scripts in it.

Detailed Proposal

Canasta CLI can be created using Python.
Steps to follow:

  • Create a Virtual env
python -m venv canasta
  • Install libraries if not present (setuptools, argparse)
pip install -r requirements.txt
  • create a setup.py file: using this file, we can easily download, build, install upgrade, and uninstall Python packages

Sample code snippet:

from setuptools import find_packages, setup

setup(
    name="canasta",
    version="0.1",
    packages=find_packages(where="src"),
    package_dir={"": "src"},
    install_requires=[],
    ## Entry point for command line and function to be executed
    entry_points={
        'console_scripts': ['canasta=main:main'],
    }
)
  • create a src/ main.py file: this file will contain all the code needed to create a CLI.

Sample code snippet:

import os
import sys
import argparse

def main():
    # create a cli argument parser for dispaying date with optional argument
    parser = argparse.ArgumentParser(description='Welcome to Canasta CLI')

    # create a argument to Move into root directory
    parser.add_argument('-m', '--move', help='move into root directory', action='store_true')

    # create an argument to update docker container by stopping and reinstalling it
    parser.add_argument('-u', '--update', help='update docker container', action='store_true')

    args = parser.parse_args()

    if args.move:
        os.chdir('/')

    if args.update:
        os.system('docker rm -f $(docker ps -a -q)')
        os.system('docker rmi $(docker images -q)')
        os.system('docker build -t node:10.15.3-alpine .')
        os.system('docker run -it --rm -p 8080:8080 -v $(pwd):/usr/src/app/src/main.py -w /usr/src/app/src/main.py node:10.15.3-alpine node src/main.js')
    
    # if no argument is passed, display help
    if len(sys.argv) == 1:
        parser.print_help()

if __name__ == '__main__':
    main()

In the above code we created a CLI with two arguments
To use the CLI:
1. canasta -h or --help: To see the manual
2. canasta -m or --move: To go back to root of the directory
3. canasta -u or --update: To update the docker image by deleting and reinstalling it

  • Deploying as Micro-Service

If time allows create a kubernetes deployment for Canasta

Mentors

@JeffreyWang
@Yaron_Koren

Have you contacted your mentors already?
We had a conversation over GitHub and the Phabricator regarding what's next and how should we proceed.
https://phabricator.wikimedia.org/T301893#7771427
https://github.com/CanastaWiki/Canasta/issues/55#issuecomment-1087681369

Timeline

PeriodTask
4 April - 19 AprilApplication filling: Research on Project, Filling the application, creating draft proposal, taking inputs and finalizing the proposal
13 June - 02 JulyCommunity Bonding Period: Understanding product, study about existing tools. Study about CLI designing with Python and integrating Canasta with CLI with basic commands needed (such as, moving to root directory and change it)
04 July - 30 JulyDesigning CLI features which will extend the functionality of Docker containers, like creating Docker Container, updating the container by deleting and reinstalling it
01 August - 13 AugustIn next phase, designing of backup commands for Canasta CLI, such as Restoring wiki from backup and Backing up an installation's database and uploaded files
15 August - 03 SeptemberStart researching on Improving support for an installation within Kubernetes, and improved support over Docker
05 September - 01 OctoberStart creating Deployment files, Ingress rules, and other Secrets needed for deploying Canasta as a Microservice into new or pre-existing Cluster
03 October - 29 OctoberMicrosoft Azure and AWS support for Canasta, creating GitHub Actions Workflow for automated deployment as Multi-cloud support and CLI documentation support

Deliverables

  • A well mantained GitHub Repository with feature branches.
  • Use-cases and detailed study report.
  • Well elaborative README file with How-To use instruction set
  • Documentation on Canasta CLI other than README in .pdf or .docx
  • Weekly report on progress made
  • Blog post

Participation

  • Weekly Report: I will be presenting weekly report on progress made on the project.
  • Blog Post: Research and the knowledge will be shared and published on Canasta.
  • Email: I will be active and respond ASAP to the emails.
  • IRC: I will be available on the IRC at my proposed time, that is, 12 PM to 1 AM (UTC+05:30)
  • Phabricator: I will be actively commenting over the threads and tasks on Phabricator.

About Me

Tell us about a few:
Your education (completed or in progress):
Currently in Pre-final year of Bachelors in Technology, Computer Science field from Jaipur Engineering College and Research Centre. Graduation Year: 2023
How did you hear about this program?
I heared about Google Summer of Code (GSoC) from various social platforms like, LinkedIn, Twitter. GSoC informations are also circulated on various tech communities on Discord, Telegram, and WhatsApp. I also interacted with previous GSoC participants and was fascinated from their experience. It is the primary reason I am eager to participate.
Will you have any other time commitments, such as school work, another job, planned vacation, etc, during the duration of the program?
I have college starts in the first week of June. But, I am confident that I can commit enough time for the project as there are no examinations.
We advise all candidates eligible for Google Summer of Code and Outreachy to apply for both programs. Are you planning to apply to both programs and, if so, with what organization(s)?
I am eligible for Google Summer of Code and Outreachy to apply for both programs. I want to apply with our organization Wikimedia in both. As it is first time I am applying and I researched well about the Canasta, so I am confident on this project very much.
What does making this project happen mean to you?
This project is full of learning and polishing my tech stack. I have been learning and working in field of Python, Kubernetes and Dockerization from a year. Creating a complete CLI and a Microservice deployment of Canasta will brush up my knowledge and gives me an opportunity to prove my skills globally. Creating something which will be used globally gives a sense of proud and belongingness. If I got selected, this project will be my dream project as I will work on what I have learnt past . Hence, making this project happen means a lot to me and I will ensure that it will happen definitely, whether or not I get selected.

Past Experience

  • Please add links to any feature or bug fix you have written for a Wikimedia project during the application phase.

I cannot deny the fact that the GSoC had a very competitive environment. Contributors here are very amazing and had contributed a much before. I walked through all the issues, but one or other had either fixed it or on it. I got a chance to fix one issue, mentioned here:
https://github.com/CanastaWiki/Canasta/pull/65
I had also suggested a change in one issue, once approved and acknowledged by mantainers, I can move ahead:
https://github.com/CanastaWiki/Canasta/issues/55

  • Describe any relevant projects that you've worked on previously and what knowledge you gained from working on them.

I had a good working experience with various DevOps related organizations.
1.I had set up a completely automated Blockchain based Microservice architecture using helm and GitLab CI for Zeeve. My work is preserved as an intellectual property of the organization.
2.I had also worked with Sirpi, which is a DataScience company where I dockerrized the application and created kuberneted deployment of various projects.
Sample: https://github.com/abhi-bhatra/React-Kubernetes-Server/tree/main/Kubernetes-Scripts//
3.Currently, I am working on setting up Rancher as a Microservice to the existing cluster.
Sample: https://github.com/abhi-bhatra/Rancher-Demo
4.I also worked with Windowscope, and created many automation scripts for automated backups of complete Repository along with every branch (active or stale), zip it and upload it to AWS s3 bucket.
Sample: https://github.com/abhi-bhatra/automating_backup_to_s3 //
5.I had also demonstrated a quality documentation on various projects.

Describe any open source projects you have contributed to as a user and contributor (include links).

Any Other Info

Although, I might be beginner in Open-Source, but I carry a good amount of knowledge and technologies needed for this project. I have been practising Kubernetes, DevOps and Cloud from a year.

I researched on various documents and created a demo CLI, which can be found at: https://github.com/abhi-bhatra/Canasta-cli-demo

Event Timeline

@JeffreyWang @Yaron_Koren this is the first draft of my GSoC proposal. Please comment.

Would you be interested if we decided to write the CLI in Rust rather than Python?

Can you comment on the advantages and disadvantages of choosing to write in Rust versus Python? Please provide advantages and disadvantages for both.

Hi @JeffreyWang

As a DevOps Practitioner, I have done few projects on RUST for R&D purposes. I am interested to write CLI in Rust as well, under the guidance.
I have seen world's top CLIs are created using languages like Python, Rust, Go, JS or C. As you said, I am jotting down some pros and cons on writing CLI with the above said languages.

RustPython
Efficient and Effective CodingIn Rust, there are many complex features which makes it more challenging and time-consuming to implement. (Logic building will be complex)Python is easy to implement, its simple feature makes it easier to build logics.
PerformanceRust offers best performance, around 10x faster than PythonPython is slower in comparison
DocumentationBoth Rust and Python offers rich documentation support. Yet, it’s a bit geared towards more technically experienced users and can be a little complex compared to Python.Both Rust and Python offers rich documentation support
Memory ManagementRust ensures proper memory management from get-go by enforcing checks for memory leaks and irregular memory behaviorPython has garbage-collector
Library SupportRust has rapidly growing ecosystem, but Python has more diverse optionsPython is extensible due to vast number of libraries, frameworks, software, and services
Use-Casessystem development, embedded integrations, game engine development, file systems, and VRweb and backend developments, DevOps (Scripting), scientific computing, enterprise applications

In Conclusion:
Rust will be the more attractive option if speed and safety are our considerations. While Python will be attractive option if versatility coupled with user-friendliness are our considerations.

As the GSoC deadline is soon approaching in less than 24 hours (April 19, 2022, 18:00 UTC), please ensure that the information in your proposal on Phabricator is complete and you have already submitted it on the Google's program website in the recommended format. When you have done so, please move your proposal here on the Phabricator workboard https://phabricator.wikimedia.org/project/board/5716/ from "Proposals in Progress" to the "Proposals Submitted' column by simply dragging it. Let us know if you have any questions.

Gopavasanth subscribed.

@Abhinavsharma We are sorry to say that we could not allocate a slot for you this time. Please do not consider the rejection to be an assessment of your proposal. We received over 75 quality applications, and we could only accept 10 students. We were not able to give all applicants a slot that would have deserved one, and these were some very tough decisions to make. Please know that you are still a valued member of our community and we by no means want to exclude you. Many students who we did not accept in 2021 have become Wikimedia maintainers, contractors and even GSoC students and mentors this year!

Your ideas and contributions to our projects are still welcome! As a next step, you could consider finishing up any pending pull requests or inform us that someone has to take them over. Here is the recommended place for you to get started as a newcomer: https://www.mediawiki.org/wiki/New_Developers.

If you would still be eligible for GSoC next year, we look forward to your participation