From: Shane Jaroch Date: Wed, 20 Jul 2022 20:28:48 +0000 (-0400) Subject: test old requirement versions, tidy workflows (#11) X-Git-Tag: v0.2.5~1 X-Git-Url: https://git.nutra.tk/v1?a=commitdiff_plain;h=2c31c6589e44325830325c22ecd772738814c61f;p=nutratech%2Fcli.git test old requirement versions, tidy workflows (#11) --- diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml index b33b196..10deae0 100644 --- a/.github/workflows/coveralls.yml +++ b/.github/workflows/coveralls.yml @@ -23,10 +23,8 @@ jobs: ${{ runner.os }}-pip- - name: Install requirements - # NOTE: container lacks OS dist for testresources/launchpadlib run: | pip install coveralls==3.3.1 - pip install testresources==2.0.1 pip install -r requirements.txt pip install -r requirements-test.txt diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 7c970d5..7018608 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -27,15 +27,9 @@ jobs: uses: actions/cache@v3 with: path: ~/.cache/pip - key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements*.txt') }} + key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/requirements*.txt') }} restore-keys: | - ${{ runner.os }}-pip- - - # NOTE: These are the last supported versions on Python 3.4 - - name: Install requirements (Python 3.4) - if: matrix.python-version == '3.4.10' - run: | - pip install colorama==0.4.1 + ${{ runner.os }}-${{ matrix.python-version }}-pip- - name: Install CLI env: diff --git a/.github/workflows/test-win32.yml b/.github/workflows/test-win32.yml index 575abdd..0e50030 100644 --- a/.github/workflows/test-win32.yml +++ b/.github/workflows/test-win32.yml @@ -1,5 +1,6 @@ --- name: test-win32 + "on": push: {} diff --git a/README.rst b/README.rst index cca93f9..1615c2f 100644 --- a/README.rst +++ b/README.rst @@ -167,7 +167,7 @@ I've run the command to seed the autocomplete script. .. code-block:: bash mkdir -p $HOME/.bash_completion.d - activate-global-python-argcomplete --dest=$HOME/.bash_completion.d + activate-global-python-argcomplete --user And my ``~/.bashrc`` file looks like this. diff --git a/ntclient/__init__.py b/ntclient/__init__.py index 485ab42..30d9e38 100755 --- a/ntclient/__init__.py +++ b/ntclient/__init__.py @@ -35,7 +35,7 @@ from ntclient.ntsqlite.sql import NT_DB_NAME # Package info __title__ = "nutra" -__version__ = "0.2.5.dev0" +__version__ = "0.2.5.dev1" __author__ = "Shane Jaroch" __email__ = "chown_tee@proton.me" __license__ = "GPL v3" diff --git a/ntclient/services/analyze.py b/ntclient/services/analyze.py index 5ccc979..35c3b1b 100755 --- a/ntclient/services/analyze.py +++ b/ntclient/services/analyze.py @@ -71,8 +71,8 @@ def foods_analyze(food_ids: set, grams: int = 0) -> tuple: ################################################################################ servings_rows = [] nutrients_rows = [] - for food_id in analyses: - food_name = food_des[food_id][2] + for food_id, food_des_tuple in analyses.items(): + food_name = food_des_tuple[2] print( "\n======================================\n" + "==> {0} ({1})\n".format(food_name, food_id) @@ -105,7 +105,7 @@ def foods_analyze(food_ids: set, grams: int = 0) -> tuple: ################################################################################ headers = ["id", "nutrient", "rda", "amount", "units"] nutrient_rows = [] - for nutrient_id, amount in analyses[food_id]: + for nutrient_id, amount in food_des_tuple: # Skip zero values if not amount: continue diff --git a/ntclient/utils/__init__.py b/ntclient/utils/__init__.py index db8f3aa..12c5797 100644 --- a/ntclient/utils/__init__.py +++ b/ntclient/utils/__init__.py @@ -1,5 +1,5 @@ """Constants and default settings""" -from colorama import Fore +from colorama import Fore, Style ################################################################################ # Colors and buffer settings @@ -14,9 +14,9 @@ THRESH_CRIT = 0.4 COLOR_CRIT = Fore.RED THRESH_OVER = 1.9 -COLOR_OVER = Fore.MAGENTA # Fore.LIGHTMAGENTA_EX, Fore.LIGHTBLACK_EX +COLOR_OVER = Style.DIM + Fore.MAGENTA -COLOR_DEFAULT = Fore.LIGHTCYAN_EX # Fore.BLUE, Fore.LIGHTBLUE_EX +COLOR_DEFAULT = Style.BRIGHT + Fore.CYAN ################################################################################ # Nutrient IDs diff --git a/requirements.txt b/requirements.txt index 4bf2690..575e698 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -argcomplete>=1.12.3 -colorama>=0.4.1 -fuzzywuzzy==0.18.0 -tabulate>=0.8.9 +argcomplete<=1.12.3,>=1.8.0 +colorama<=0.4.1,>=0.1.16 +fuzzywuzzy<=0.18.0,>=0.3.0 +tabulate<=0.8.9,>=0.4.3