diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ca57bc..b38884f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. 1. Troy Pounds (`t lb`) - 1 new coffee unit 1. Troy Pounds (`t lb`) +- `--grind` argument +### Changed +- `README.md` updated ## [1.1] - 2025-01-02 ### Added - 5 new water units diff --git a/README.md b/README.md index 34f920f..db7d5c3 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,8 @@ Water: 250 g Ratio: 3/50 +Grind: 550 um + Info: V60 method ``` @@ -109,7 +111,7 @@ Info: V60 method ℹ️ You can run `mycoffee --water-units-list` to view the supported water units ```shell -> mycoffee --method=chemex --water=20 --cups=3 --coffee-ratio=2 --water-ratio=37 --coffee-unit=g --water-unit=g +> mycoffee --method=chemex --water=20 --cups=3 --coffee-ratio=2 --water-ratio=37 --coffee-unit=g --water-unit=g --grind=750 __ __ _ _ ___ _____ ____ ____ ____ ____ ( \/ )( \/ ) / __)( _ )( ___)( ___)( ___)( ___) @@ -128,6 +130,8 @@ Water: 20 g Ratio: 2/37 +Grind: 750 um + Info: Chemex method ``` @@ -161,6 +165,12 @@ Info: Chemex method Integer 1 + + --grind + Grind size (um) + Integer + 700 + --coffee-ratio Coefficient for the coffee component in the ratio @@ -235,6 +245,7 @@ Just fill an issue and describe it. We'll check it ASAP!
22- Weight Calculator
23- Volume Conversion Calculator - Inch Calculator
24- Metric Conversion Charts and Calculators
+
25- Coffee grind size chart
## Show Your Support diff --git a/mycoffee/__main__.py b/mycoffee/__main__.py index 11ed209..e282705 100644 --- a/mycoffee/__main__.py +++ b/mycoffee/__main__.py @@ -19,6 +19,7 @@ def main(): parser.add_argument('--water-ratio', help='coefficient for the water component in the ratio', type=float) 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('--grind', help='grind size (um)', type=int) parser.add_argument( '--digits', help='number of digits up to which the result is rounded', diff --git a/mycoffee/functions.py b/mycoffee/functions.py index c173c13..a356fc2 100644 --- a/mycoffee/functions.py +++ b/mycoffee/functions.py @@ -41,7 +41,8 @@ def print_result(params): params["water_ratio"], params["info"], params["coffee_unit"], - params["water_unit"])) + params["water_unit"], + params["grind"])) if not check_ratio_limits(params): ratio_lower_limit = METHODS_MAP[method]["ratio_lower_limit"] ratio_upper_limit = METHODS_MAP[method]["ratio_upper_limit"] diff --git a/mycoffee/params.py b/mycoffee/params.py index 16afc17..2faec6a 100644 --- a/mycoffee/params.py +++ b/mycoffee/params.py @@ -20,6 +20,8 @@ Ratio: {4}/{5} +Grind: {9} um + Info: {6} """ @@ -31,6 +33,7 @@ "water": 0, "coffee_ratio": 1, "water_ratio": 1, + "grind": 700, "coffee_unit": "g", "water_unit": "g", "digits": 3, @@ -42,12 +45,14 @@ "custom": { "coffee_ratio": 1, "water_ratio": 17, + "grind": 700, "water": 240, "info": "Custom brewing method" }, "v60": { "coffee_ratio": 3, "water_ratio": 50, + "grind": 550, "ratio_lower_limit": Fraction(1, 18), "ratio_upper_limit": Fraction(1, 14), "water": 250, @@ -56,6 +61,7 @@ "espresso": { "coffee_ratio": 1, "water_ratio": 2, + "grind": 280, "ratio_lower_limit": Fraction(2, 5), "ratio_upper_limit": Fraction(2, 3), "water": 36, @@ -64,6 +70,7 @@ "ristretto": { "coffee_ratio": 1, "water_ratio": 1, + "grind": 280, "ratio_lower_limit": Fraction(2, 3), "ratio_upper_limit": Fraction(1, 1), "water": 18, @@ -72,6 +79,7 @@ "lungo": { "coffee_ratio": 1, "water_ratio": 4, + "grind": 280, "ratio_lower_limit": Fraction(1, 4), "ratio_upper_limit": Fraction(2, 5), "water": 72, @@ -80,6 +88,7 @@ "chemex": { "coffee_ratio": 1, "water_ratio": 15, + "grind": 670, "ratio_lower_limit": Fraction(1, 21), "ratio_upper_limit": Fraction(1, 10), "water": 240, @@ -88,6 +97,7 @@ "french-press": { "coffee_ratio": 1, "water_ratio": 15, + "grind": 995, "ratio_lower_limit": Fraction(1, 18), "ratio_upper_limit": Fraction(1, 12), "water": 120, @@ -96,6 +106,7 @@ "siphon": { "coffee_ratio": 1, "water_ratio": 15, + "grind": 588, "ratio_lower_limit": Fraction(1, 16), "ratio_upper_limit": Fraction(1, 12), "water": 240, @@ -104,6 +115,7 @@ "pour-over": { "coffee_ratio": 1, "water_ratio": 15, + "grind": 670, "ratio_lower_limit": Fraction(1, 16), "ratio_upper_limit": Fraction(1, 14), "water": 240, @@ -112,6 +124,7 @@ "auto-drip": { "coffee_ratio": 1, "water_ratio": 16, + "grind": 600, "ratio_lower_limit": Fraction(1, 17), "ratio_upper_limit": Fraction(1, 14), "water": 128, @@ -120,6 +133,7 @@ "cold-brew": { "coffee_ratio": 1, "water_ratio": 11, + "grind": 1100, "ratio_lower_limit": Fraction(1, 15), "ratio_upper_limit": Fraction(1, 8), "water": 242, @@ -128,6 +142,7 @@ "cold-brew-conc": { "coffee_ratio": 1, "water_ratio": 5, + "grind": 1100, "ratio_lower_limit": Fraction(1, 6), "ratio_upper_limit": Fraction(1, 4), "water": 120, @@ -136,6 +151,7 @@ "moka-pot": { "coffee_ratio": 1, "water_ratio": 10, + "grind": 510, "ratio_lower_limit": Fraction(1, 12), "ratio_upper_limit": Fraction(1, 7), "water": 60, @@ -144,6 +160,7 @@ "turkish": { "coffee_ratio": 1, "water_ratio": 10, + "grind": 130, "ratio_lower_limit": Fraction(1, 12), "ratio_upper_limit": Fraction(1, 8), "water": 50, @@ -152,6 +169,7 @@ "cupping": { "coffee_ratio": 11, "water_ratio": 200, + "grind": 655, "ratio_lower_limit": Fraction(1, 19), "ratio_upper_limit": Fraction(1, 17), "water": 150, @@ -160,6 +178,7 @@ "aero-press": { "coffee_ratio": 1, "water_ratio": 15, + "grind": 640, "ratio_lower_limit": Fraction(1, 18), "ratio_upper_limit": Fraction(1, 12), "water": 135, @@ -168,6 +187,7 @@ "aero-press-conc": { "coffee_ratio": 1, "water_ratio": 6, + "grind": 640, "ratio_lower_limit": Fraction(1, 7), "ratio_upper_limit": Fraction(1, 5), "water": 90, @@ -176,6 +196,7 @@ "aero-press-inv": { "coffee_ratio": 1, "water_ratio": 12, + "grind": 640, "ratio_lower_limit": Fraction(1, 14), "ratio_upper_limit": Fraction(1, 10), "water": 132, @@ -184,6 +205,7 @@ "steep-and-release": { "coffee_ratio": 1, "water_ratio": 16, + "grind": 638, "ratio_lower_limit": Fraction(1, 17), "ratio_upper_limit": Fraction(1, 14), "water": 255, diff --git a/test/functions_test.py b/test/functions_test.py index 5c699ec..6152b66 100644 --- a/test/functions_test.py +++ b/test/functions_test.py @@ -15,7 +15,7 @@ 0.001 >>> convert_water(1, "kg", True) 1000.0 ->>> test_params = {"method":"v60", "cups":2, "coffee":60, "water":500, "coffee_ratio": 3, "water_ratio":50, "info":"V60 method", "coffee_unit": "g", "water_unit": "g"} +>>> test_params = {"method":"v60", "cups":2, "coffee":60, "water":500, "coffee_ratio": 3, "water_ratio":50, "info":"V60 method", "coffee_unit": "g", "water_unit": "g", "grind": 500} >>> print_result(test_params) __ __ _ _ ___ _____ ____ ____ ____ ____ ( \/ )( \/ ) / __)( _ )( ___)( ___)( ___)( ___) @@ -34,9 +34,11 @@ Ratio: 3/50 +Grind: 500 um + Info: V60 method ->>> test_params = {"method":"v60", "cups":2, "coffee":60, "water":500, "coffee_ratio": 3, "water_ratio":50, "info":"", "digits":3, "coffee_unit": "g", "water_unit": "g"} +>>> test_params = {"method":"v60", "cups":2, "coffee":60, "water":500, "coffee_ratio": 3, "water_ratio":50, "info":"", "digits":3, "coffee_unit": "g", "water_unit": "g", "grind": 600} >>> test_params = filter_params(test_params) >>> check_ratio_limits(test_params) == True True @@ -58,9 +60,11 @@ Ratio: 3/50 +Grind: 600 um + Info: Nothing :) ->>> test_params = {"method":"v60", "cups":2, "coffee":60, "water":0.5, "coffee_ratio": 3, "water_ratio":50, "info":"", "digits":3, "coffee_unit": "g", "water_unit": "kg"} +>>> test_params = {"method":"v60", "cups":2, "coffee":60, "water":0.5, "coffee_ratio": 3, "water_ratio":50, "info":"", "digits":3, "coffee_unit": "g", "water_unit": "kg", "grind": 750} >>> test_params = filter_params(test_params) >>> check_ratio_limits(test_params) == True True @@ -82,9 +86,11 @@ Ratio: 3/50 +Grind: 750 um + Info: Nothing :) ->>> test_params = {"method":"v60", "cups":2, "coffee":6.0, "water":500, "coffee_ratio": 6, "water_ratio":1000, "info":"", "digits":3, "coffee_unit": "g", "water_unit": "g"} +>>> test_params = {"method":"v60", "cups":2, "coffee":6.0, "water":500, "coffee_ratio": 6, "water_ratio":1000, "info":"", "digits":3, "coffee_unit": "g", "water_unit": "g", "grind": 230} >>> test_params = filter_params(test_params) >>> check_ratio_limits(test_params) == False True @@ -106,6 +112,8 @@ Ratio: 6/1000 +Grind: 230 um + Info: Nothing :) [Warning] The ratio is not within the standard range. For `v60`, the ratio can be anywhere between `1/18` and `1/14` @@ -114,7 +122,7 @@ >>> check_ratio_limits(test_params) == True True >>> chemex_params = load_method_params("chemex") ->>> chemex_params == {'info': 'Chemex method', 'water': 240, 'cups': 1, 'coffee_ratio': 1, 'water_ratio': 15, 'digits': 3, 'coffee_unit': 'g', 'water_unit': 'g'} +>>> chemex_params == {'info': 'Chemex method', 'water': 240, 'cups': 1, 'coffee_ratio': 1, 'water_ratio': 15, 'digits': 3, 'coffee_unit': 'g', 'water_unit': 'g', 'grind': 670} True >>> show_methods_list() Methods list: @@ -221,6 +229,7 @@ >>> _ = parser.add_argument('--water-ratio', help='water ratio', type=float) >>> _ = parser.add_argument('--water', help='water(ml)', type=float) >>> _ = parser.add_argument('--cups', help='number of cups', type=int) +>>> _ = parser.add_argument('--grind', help='grind size (um)', type=int) >>> _ = parser.add_argument('--digits', help='number of digits up to which the result is rounded', type=int, default=3) >>> _ = parser.add_argument('--coffee-unit', help='coffee unit', type=str, choices=sorted(COFFEE_UNITS_MAP), default="g") >>> _ = parser.add_argument('--water-unit', help='water unit', type=str, choices=sorted(WATER_UNITS_MAP), default="g") @@ -251,6 +260,8 @@ Ratio: 3/50 +Grind: 550 um + Info: V60 method >>> args = parser.parse_args(["--method", 'v60', "--water-ratio", '500', "--coffee-ratio", '23', "--water", '5000']) diff --git a/test/verified_test.py b/test/verified_test.py index e1c4c3e..c7ec487 100644 --- a/test/verified_test.py +++ b/test/verified_test.py @@ -17,6 +17,8 @@ True >>> METHODS_MAP["v60"]["ratio_lower_limit"] == Fraction(1, 18) True +>>> v60_params["grind"] == 550 # https://honestcoffeeguide.com/coffee-grind-size-chart/#v60 +True >>> chemex_params = load_method_params("chemex") # https://honestcoffeeguide.com/coffee-to-water-ratio-calculator >>> chemex_params["coffee_ratio"] == 1 True @@ -31,6 +33,8 @@ True >>> METHODS_MAP["chemex"]["ratio_lower_limit"] == Fraction(1, 21) True +>>> chemex_params["grind"] == 670 # https://honestcoffeeguide.com/coffee-grind-size-chart/#pourover +True >>> espresso_params = load_method_params("espresso") # https://honestcoffeeguide.com/coffee-to-water-ratio-calculator >>> espresso_params["coffee_ratio"] == 1 True @@ -45,6 +49,8 @@ True >>> METHODS_MAP["espresso"]["ratio_lower_limit"] == Fraction(2, 5) True +>>> espresso_params["grind"] == 280 # https://honestcoffeeguide.com/coffee-grind-size-chart/#espresso +True >>> siphon_params = load_method_params("siphon") # https://bluebottlecoffee.com/us/eng/brew-guides/siphon >>> siphon_params["coffee_ratio"] == 1 True @@ -59,6 +65,8 @@ True >>> METHODS_MAP["siphon"]["ratio_lower_limit"] == Fraction(1, 16) True +>>> siphon_params["grind"] == 588 # https://honestcoffeeguide.com/coffee-grind-size-chart/#siphon +True >>> french_press_params = load_method_params("french-press") # https://useandcares.hamiltonbeach.com/files/840230401.pdf >>> french_press_params["coffee_ratio"] == 1 True @@ -73,6 +81,8 @@ True >>> METHODS_MAP["french-press"]["ratio_lower_limit"] == Fraction(1, 18) True +>>> french_press_params["grind"] == 995 # https://honestcoffeeguide.com/coffee-grind-size-chart/#french-press +True >>> pour_over_params = load_method_params("pour-over") # https://www.nicolebattefeld.com/post/best-recipes-2022 >>> pour_over_params["coffee_ratio"] == 1 True @@ -87,6 +97,8 @@ True >>> METHODS_MAP["pour-over"]["ratio_lower_limit"] == Fraction(1, 16) True +>>> pour_over_params["grind"] == 670 # https://honestcoffeeguide.com/coffee-grind-size-chart/#pourover +True >>> auto_drip_params = load_method_params("auto-drip") # https://wonderstate.com/pages/auto-drip >>> auto_drip_params["coffee_ratio"] == 1 True @@ -101,6 +113,8 @@ True >>> METHODS_MAP["auto-drip"]["ratio_lower_limit"] == Fraction(1, 17) True +>>> auto_drip_params["grind"] == 600 # https://honestcoffeeguide.com/coffee-grind-size-chart/#filter-coffee-machine +True >>> cold_brew_params = load_method_params("cold-brew") # https://counterculturecoffee.com/blogs/counter-culture-coffee/guide-to-cold-brew >>> cold_brew_params["coffee_ratio"] == 1 True @@ -115,6 +129,8 @@ True >>> METHODS_MAP["cold-brew"]["ratio_lower_limit"] == Fraction(1, 15) True +>>> cold_brew_params["grind"] == 1100 # https://honestcoffeeguide.com/coffee-grind-size-chart/#cold-brew +True >>> cold_brew_conc_params = load_method_params("cold-brew-conc") # https://www.thespruceeats.com/cold-brew-concentrate-recipe-5197494 >>> cold_brew_conc_params["coffee_ratio"] == 1 True @@ -129,6 +145,8 @@ True >>> METHODS_MAP["cold-brew-conc"]["ratio_lower_limit"] == Fraction(1, 6) True +>>> cold_brew_conc_params["grind"] == 1100 # https://honestcoffeeguide.com/coffee-grind-size-chart/#cold-brew +True >>> moka_pot_params = load_method_params("moka-pot") # https://bakedbrewedbeautiful.com/how-to-make-coffee-in-moka-pot >>> moka_pot_params["coffee_ratio"] == 1 True @@ -143,6 +161,8 @@ True >>> METHODS_MAP["moka-pot"]["ratio_lower_limit"] == Fraction(1, 12) True +>>> moka_pot_params["grind"] == 510 # https://honestcoffeeguide.com/coffee-grind-size-chart/#moka-pot +True >>> ristretto_params = load_method_params("ristretto") # https://honestcoffeeguide.com/coffee-to-water-ratio-calculator >>> ristretto_params["coffee_ratio"] == 1 True @@ -157,6 +177,8 @@ True >>> METHODS_MAP["ristretto"]["ratio_lower_limit"] == Fraction(2, 3) True +>>> ristretto_params["grind"] == 280 # https://honestcoffeeguide.com/coffee-grind-size-chart/#espresso +True >>> lungo_params = load_method_params("lungo") # https://honestcoffeeguide.com/coffee-to-water-ratio-calculator >>> lungo_params["coffee_ratio"] == 1 True @@ -171,6 +193,8 @@ True >>> METHODS_MAP["lungo"]["ratio_lower_limit"] == Fraction(1, 4) True +>>> lungo_params["grind"] == 280 # https://honestcoffeeguide.com/coffee-grind-size-chart/#espresso +True >>> turkish_params = load_method_params("turkish") # https://www.drinktrade.com/blogs/education/how-to-make-turkish-coffee >>> turkish_params["coffee_ratio"] == 1 True @@ -185,6 +209,8 @@ True >>> METHODS_MAP["turkish"]["ratio_lower_limit"] == Fraction(1, 12) True +>>> turkish_params["grind"] == 130 # https://honestcoffeeguide.com/coffee-grind-size-chart/#turkish-coffee +True >>> cupping_params = load_method_params("cupping") # https://www.horshamcoffeeroaster.co.uk/pages/how-to-cup-coffee >>> cupping_params["coffee_ratio"] == 11 True @@ -199,6 +225,8 @@ True >>> METHODS_MAP["cupping"]["ratio_lower_limit"] == Fraction(1, 19) True +>>> cupping_params["grind"] == 655 # https://honestcoffeeguide.com/coffee-grind-size-chart/#cupping +True >>> aero_press_params = load_method_params("aero-press") # https://aeroprecipe.com/recipes/tetsu-kasuya-aeropress-recipe >>> aero_press_params["coffee_ratio"] == 1 True @@ -213,6 +241,8 @@ True >>> METHODS_MAP["aero-press"]["ratio_lower_limit"] == Fraction(1, 18) True +>>> aero_press_params["grind"] == 640 # https://honestcoffeeguide.com/coffee-grind-size-chart/#aeropress +True >>> aero_press_conc_params = load_method_params("aero-press-conc") # https://www.seattlecoffeegear.com/pages/product-resource/aero-press-product-resources >>> aero_press_conc_params["coffee_ratio"] == 1 True @@ -227,6 +257,8 @@ True >>> METHODS_MAP["aero-press-conc"]["ratio_lower_limit"] == Fraction(1, 7) True +>>> aero_press_conc_params["grind"] == 640 # https://honestcoffeeguide.com/coffee-grind-size-chart/#aeropress +True >>> aero_press_inv_params = load_method_params("aero-press-inv") # https://aeroprecipe.com/recipes/all-about-the-intervals >>> aero_press_inv_params["coffee_ratio"] == 1 True @@ -241,6 +273,8 @@ True >>> METHODS_MAP["aero-press-inv"]["ratio_lower_limit"] == Fraction(1, 14) True +>>> aero_press_inv_params["grind"] == 640 # https://honestcoffeeguide.com/coffee-grind-size-chart/#aeropress +True >>> steep_and_release_params = load_method_params("steep-and-release") # https://squaremileblog.com/brew-guide-clever-dripper/ >>> steep_and_release_params["coffee_ratio"] == 1 True @@ -255,6 +289,8 @@ True >>> METHODS_MAP["steep-and-release"]["ratio_lower_limit"] == Fraction(1, 17) True +>>> steep_and_release_params["grind"] == 638 # https://honestcoffeeguide.com/coffee-grind-size-chart/#steepandrelease +True >>> custom_params = load_method_params("custom") >>> custom_params["coffee_ratio"] == 1 True