Package: nutra
Command line tools for interacting with government food database,
and analyzing your health trends. TheSR28database includes data
for ~8500 foods and ~180 nutrients. Customizable with extensions
and mapping rules built on top.Requires:Python 3.4.3 or later (lzma,ssl&sqlite3modules)
[WinXP, Ubuntu14.04, or later].Packages: seesetup.py, andrequirements.txtfiles.Internet connection, to download food database & package dependencies.Seentdatabase:https://github.com/nutratech/nt-sqliteSeeusdadatabase:https://github.com/nutratech/usda-sqliteDetailsCategoryInstall / LinuxInstall / WindowsOther checksPyPI ReleaseSupported RuntimeCode StyleLicenseLinux / macOS requirements (for development)You will needmakeandgccto build theLevenshteinextension.sudoaptinstallmakegccdirenvpython3-devpython3-venv# on macOSbrewinstallmakegccdirenvpython@3.10UsingdirenvInstall with,sudoaptinstalldirenv||brewinstalldirenv# Need to add hook, too
# See: https://direnv.net/docs/hook.htmlDEFAULT_SHELL=$(basename$SHELL)SHELL_RC_FILE=~/.${DEFAULT_SHELL}rcHOOK='eval "$(direnv hook '$DEFAULT_SHELL')"'# Install the hook, if not alreadygrep"$HOOK"$SHELL_RC_FILE||echo"$HOOK">>$SHELL_RC_FILEsource$SHELL_RC_FILEThis is what the.envrcfile is for. It automatically activatesvenv.NotesOn Windows you should check the box during the Python installer
to includeScriptsdirectory in your%PATH%.  This can be done
manually after installation too.Main program works 100% on older OSes, buttestandlintmay break.Levenshtein speedup [extras]Install the Levenshtein speedup with this.pipinstallnutra[extras]Linux may need to installpython-devpackage as well asgcc.Windows may fail if missing theVisual Studiobuild tools are missing.Install PyPi release (from pip)pipinstall-Unutra(Specify:flag-Uto upgrade, or--prefor development releases)Using the source code directlyClone down, initializent-sqlitesubmodule, and install requirements:gitclonehttps://github.com/nutratech/cli.gitcdclimakeinit||source.venv/bin/activatemakedeps./nutra-hInitialize the DBs (ntandusda).# source .venv/bin/activate  # uncomment if NOT using direnv./nutrainit# Or install and run as package scriptmakeinstallninitIf installed (or insidecli) folder, the program can also run
withpython-mntclient.You may need to set thePY_SYS_INTERPRETERvalue for theMakefileif trying to install other than with/usr/bin/python3.Building the PyPi release (sdist)makebuild# python3 setup.py --quiet sdisttwineuploaddist/nutra-X.X.X.tar.gzLinting & TestsInstall the dependencies (make deps). Now you can lint & test.# source .venv/bin/activate  # uncomment if NOT using direnvmakeformatlinttestArgComplete (tab completion / autocomplete)Theargcompletepackage will be installed alongside.Linux, macOS, and Linux Subsystem for WindowsSimply run the following out of abashshell. Check their page for more
specifics on using other shells, e.g.zsh,fish, ortsh.activate-global-python-argcomplete--userThen you can press tab to fill in or complete sub-commands
and to list argument flags.Windows (Git Bash)This can work with git bash too. I followed the instructions on their README.I’ve run the command to seed the autocomplete script.mkdir-p$HOME/.bash_completion.dactivate-global-python-argcomplete--userAnd my~/.bashrcfile looks like this.exportARGCOMPLETE_USE_TEMPFILES=1# python bash completionif[-f~/.bash_completion.d/python-argcomplete];thensource~/.bash_completion.d/python-argcompletefiOn older versions it may bepython-argcomplete.shinstead.NOTE:Standard autocomplete is fully functional, we are adding customized
completions.Currently Supported DataUSDA Stock databaseStandard reference database (SR28)[7794 foods]USDA Extensions (Relational)Flavonoid, Isoflavonoids, and Proanthocyanidins[1352 foods]UsageRequires internet connection to download initial datasets.
Runnutra initfor this step.Runnornutrato output usage (-hflag is optional and defaulted).