This project calculates the current cost of gas and returns the value in your currency. It is the Backend for this project
This is a Python Project built on the Serverless Framework with support for dependencies (using virtualenv & serverless-python-requirements) and tests (using unittest).
A thorough overview of the repo at Notion.
In order to promote a healthy and collaborative repo, please fork the repo and clone your fork to you machine to begin. Follow this guide on collaborating.
- Install Python
- Install Pipx
- Install Virtualenv
- Install NodeJs
- Install the Serverless Framework
- Configure your AWS CLI
Create a new project
$ git clone https://github.com/OladeleSeyi/chainSpy-backend.gitCreate a virtual environment for your project for Windows
$ cd chainSpy-backend
$ python -m venv venvFor Intel Macs
$ cd chainSpy-backend
$ virtualenv -p /usr/bin/python3 venvFor M1 Macs using Homebrew installed Python
$ cd chainSpy-backend
$ virtualenv -p /opt/homebrew/bin/python3.9 venvActivate the virtual environment
MAC
$ source venv/bin/activateWindows
$ source myenv/Scripts/activateInstall Serverless plugin: serverless-python-requirements
$ npm installInstall a Python dependency (for example, Requests)
$ pip install requestsRun on your Machine
sls offline startWhile this may be buggy on M1 macs, I hope it works for you.
Store a reference to your dependencies
$ pip freeze > requirements.txtRe-install your dependencies from your requirements
$ pip install -r requirements.txtInvoke a function locally
$ serverless invoke local -f hello
Run your tests
$ python -m unittest discover -s tests
Deactivate your virtual environment
$ deactivateDeploy your project
$ serverless deployDeploy a single function
$ serverless deploy function --function helloTo compile non-pure Python modules, install Docker and the Lambda Docker Image. Enable dockerizePip in serverless.yml and serverless deploy again.
# enable dockerize Pip
custom:
pythonRequirements:
dockerizePip: trueNote, if you are deploying using SEED, you don't need to enable dockerizePip or install Docker. SEED does it automatically.