-
Poetry, used for managing dependencies, including Python versions.
-
Pyenv or pyenv-win, for managing Python versions themselves (why? because Vercel wants v3.9, so that's what we'll work with too).
Don't forget to Set up your shell environment for Pyenv if you're using the original version.
-
Clone the repo and switch to its directory:
$ git clone https://github.com/poopsicles/readme-now-playing $ cd readme-now-playing
-
First, we get the latest Python 3.9, as of writing that's 3.9.18:
$ pyenv install 3.9.18
- Set it as your default Python version for this project and install the dependencies:
$ pyenv local 3.9.18 $ poetry install
-
Copy
example.env
to.env
and fill it in with your credentials:$ cp example.env .env $ hx .env $ cat .env FIREBASE_CREDS=bmV2ZXJnb25uYWdpdmV5b3V1cAo= CLIENT_ID=bmV2ZXJnb25uYWxldHlvdWRvd24K CLIENT_SECRET=bmV2ZXJnb25uYXR1cm5hcm91bmRhbmRkZXNlcnR5b3UK REDIRECT_URL=https://localhost:5000/callback/q SCOPES=user-read-playback-state user-read-currently-playing user-read-recently-played user-top-read
-
Run the app with Poetry:
$ poetry run python3 api/index.py * Serving Flask app 'index' * Debug mode: on WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Running on https://localhost:5000 Press CTRL+C to quit * Restarting with stat * Debugger is active! ...
You can update dependencies with Poetry:
$ poetry update
As well as emit a requirements.txt
which Vercel seems to like (you might need to install the poetry-plugin-export plugin):
$ poetry export --without-hashes -f requirements.txt --output requirements.txt