Retrieve the 10 most popular package in the debian release.
I spent ~ 4 hours understanding the assignment, writing the code, unittests and validate coding styled
Step I took to complete the assignement:
- First undertand the Content file
- Plan a script to extract the desired data
- Writing the script:
- parse the arg to get the architecture from the runtime parameter
- download the content file
- unzip the file
- read line by line the extracted file
- apply the string manipulation to extract the packages on the line
- store number of appearance in a dictionary
- output the 10 first most present packages
I used poetry to install my depedencies
poetry install
you can also only use pip
pip install requests pytest prospector isort
To retrieve the 10 most popular package for arm64 using poetry
poetry run package_statistic.py arm64
Or
chmod +x package_statistic.py
./package_statistic.py arm64
poetry run pytest package_statistic_test.py
Or
pytest package_statistic_test.py
I use the tool called prospector
and isort
prospector --strictness high
isort package_statistic.py package_statistic_test.py