Skip to content

This is my solution to the BE coding challenge as part of Rank's interview process

Notifications You must be signed in to change notification settings

CharlRitter/span-ranking-coding-test

Repository files navigation

SPAN BE Coding Test


This is my solution to the Back-End coding challenge as part of SPAN's interview process

Table of Contents

Project Structure

.
├── Makefile
├── README.md
├── application
│   └── ranking_calculator.py
├── assets
│   ├── problem_statement_1.png
│   └── problem_statement_2.png
├── cli.py
├── dev-requirements.in
├── dev-requirements.txt
├── lib
│   └── constants.py
├── pyproject.toml
├── requirements.in
├── requirements.txt
├── results
├── scripts
│   └── test.sh
├── setup.py
├── test_input
│   └── example_input.txt
├── tests
│   ├── test_cli.py
│   └── test_ranking_calculator.py
└── version

How To Run The CLI

The CLI has 2 flags to specify input. -i, --input indicates manual input and -p path, --path path provides the path to the file to be used as input. The CLI also has 2 suppourting flags. -h, --help for help and -v, --version for the CLI's version.

There are 2 ways one can run this project

1. Compiled executale (preferred)

Note: Since this project should run on OSX, I will have included a OSX compatible executable file in the root folder already.

  1. Clone the repo
  2. Create a virtual environment
  3. Run make deps
  4. Run make compile
  5. In the root folder a new exe file should appear
  6. From the root folder the CLI can be started using the executale. PS. try ranking_calculator -h

2. Directly executing the CLI using

  1. Clone the repo
  2. Create a virtual environment
  3. Run make deps
  4. From the root folder the CLI can be started using python. PS. try python cli.py -h

Technologies Used

  • For the creation of the CLI, the argparse library was used.
  • For compiling the application into an executable file the pyinstaller library was used. The executale has to be regenerated on different operating systems, as it generates and executable file for that type of operating system.
  • For testing the pytest, coverage, mockito & parameterized libraries were used.
  • For code quality the pre-commit, black, flake8, isort, & pylint libraries were used.
  • For dependency management the pip-tools library was used.
  • Github actions were used to automate testing & linting

Future Expansions

Using the Github actions, it would've been useful to automate the compilation to an executable file as well, but since pyinstaller compiles the exectable to be compatible with the OS the user is using, the compiled executable file would only work on the OS of whatever Github runs their actions on (some light-weight Linux probably). Thus in future it would be great to find a library that can compile it into three executable files, one for the 3 most popular OS's, and have it auto compile as part of Github actions.

Installation Instructions

Before running the following commands, please ensure you have started a python 3.10 virtual environment.

Update requirements

make update

Installs dependencies

make deps

Problem Statement

page1 page2

Miscellaneous

Before running the following commands, please ensure you have started a python 3.10 virtual environment and run the make deps command.

Compiling into executale file

make compile

Running the tests

make test

Running the linting checks

make lint

About

This is my solution to the BE coding challenge as part of Rank's interview process

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published