@devjin8/vercel-poetry
v1.2.1
Published
A helper to deploy poetry based python api server project.
Downloads
9
Readme
VERCEL-POETRY
A helper to deploy poetry based python api server project.
Most of the codes are copied from Vercel's Python Package.
This module imitates the behavior of @vercel/python package.
Usage
Use this module in your builds
option in vercel.json
.
Check vercel-poetry-test repository to see the examples
{
...
"builds": [
{
"src": "api/main.py", // The file containing the main app (e.g. FastAPI)
"use": "@devjin8/vercel-poetry@latest"
}
],
// place custom redirects / rewrites here
}
How does this work?
The original @vercel/python
package installs dependencies from requirements.txt
into the current working path in the build process.
This module updated the behavior building process as the followings.
Removed
Pipfile.lock
file check.Install the
setuptools
andpoetry
module using current python environment. (Check Installing Poetry Manually.)Code is here
Creates the
requirements.txt
file using the following command.python -m poetry export --without-hashes -f requirements.txt --output requirements.txt
Code is here
vc_init.py
The exact copy of vc_init.py
at https://github.com/vercel/vercel/blob/main/packages/python/vc_init.py
Explanation
This file will be written as vc__handler__python.py
in work directory and will be the main entry file of web app.
It checks our app
(Django/Flask/FastAPI) or handler
(which are defined as entry point in vercel.json
file), and run WSGI, ASGI or Basic HTTP Server.