- The Luncho server provides API so that your app or web site can show both Luncho prices and local prices. The API provides required data in LunchoData structure to client libraries. The client libraries calculate Luncho and local prices locally using cached LunchoData at the client side. So, the calculation is local and fast.
- The Luncho server provides OpenAPI so that you can generate the client libraries.
- See API documentation and schema definition.
- However, our client libraries have additional files for the local calculation and caching. See README.markdown files.
- The Luncho server hosts the Luncho app web site.
- Client
- Python
- TypeScript and Fetch
- Server
- Python3 or Pypy3
- FastAPI (Web framework)
- gunicorn (Optional)
- Supported platforms
- Google App Engine, standard or flexible
- or any Docker compatible server
- or any Python
- By default, we use exchangerate.host which is a free exchange rate data provider. The Luncho server updates the forex data at 00:06 UTC every day. LunchoData expires at the time. If 24-hour update cycle of the forex data is OK for you, skip to the installation as you don’t need to do anything about the exchange rate.
- However, if you want to use one hour update rather than the default 24-hour update, create a
user account on Fixer.io and set your access key to FIXER_API_KEY environment variable or write
it in app.yaml if you run on Google App Engine. If you don’t use, don’t set it.
export FIXER_API_KEY=XXXXXXXX
- Optionally you can use Google Cloud Storage (GCS) for backing up the exchange rates that will be
used when any of above foreign exchange rate API is unavailable. Set your bucket name to
GCS_BUCKET environment variable or write it in app.yaml if you run on Google App Engine. Usually
it is the same as the URL of GAE app.
export GCS_BUCKET=luncho-hirano.appspot.com
If you don’t use, don’t set it. The server saves the data in data/exchange-last.json file.
- Install pypy3 pypy3.7 (Python 3.9) or newer
(Mac) brew install pypy3 (Win) ? (Linux) ?
- Install Rust that is required to run pip
curl –proto ‘=https’ –tlsv1.2 -sSf https://sh.rustup.rs | sh (restart bash to add rustup to PATH) rustup install nightly ; rustup default nightly
- Run the install script to install pypy3 and so on. Check it before run!
bin/install-packages.sh
- You have pypyenv dir that includes site-packages.
bin/build.sh
bin/start-gunicorn.sh
- Open a browser at http://localhost:8000/v1/all-luncho-data for test for API access.
- See ../app/README.org how to run the Luncho app.
- Install gcloud SDK
- Make a project and deploy gcloud auth login (gcloud app create –project=luncho-hirano or your project name) gcloud config set project luncho-hirano (or your project name) gcloud app deploy –quiet
- build docker compose build –progress plain
- run docker run luncho-server_app
pypy3 main.py gen bin/build.sh
- Unit test server
- pytest test/test_server.py
- Unit test Python client library
- bin/start-gunicorn.sh
- pytest test/test_client_lib.py
- Unit test Python client library generated by the Open API generator
- cd ../luncho_python/test; pytest
Dr HIRANO Satoshi, Peace and Passion, University of Tokyo (AIST)
Copyright 2019-2022 The National Institute of Advanced Industrial Science and Technology (AIST), Japan