separate lint workflow, update readme (#10)
authorShane Jaroch <chown_tee@proton.me>
Wed, 20 Jul 2022 17:42:40 +0000 (13:42 -0400)
committerGitHub <noreply@github.com>
Wed, 20 Jul 2022 17:42:40 +0000 (13:42 -0400)
.editorconfig
.github/workflows/coveralls.yml
.github/workflows/lint.yml [copied from .github/workflows/coveralls.yml with 52% similarity]
.github/workflows/test-linux.yml
README.rst

index 3f9ce443c713effdc8553bcd250b9f530bdbbb66..149ee88b364039c024e8181966075408cbfe3232 100644 (file)
@@ -30,6 +30,7 @@ trim_trailing_whitespace = false
 
 
 [*.rst]
+indent_size = 2
 max_line_length = 79
 
 
index b0c887914f30c8ddda4c9797c8d35d172bd1607e..b33b19664a40fa5ecc43a55f4942b14b1a4398c0 100644 (file)
@@ -1,5 +1,6 @@
 ---
 name: coveralls
+
 "on":
   push: {}
 
similarity index 52%
copy from .github/workflows/coveralls.yml
copy to .github/workflows/lint.yml
index b0c887914f30c8ddda4c9797c8d35d172bd1607e..ffff075e37ee6f89a036537fea19a9d13fa13a34 100644 (file)
@@ -1,10 +1,11 @@
 ---
-name: coveralls
+name: lint
+
 "on":
   push: {}
 
 jobs:
-  cov-submit:
+  lint:
     runs-on: ubuntu-latest
 
     steps:
@@ -22,20 +23,12 @@ 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
+          pip install -r requirements-lint.txt
 
-      # TODO: Tests for: python-argcomplete (tab-completion)
-      - name: Test
-        run: |
-          export NUTRA_HOME=$(pwd)/tests/.nutra.test
-          make _test
+          # NOTE: pytest is needed to lint the folder: "tests/"
+          pip install -r requirements-test.txt
 
-      - name: Submit coverage report / coveralls
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-        run: coveralls --service=github
+      - name: Lint
+        run: make _lint
index a7654265081a44b9d40c17d239ec67e8d601380e..7c970d58ab5ec248d7b9961d0187d202d2efcb8f 100644 (file)
@@ -1,5 +1,6 @@
 ---
 name: test-linux
+
 "on":
   push: {}
 
@@ -30,17 +31,13 @@ jobs:
           restore-keys: |
             ${{ runner.os }}-pip-
 
-      - name: Install requirements
-        # NOTE: container lacks OS dist for testresources/launchpadlib
+      # 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: |
-          # NOTE: This is the latest version on GitHub for Python 3.4
-          if [[ "$(python --version)" =~ "3.4." ]]; then
-            pip install colorama==0.4.1;
-          fi
-
-          pip install -r requirements.txt
+          pip install colorama==0.4.1
 
-      - name: Install
+      - name: Install CLI
         env:
           PY_SYS_INTERPRETER: python3
         run: make install
index ae9f54b95a15a0ad954602988a2b1eb2daf56d4c..cca93f9b3a5da1b378c17250a6e11ddd578a2e24 100644 (file)
@@ -2,41 +2,57 @@
  nutratracker
 **************
 
-.. image:: https://github.com/nutratech/cli/actions/workflows/test-linux.yml/badge.svg
-    :target: https://github.com/nutratech/cli/actions/workflows/test-linux.yml
-    :alt: Build status unknown (Linux)
-.. image:: https://github.com/nutratech/cli/actions/workflows/test-win32.yml/badge.svg
-    :target: https://github.com/nutratech/cli/actions/workflows/test-win32.yml
-    :alt: Build status unknown (Windows)
-
-.. image:: https://coveralls.io/repos/github/nutratech/cli/badge.svg?branch=master
-    :target: https://coveralls.io/github/nutratech/cli?branch=master
-    :alt: Coverage unknown
-
-.. image:: https://badgen.net/pypi/v/nutra
-    :target: https://pypi.org/project/nutra/
-    :alt: Latest version unknown
-
-.. image:: https://pepy.tech/badge/nutra/month
-    :target: https://pepy.tech/project/nutra
-    :alt: Monthly downloads unknown
-
-.. image:: https://img.shields.io/pypi/pyversions/nutra.svg
-    :alt: Python3 (3.4 - 3.10)
-
-.. image:: https://badgen.net/badge/code%20style/black/000
-    :target: https://github.com/ambv/black
-    :alt: Code style: black
-
-.. image:: https://badgen.net/pypi/license/nutra
-    :target: https://www.gnu.org/licenses/gpl-3.0.en.html
-    :alt: License GPL-3
-
-Extensible command-line tools for nutrient analysis.
+.. list-table::
+  :widths: 15 25 20
+  :header-rows: 1
+
+  * -
+    -
+    -
+  * - Test / Linux
+    - .. image:: https://github.com/nutratech/cli/actions/workflows/test-linux.yml/badge.svg
+        :target: https://github.com/nutratech/cli/actions/workflows/test-linux.yml
+        :alt: Test status unknown (Linux)
+    -
+  * - Test / Windows
+    - .. image:: https://github.com/nutratech/cli/actions/workflows/test-win32.yml/badge.svg
+        :target: https://github.com/nutratech/cli/actions/workflows/test-win32.yml
+        :alt: Test status unknown (Windows)
+    -
+  * - Other checks
+    - .. image:: https://coveralls.io/repos/github/nutratech/cli/badge.svg?branch=master
+        :target: https://coveralls.io/github/nutratech/cli?branch=master
+        :alt: Coverage unknown
+    - .. image:: https://github.com/nutratech/cli/actions/workflows/lint.yml/badge.svg
+        :target: https://github.com/nutratech/cli/actions/workflows/lint.yml
+        :alt: Lint status unknown
+  * - PyPI Release
+    - .. image:: https://badgen.net/pypi/v/nutra
+        :target: https://pypi.org/project/nutra/
+        :alt: Latest version unknown
+    - .. image:: https://pepy.tech/badge/nutra/month
+        :target: https://pepy.tech/project/nutra
+        :alt: Monthly downloads unknown
+  * - Supported Runtime
+    - .. image:: https://img.shields.io/pypi/pyversions/nutra.svg
+        :alt: Python3 (3.4 - 3.10)
+    -
+  * - Code Style
+    - .. image:: https://badgen.net/badge/code%20style/black/000
+        :target: https://github.com/ambv/black
+        :alt: Code style: black
+    -
+  * - License
+    - .. image:: https://badgen.net/pypi/license/nutra
+        :target: https://www.gnu.org/licenses/gpl-3.0.en.html
+        :alt: License GPL-3
+    -
+
+Command line tools for interacting with government food databases.
 
 *Requires:*
 
-- Python 3.4.0 or later (lzma, ssl & sqlite3 modules) [Win XP / Ubuntu 16.04].
+- Python 3.4.0 or later (lzma, ssl & sqlite3 modules) [Win XP / Ubuntu 14.04].
 - Packages: see ``setup.py``, and ``requirements.txt`` files.
 - Internet connection, to download food database & package dependencies.
 
@@ -44,6 +60,12 @@ See nt database:   https://github.com/nutratech/nt-sqlite
 
 See usda database: https://github.com/nutratech/usda-sqlite
 
+Plugin Development
+==================
+
+We're looking to start developing plugins or data modifications sets that
+can be imported and built on the base installation, which remains pure.
+
 Notes
 =====
 
@@ -58,15 +80,15 @@ Windows users may not be able to install ``python-Levenshtein``.
 
 Mac and Linux developers will do well to install ``direnv``.
 
-Main program works 100%, but test and lint may not on older operating
-systems (Ubuntu 16.04, Windows XP).
+Main program works 100%, but ``test`` and ``lint`` may break on older operating
+systems (Ubuntu 14.04, Windows XP).
 
 Install PyPi release (from pip)
 ===============================
 
 .. code-block:: bash
 
-    pip install nutra
+  pip install nutra
 
 (**Specify:** flag ``-U`` to upgrade, or ``--pre`` for development releases)
 
@@ -76,24 +98,24 @@ Clone down, initialize ``nt-sqlite`` submodule, and install requirements:
 
 .. code-block:: bash
 
-    git clone https://github.com/nutratech/cli.git
-    cd cli
-    make init
-    # source .venv/bin/activate  # uncomment if NOT using direnv
-    make deps
+  git clone https://github.com/nutratech/cli.git
+  cd cli
+  make init
+  # source .venv/bin/activate  # uncomment if NOT using direnv
+  make deps
 
-    ./nutra -h
+  ./nutra -h
 
 Initialize the DBs (nt and usda).
 
 .. code-block:: bash
 
-    # source .venv/bin/activate  # uncomment if NOT using direnv
-    ./nutra init
+  # source .venv/bin/activate  # uncomment if NOT using direnv
+  ./nutra init
 
-    # Or install and run as package script
-    make install
-    nutra init
+  # Or install and run as package script
+  make install
+  nutra init
 
 If installed (or inside ``cli``) folder, the program can also run
 with ``python -m ntclient``
@@ -103,9 +125,9 @@ Building the PyPi release
 
 .. code-block:: bash
 
-    # source .venv/bin/activate  # uncomment if NOT using direnv
-    make build  # python3 setup.py --quiet sdist
-    twine upload dist/nutra-X.X.X.tar.gz
+  # source .venv/bin/activate  # uncomment if NOT using direnv
+  make build  # python3 setup.py --quiet sdist
+  twine upload dist/nutra-X.X.X.tar.gz
 
 Linting & Tests
 ===============
@@ -114,8 +136,8 @@ Install the dependencies (``make deps``) and then:
 
 .. code-block:: bash
 
-    # source .venv/bin/activate  # uncomment if NOT using direnv
-    make format lint test
+  # source .venv/bin/activate  # uncomment if NOT using direnv
+  make format lint test
 
 ArgComplete (tab completion / autocomplete)
 ===========================================
@@ -130,7 +152,7 @@ specifics on using other shells, e.g. ``zsh``, ``fish``, or ``tsh``.
 
 .. code-block:: bash
 
-    activate-global-python-argcomplete
+  activate-global-python-argcomplete
 
 Then you can press tab to fill in or complete subcommands
 and to list argument flags.
@@ -144,19 +166,19 @@ 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
+  mkdir -p $HOME/.bash_completion.d
+  activate-global-python-argcomplete --dest=$HOME/.bash_completion.d
 
 And my ``~/.bashrc`` file looks like this.
 
 .. code-block:: bash
 
-    export ARGCOMPLETE_USE_TEMPFILES=1
+  export ARGCOMPLETE_USE_TEMPFILES=1
 
-    # python bash completion
-    if [ -f ~/.bash_completion.d/python-argcomplete ]; then
-        source ~/.bash_completion.d/python-argcomplete
-    fi
+  # python bash completion
+  if [ -f ~/.bash_completion.d/python-argcomplete ]; then
+      source ~/.bash_completion.d/python-argcomplete
+  fi
 
 **NOTE:** This is a work in progress, we are adding more autocomplete
 functions.
@@ -189,21 +211,21 @@ Commands
 
 ::
 
-    usage: nutra [-h] [-v] [-d] [--no-pager]
-                 {init,nt,search,sort,anl,day,recipe,bio} ...
-
-    optional arguments:
-      -h, --help            show this help message and exit
-      -v, --version         show program's version number and exit
-      -d, --debug           enable detailed error messages
-      --no-pager            disable paging (print full output)
-
-    nutra subcommands:
-      {init,nt,search,sort,anl,day,recipe,bio}
-        init                setup profiles, USDA and NT database
-        nt                  list out nutrients and their info
-        search              search foods by name, list overview info
-        sort                sort foods by nutrient ID
-        anl                 analyze food(s)
-        day                 analyze a DAY.csv file, RDAs optional
-        recipe              list and analyze recipes
+  usage: nutra [-h] [-v] [-d] [--no-pager]
+               {init,nt,search,sort,anl,day,recipe,bio} ...
+
+  optional arguments:
+    -h, --help            show this help message and exit
+    -v, --version         show program's version number and exit
+    -d, --debug           enable detailed error messages
+    --no-pager            disable paging (print full output)
+
+  nutra subcommands:
+    {init,nt,search,sort,anl,day,recipe,bio}
+      init                setup profiles, USDA and NT database
+      nt                  list out nutrients and their info
+      search              search foods by name, list overview info
+      sort                sort foods by nutrient ID
+      anl                 analyze food(s)
+      day                 analyze a DAY.csv file, RDAs optional
+      recipe              list and analyze recipes