Giter Site home page Giter Site logo

toyapp's Introduction

toyapp

PyPI Docker Image Size (tag)

Abstract

Experiment with cookiecutter and docker to create a robust python tool that can be run directly in a container.

This toy project introduces the following concepts:

  • Creating python packages from a cookiecutter template
  • Basic elements of simple python package, including setuptools, entry points, and testing
  • Adding a simple command line interface thanks to click
  • Using docker to containerize the application

The toy application takes two numbers and a mathemtical operation and returns the result

Quickstart

Install the package with pip.

$ mkdir demo
$ cd demo
$ git clone https://github.com/ian1roberts/toyapp.git
$ cd toyapp
$ pip install .

Try out the command line interface

$ toyapp 1 2 "+"

Note that the operators must be quoted to avoid shell expansion.

Check out the help

$ toyapp --help

Usage: toyapp [OPTIONS] NUM1 NUM2 [OPERATION]

Perform simple arithmetic operations given two numbers and an operator.

If operator is ommited, the default is addition. To prevent * being
interpreted as a wildcard, use quotes around the operator.

--quiet, -q: Don't print the leading message, just return the result.
num1: float - The first number
num2: float - The second number
operation: str -The operation to perform on the two numbers

Evaluates the expression num1 operation num2 and prints the result.

Options:
    -q, --quiet  Don't print the result
    --help       Show this message and exit.

Features

The repository includes a Makefiile and Dockerfile to build and run the application in a container.

To build the container, run make build.

You can also pull the image from dockerhub with docker pull ian1roberts/toyapp:latest

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

Appendix

toyapp's People

Contributors

ian1roberts avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.