Skip to content

tedtheman/photo-console-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Photo Console Application

A python implementation of the Photo Console Application project.

Overview

The application is written in Python version 3 and is deployed with pipenv, which combines package management and virtual environments. It has a rich set of options for choosing one or more albums, an interactive mode, row filtering and output formatting.

The code was rigoriously analyzed and tested using pylint and pytest, respectively.

  • 100% test coverage.
  • Mocking is utilized to cover all code paths.
  • Lint is used to ensure best PEP8 practices for code complexity, structure and style.
  • By using the suggested pytest options, a nicely formatted HTML report is created. See htmlcov/index.html. The starting page contains a summary with file links for drilling down.

Getting Started

Install the following if not already:

Prerequistes

  • git
  • Python 3
  • pipenv

Dependencies - handled automatically by pipenv

  • requests # for accessing json photo album online
  • prettytable # for making tablular formatted console output
  • pytest # for unit and functional automated tests
  • pytest-cov # for test coverage data collection and reporting
  • pylint # for code complexity, structure and style analysis

Setup

  • pip install pipenv
  • pipenv --python 3.8 # this creates a virtual python 3.8 environment

Installation

  1. git clone https://github.com/tedtheman/photo-console-app.git
  2. cd photo-console-app
  3. pipenv shell # this activates the virtual environment
  4. pipenv install # this installs the dependencies

Running the tests - with coverage collection and reporting

  • pytest -v --cov --cov-report=html

Running lint - on both application and test code

  • python -m pylint photos.py
  • python -m pylint test_photos.py

Usage - use -h/--help

  • python photos.py -h
  • python photos.py --help

Running the application - examples

  • python photos.py 1
  • python photos.py 2 -n 10
  • python photos.py 3 -n 10 --pretty
  • python photos.py 4 5 6 --pretty --rows --grep qui
  • python photos.py 7 -i

'pipenv run' alternative to 'pipenv shell'

Instead of entering shell mode, commands can be run via 'pipenv run <command ...>'. One downside of using shell mode is that up/down arrow keys do not display command history as command shells typically do.

Examples using run:

  • pipenv run python photos.py ...
  • pipenv run pytest -v --cov --cov-report=html

About

Photo console app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages