Skip to main content

Round nutritional values for federal compliance

Project description

pre-commit.ci status PyPI Downloads

round-nutrition

A lightweight Python package to round nutritional values for federal compliance with FDA and NDC guidelines

>>> print([total_carb('0.8g'), vitamin_k('125.5 mcg')])
['less than 1g', '126mcg']
>>> print(total_carb('0.8 g', minimal=True))
<1g

Installation

Install the package:

pip install round-nutrition

Import the module:

from round_nutrition import * # or specific functions

Usage

All subnutrient functions take in an int or str argument for quantity

         General                   Vitamin                  Mineral                  Other
      added_sugars*           biotin                      calcium                   choline
      calories                folate                      chromium
      cholesterol*            niacin                      copper
      dietary_fiber*          pantothenic_acid            iodine
      insoluble_fiber*        riboflavin                  iron
      mono_fat                thiamine                    magnesium
      other_carb*             vitamin_a                   manganese
      poly_fat                vitamin_b12                 molybdenum
      potassium               vitamin_b6                  potassium
      protein*                vitamin_c                   phosphorus
      sat_fat                 vitamin_d                   selenium
      sodium                  vitamin_e                   zinc
      soluble_fiber*          vitamin_k
      sugar_alcohol*
      total_carb*
      total_fat
      total_sugars*
      trans_fat

⚠️ As of 1.1.x all functions are global with no need for special imports

*Has a boolean parameter of minimal to opt for a cleaner UI

Sources

Contributing

Make a pull request for any idea/fix you have, or make an issue if you're lazy

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

round-nutrition-1.1.1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

round_nutrition-1.1.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file round-nutrition-1.1.1.tar.gz.

File metadata

  • Download URL: round-nutrition-1.1.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for round-nutrition-1.1.1.tar.gz
Algorithm Hash digest
SHA256 d239ad41552fbf1c0f06b1ea05f13a57bc6da06c694fa4d868a4a4362062f63d
MD5 8bfc9f59c72e66fb3a4c9b6d2c4ba30d
BLAKE2b-256 ffeefc0ec6107fac3a667e53549f857481887a3d81b1cfb659507b445dba4412

See more details on using hashes here.

File details

Details for the file round_nutrition-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for round_nutrition-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fa0b57e58ebaca8e7dc660b710b101c86f74c12e65319f49be24646d8726e35c
MD5 f48b3498a2b4f2337881c1afca7e7536
BLAKE2b-256 dbbce42468b480f427c0a5a3f50ae79ac3140516c25c4f94191a931ecef60bbe

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page