Skip to content

🍔 Web app to calculate calories based on given food (flask, js, docker, heroku)

License

Notifications You must be signed in to change notification settings

vyahello/calorie-counter

Repository files navigation

Screenshot

Code style: black Checked with mypy Build Status Coverage Status License PyPI version shields.io PyPI pyversions PyPi downloads CodeFactor Docker pulls

Calorie counter

This project represents a simple web app to calculate calories based on given food type.

Tools

Production

  • front-end
    • html5
    • css3
    • javascript (vanilla)
  • back-end
    • python 3.6, 3.7, 3.8
    • flask

Development

Usage

Please check out app via:

Usage

Quick start

Please use the following command to run app via docker:

docker run -it -p 5001:5001 vyahello/calorie-counter:0.1.0 counter

Then please browse for http://0.0.0.0:5001 endpoint.

Source code

To be able to run source code please execute command below:

git clone [email protected]:vyahello/calorie-counter.git
cd calorie-counter
python3 -m venv venv
. venv/bin/activate
pip install -r requirements.txt
python -m counter --bind 0.0.0.0:5001 --debug

Also you can use flask built-in runner based on .flaskenv config file:

export FLASK_APP=counter
flask run

Then please open localhost:5003 endpoint in your browser.

PYPI Installation

Please run following script to obtain latest package from PYPI:

pip install calorie-counter

Then please execute instructions below to launch game from your environment:

>>> from counter import Bind, easyrun
>>> 
>>> easyrun(Bind("0.0.0.0:5003"))

Then please open localhost:5003 endpoint in your browser.

Development notes

CI

Project has Travis CI integration using .travis.yml file thus code analysis (black, mypy) and unittests (pytest) will be run automatically after every made change to the repository.

To be able to run code analysis, please execute command below:

./analyse-code.sh

Build docker images

To build base image please run the following command:

docker build --no-cache -t vyahello/calorie-counter:0.1.0 -f docker/Dockerfile .

To build main image please run the following command:

docker build --no-cache -t vyahello/calorie-counter:test -f docker/Dockerfile --build-arg VERSION=0.1.0 .

Please use the following commands to push image:

docker push vyahello/calorie-counter:test

Release notes

Please check changelog file to get more details about actual versions and it's release notes.

Meta

Author – Volodymyr Yahello

Distributed under the MIT license. See license for more information.

You can reach out me at:

Contributing

I would highly appreciate any contribution and support. If you are interested to add your ideas into project please follow next simple steps:

  1. Clone the repository
  2. Configure git for the first time after cloning with your name and email
  3. pip install -r requirements.txt to install all project dependencies
  4. pip install -r requirements-dev.txt to install all development project dependencies
  5. Create your feature branch (git checkout -b feature/fooBar)
  6. Commit your changes (git commit -am 'Add some fooBar')
  7. Push to the branch (git push origin feature/fooBar)
  8. Create a new Pull Request

What's next

All recent activities and ideas are described at project issues. If you have ideas you want to change/implement please do not hesitate and create an issue.