From 43904cb281207968cb23b3b3d02c886b72d250c9 Mon Sep 17 00:00:00 2001 From: Sepand Haghighi Date: Sun, 1 Sep 2024 18:49:31 +0330 Subject: [PATCH] Minor edits (#5) * fix : minor typo in feature_request.yml fixed * doc : arguments help updated * fix : test.yml updated * doc : CHANGELOG.md updated * fix : autopep8 * doc : code static analyzer badges added to README.md * fix : codecov added to github-action * doc : codecov badge added to README.md * doc : minor edit in badges position * doc : release date updated --- .github/ISSUE_TEMPLATE/feature_request.yml | 2 +- .github/workflows/test.yml | 7 +++++++ CHANGELOG.md | 2 +- README.md | 11 +++++++---- mycoffee/__main__.py | 8 ++++---- mycoffee/functions.py | 15 +++++++++++---- mycoffee/params.py | 6 ++---- 7 files changed, 33 insertions(+), 18 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 305d2f8..139114c 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -27,7 +27,7 @@ body: validations: required: false - type: textarea - id: aditional-context + id: additional-context attributes: label: Additional context placeholder: > diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 813f520..194cc91 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,6 +31,7 @@ jobs: - name: First test run: | mycoffee --version + mycoffee --method=chemex --water=20 --cups=3 --coffee-ratio=2 --water-ratio=37 - name: Install dev-requirements run: | python otherfiles/requirements-splitter.py @@ -48,3 +49,9 @@ jobs: python -m bandit -r mycoffee -s B311 python -m pydocstyle --match-dir=mycoffee -v if: matrix.python-version == env.TEST_PYTHON_VERSION + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} + if: matrix.python-version == env.TEST_PYTHON_VERSION && matrix.os == env.TEST_OS diff --git a/CHANGELOG.md b/CHANGELOG.md index 95ec4af..6950123 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] -## [0.1] - 2024-xx-xx +## [0.1] - 2024-09-01 ### Added - 6 new methods 1. V60 diff --git a/README.md b/README.md index 96dd32b..d21821e 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,11 @@

MyCoffee: Brew Perfect Coffee Right from Your Terminal


-PyPI version built with Python3 +PyPI version + + +
## Overview @@ -41,9 +44,9 @@ - - - + + +
Code QualityCodeFactorcodebeat badge
diff --git a/mycoffee/__main__.py b/mycoffee/__main__.py index a6bc498..b05712f 100644 --- a/mycoffee/__main__.py +++ b/mycoffee/__main__.py @@ -13,10 +13,10 @@ def main(): """ parser = argparse.ArgumentParser() parser.add_argument('--method', help='brewing method', type=str, choices=sorted(METHODS_MAP), default="custom") - parser.add_argument('--info', help='brewing method info', type=str) - parser.add_argument('--coffee-ratio', help='coffee ratio', type=int) - parser.add_argument('--water-ratio', help='water ratio', type=int) - parser.add_argument('--water', help='water(ml)', type=float) + parser.add_argument('--info', help='information about the brewing method', type=str) + parser.add_argument('--coffee-ratio', help='coefficient for the coffee component in the ratio', type=int) + parser.add_argument('--water-ratio', help='coefficient for the water component in the ratio', type=int) + parser.add_argument('--water', help='amount of water in each cup (gr)', type=float) parser.add_argument('--cups', help='number of cups', type=int) parser.add_argument('--methods-list', help='brewing methods list', nargs="?", const=1) parser.add_argument('--version', help='version', nargs="?", const=1) diff --git a/mycoffee/functions.py b/mycoffee/functions.py index 239a073..a54179d 100644 --- a/mycoffee/functions.py +++ b/mycoffee/functions.py @@ -17,8 +17,15 @@ def print_message(params): info = params["info"] if len(info) == 0: info = "Nothing :)" - print(MESSAGE_TEMPLATE.format(params["method"], params["cups"], params["coffee"], params["water"], params["coffee_ratio"], params["water_ratio"], info)) - + print( + MESSAGE_TEMPLATE.format( + params["method"], + params["cups"], + params["coffee"], + params["water"], + params["coffee_ratio"], + params["water_ratio"], + info)) def load_method_params(method_name): @@ -64,7 +71,7 @@ def load_params(args): params = load_method_params(args.method) for item in params: if getattr(args, item) is not None: - params[item] = getattr(args, item) + params[item] = getattr(args, item) params["method"] = args.method return params @@ -99,4 +106,4 @@ def run(args): params = load_params(args) coffee = coffee_calc(params) params["coffee"] = coffee - print_message(params) \ No newline at end of file + print_message(params) diff --git a/mycoffee/params.py b/mycoffee/params.py index 3dd3eac..0575580 100644 --- a/mycoffee/params.py +++ b/mycoffee/params.py @@ -44,8 +44,7 @@ "water_ratio": 50, "water": 250, "info": "V60 method" - } - , + }, "espresso": { "coffee_ratio": 1, "water_ratio": 2, @@ -63,8 +62,7 @@ "water_ratio": 15, "water": 120, "info": "French press method" - } - , + }, "siphon": { "coffee_ratio": 1, "water_ratio": 15,