Skip to main content

An example of a package developed with pyenv, built with build using setuptools, uploaded to PyPI using twine, and distributed via pip.

Project description

Python Package Exercise

A little exercise to create a Python package, build it, test it, distribute it, and use it. See instructions for details.

Build & test

Description

Official Documentation

This is a lightweight, health-focused package that offers the following functionality:

  1. Calculates a user’s Body Mass Index determines where the user falls within the BMI scale, ranging from underweight to obese
  2. Identifies diseases associated with a certain, abnormal BMI level (underweight or overweight)
  3. Describes a balanced diet consisting of the amount, in grams, of proteins, carbohydrates, fat, sugar, saturated fats, as well as food energy in calories
  4. Calculates a user’s Active Metabolic Rate, with an option for the user to get his/her Basal Metabolic Rate.

Features

Calculate a user's BMI and render obesity scale:
howfat(age, height, weight, scale):
//Returns bmi score, scale

/More details about parameters:

* age - integer value representing age
* height - numeric value representing height
    * metric - float value in (cm)
    * imperial - float value in (in)
* weight- numeric value representing weight
    * metric - float value in (kg)
    * imperial - float value in (lbs)
* scale
    * "i" for imperial
    * "m" for metric

/Disclosure:
BMI and its respective obesity scale may not reflect a precise overview of one's health conditions, especially for ages under 18 and above 65.
Return list of related diseases by BMI:
fat_problems(bmi):
//Returns related diseases
Calculate a user's recommended daily calorie intake:
calories(age, gender, height, weight, activityLevel, scale):
//Returns recommended daily calorie intake

/More details about parameters

* age - integer value representing age
* gender
    * "f" for female
    * "m" for male
* height - numeric value representing height
    * metric - float value in (cm)
    * imperial - float value in (in)
* weight - numeric value representing weight
    * metric - float value in (kgs)
    * imperial - float value in (lbs)
* activityLevel- numeric value (integer) representing a user's activity level
    Use scale below:
    0-Basal Metabolic Rate
    1-Sedentary: little or no exercise
    2-Lightly active: exercise 1-3 times a week
    3-Moderately active: exercise 3-5 times a week
    4-Active: exercise 6-7 times a week
    5-Very active: hard exercise 6-7 times a week
* scale
    * "i" for imperial
    * "m" for metric
Calculate a user's resting energy expenditure
calculateREE(age, gender, height, weight, scale):

More details about parameters:

* age - integer value representing age
* gender
    "f" for female
    "m" for male
* height - numeric value representing height
    * metric - float value in (cm)
    * imperial - float value in (in)
* weight - numeric value representing weight
     * metric - float value in (kgs)
    * imperial - float value in (lbs)
* scale
    * "i" for imperial
    * "m" for metric
Calculate a user's total daily energy expenditure
calculateTDEE(REE, userActivityLevel)

More details about parameters

* REE - Resting Energy Expenditure in calories (how many calories burned at rest)

* userActivityLevel- numeric value (integer) representing a user's activity level
    Use scale below:
    1 - Sedentary: Just everyday activities like a bit of walking, a couple of flights of stairs, eating, talking, etc. (REE X 1.2)

    2 - Lightly active: Any activity that burns an additional 200-400 calories for females or 250-500 calories for males. (REE x 1.375)

    3 - Moderately active: Any activity that burns an additional 400-650 calories for females or 500-800 calories for males. (REE x 1.55)

    4 - Very Active: Any activity that burns an additional 650+ calories for females or 800+ calories for males. (REE x 1.725)
Calculate a user's target TDEE for weight loss or gain
weightLossOrGainCalculator(TDEE, lossOrGain)

More details about parameters

* weight - numeric value representing weight
q   * metric - float value in (kgs)
    * imperial - float value in (lbs)

* lossOrGain
    * 'l' for loss - aiming to lose weight
    * 'g' for gain - aiming to gain weight
* scale
    * "i" for imperial
    * "m" for metric
Calculate ideal macronutrient ratios for a given weight and TDEE
macros(weight, targetTDEE, scale)

More details about parameters

* TDEE - total daily energy expenditure in calories (amount of energy your body burns in a day)

* lossOrGain
    * 'l' for loss - aiming to lose weight
    * 'g' for gain - aiming to gain weight

How to Install and Use this Package

  1. Navigate to your desired root directory and execute
pipenv install -i https://pypi.org/simple/amIFat==1.1.0

(Prof B's note: if you've previously created a pipenv virtual environment in the same directory, you may have to delete the old one first. Find out where it is located with the pipenv --venv command.)

  1. Activate virtual environment with
pipenv shell
  1. Create a python program in the directory and import all the functions in the amIFat package with
//some imports you can make
from amIFat.macros import *
from amIFat.calories import *
from amIFat.howfat import *
from amIFat.fat_problems import *
  1. Install the amIFat package with
pipenv install amifat

ensure that the package is installed in your pipenv with pip list

  1. Implement the functions in your program and run it with
python3 path/to/yourProgram.py
  1. Exit the virtual environment with exit

How to Run Example App

python3 src/amIFatApp/app.py

Authors

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

amIFat-1.1.0.tar.gz (46.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

amIFat-1.1.0-py3-none-any.whl (33.7 kB view details)

Uploaded Python 3

File details

Details for the file amIFat-1.1.0.tar.gz.

File metadata

  • Download URL: amIFat-1.1.0.tar.gz
  • Upload date:
  • Size: 46.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for amIFat-1.1.0.tar.gz
Algorithm Hash digest
SHA256 639fc09b3faaf42037721c9e88c82edab82405af5a54297d83be0e780d2b0d89
MD5 da8fbc1c52cfbf52e9da7feb1927244c
BLAKE2b-256 c3b22bf17dfdcc12a289326804865de1eadabea639a099604471580e2f777b0f

See more details on using hashes here.

File details

Details for the file amIFat-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: amIFat-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 33.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for amIFat-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3abcd67e6b376fcaf82ce135169188f4494fd633e0fd2dbce1df06698906cd2d
MD5 e7bf719325da38227322a2dc6c78aad2
BLAKE2b-256 7844c505ee5f508bbcb43e3241f7e915873a5456fb161c63d112eb289e9d569c

See more details on using hashes here.

Supported by

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