Experiment with cookiecutter and docker to create a toyapp
Project description
toyapp
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
Free software: MIT license
Documentation: https://toyapp.readthedocs.io.
History
0.1.0 (2024-02-23)
First release on PyPI.
0.1.2 (2024-02-25)
Configure with PyPI
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file toyapp-0.1.2.tar.gz
.
File metadata
- Download URL: toyapp-0.1.2.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55655939a6c08a84f5262e1124bfd5c2eba923f947ab1ac1587b01573e3b4667 |
|
MD5 | aff6e60455c94224f00752b4a97368c0 |
|
BLAKE2b-256 | 04176df73645ccff889a85b9a6254308b7c7715da70cf8b2291cc068f2f8c1c6 |
File details
Details for the file toyapp-0.1.2-py2.py3-none-any.whl
.
File metadata
- Download URL: toyapp-0.1.2-py2.py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b18c91971d0ea22a67e0ae8a6c634911b9f14123443bfe1f5664df9a1cfed8e |
|
MD5 | 16556f10be9c92e21448e19fb8eff137 |
|
BLAKE2b-256 | 6ce1c8425366d82e968fff8e42b51b622a0c5b7c68f140df92e30a28f537d09e |