Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor edits #5

Merged
merged 10 commits into from
Sep 1, 2024
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ body:
validations:
required: false
- type: textarea
id: aditional-context
id: additional-context
attributes:
label: Additional context
placeholder: >
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<div align="center">
<h1>MyCoffee: Brew Perfect Coffee Right from Your Terminal</h1>
<br/>
<a href="https://badge.fury.io/py/mycoffee"><img src="https://badge.fury.io/py/mycoffee.svg" alt="PyPI version" height="18"></a>
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/built%20with-Python3-green.svg" alt="built with Python3"></a>
<a href="https://badge.fury.io/py/mycoffee"><img src="https://badge.fury.io/py/mycoffee.svg" alt="PyPI version" height="18"></a>
<a href="https://codecov.io/gh/sepandhaghighi/mycoffee" >
<img src="https://codecov.io/gh/sepandhaghighi/mycoffee/graph/badge.svg?token=ZelznFDSPA"/>
</a>
</div>

## Overview
Expand Down Expand Up @@ -41,9 +44,9 @@
<table>
<tr>
<td align="center">Code Quality</td>
<td align="center"></td>
<td align="center"></td>
<td align="center"></td>
<td align="center"><a href="https://www.codefactor.io/repository/github/sepandhaghighi/mycoffee"><img src="https://www.codefactor.io/repository/github/sepandhaghighi/mycoffee/badge" alt="CodeFactor"></a></td>
<td align="center"><a href="https://codebeat.co/projects/github-com-sepandhaghighi-mycoffee-main"><img alt="codebeat badge" src="https://codebeat.co/badges/8cb2671b-7640-4ac7-bb3e-823bb26a2db2" /></a></td>
<td align="center"><a href="https://app.codacy.com/gh/sepandhaghighi/mycoffee/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade"><img src="https://app.codacy.com/project/badge/Grade/ac0a8041879042d4a7925272ea3f7ba5"/></a></td>
</tr>
</table>

Expand Down
8 changes: 4 additions & 4 deletions mycoffee/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 11 additions & 4 deletions mycoffee/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -99,4 +106,4 @@ def run(args):
params = load_params(args)
coffee = coffee_calc(params)
params["coffee"] = coffee
print_message(params)
print_message(params)
6 changes: 2 additions & 4 deletions mycoffee/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
"water_ratio": 50,
"water": 250,
"info": "V60 method"
}
,
},
"espresso": {
"coffee_ratio": 1,
"water_ratio": 2,
Expand All @@ -63,8 +62,7 @@
"water_ratio": 15,
"water": 120,
"info": "French press method"
}
,
},
"siphon": {
"coffee_ratio": 1,
"water_ratio": 15,
Expand Down
Loading