{"_id":"@abudu/vercel-python-wsgi-fix","_rev":"1-a1ad262073e7fbce525edb017d565899","name":"@abudu/vercel-python-wsgi-fix","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@abudu/vercel-python-wsgi-fix","version":"1.0.0","description":"Python builder for WSGI applications on Vercel Fix","main":"index.js","repository":{"type":"git","url":"git+https://github.com/am-abudu/vercel-python-wsgi.git"},"author":{"name":"Abudu","email":"abudulin@foxmail.com"},"license":"MIT","private":false,"dependencies":{"command-exists":"^1.2.9","execa":"^1.0.0","fs.promised":"^3.0.0","node-fetch":"^2.6.1"},"devDependencies":{"eslint":"^5.16.0","eslint-config-airbnb-base":"^13.2.0","eslint-config-prettier":"^4.3.0","eslint-plugin-import":"^2.22.0","pre-commit":"^1.2.2"},"pre-commit":["lint","test"],"scripts":{"lint":"eslint . && flake8 .","test":"pytest ."},"gitHead":"8bd112ad2ec28e4d306688b40539d8f571debedf","bugs":{"url":"https://github.com/am-abudu/vercel-python-wsgi/issues"},"homepage":"https://github.com/am-abudu/vercel-python-wsgi#readme","_id":"@abudu/vercel-python-wsgi-fix@1.0.0","_nodeVersion":"14.17.6","_npmVersion":"8.3.0","dist":{"integrity":"sha512-YddIh3LWnFC7lkqQ7YDAa1F4wNs0ll4+EdUnlr200N7S49PXZ61wlj7F0iIWpmt5YIF1kFK8CRCm1CjesVyo9w==","shasum":"bec94458f2d74a383499be9bce7e4622fcd22777","tarball":"https://registry.npmjs.org/@abudu/vercel-python-wsgi-fix/-/vercel-python-wsgi-fix-1.0.0.tgz","fileCount":22,"unpackedSize":27407,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh+QOLCRA9TVsSAnZWagAAlq4P/1R91FnN7VqyoIiRHtoI\nA0aWqw5+sPMm1VVkVap36MSF8lrLlGfwUd9mOw0O0I/sZyzuu4+28B0ofYAc\nNelzwREL+8aofgIR9b+vJM1sLJCuJzEoBmE607vEgHV8svcvNqjXbvFNiJv3\nAStbgfqNeIg5L4dWS07a5ga1B1wn5mIQ2jAHXGCQz1nI4quy4DhiaGVItGTV\nPHOxNzzi3LQLj9UaNbQQ1Z05jYMecQsKbZXzFAGkC+/R/0rmoNqHMo2ijuqz\nylWKsWJIRzEdPaimcpVukqROjwpnW/DQjbDdKp7yQxRjoOomtHWCZNdN3tCB\n6vu+EY9etmV7GlotKiq7spUj9VRvPL0sU+FeAVWNDk86jXav6uae9kdxEAic\n9dZDq7fnQ6eWYDos7TEPiNQG2b2ngzUp6jFD4LW8eS99asHRG4YLpjMLRcSC\nHOYkmBsFuxk7nxMJ4ILtiZlWLsfdsE5JGh0r13oksqStSjslYhEtPanJ/AVK\nYZNbIKkC0G8xzl5lyq53IMrdzLbIXL4SqwMbpfFE7D1O6zvCo/ARnmTM1vMb\ny3IxORCs0u7cjDn99baaRJ/CibOXcwu5QuROOhxvnmEsvK9vWVf3FPG8V7XV\nTuoeofpdydAbXNvAf0t7ybkSyfpIZpGSD/8arriTf6UqoBzwDujI2nlbJ3Cf\nylRE\r\n=NwY3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAHy0TtiDTI6yPiQJJCor9n4FdeXHY078mj11rixKZGZAiEAyX//2GAdD9RiZ8u6qnmx6JkloMugBUDZnkhVvlrL3us="}]},"_npmUser":{"name":"abudu","email":"abudulin@foxmail.com"},"directories":{},"maintainers":[{"name":"abudu","email":"abudulin@foxmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vercel-python-wsgi-fix_1.0.0_1643709323782_0.5015575480943448"},"_hasShrinkwrap":false}},"time":{"created":"2022-02-01T09:55:23.682Z","1.0.0":"2022-02-01T09:55:23.942Z","modified":"2022-04-04T11:03:59.034Z"},"maintainers":[{"name":"abudu","email":"abudulin@foxmail.com"}],"description":"Python builder for WSGI applications on Vercel Fix","homepage":"https://github.com/am-abudu/vercel-python-wsgi#readme","repository":{"type":"git","url":"git+https://github.com/am-abudu/vercel-python-wsgi.git"},"author":{"name":"Abudu","email":"abudulin@foxmail.com"},"bugs":{"url":"https://github.com/am-abudu/vercel-python-wsgi/issues"},"license":"MIT","readme":"# vercel-python-wsgi\r\n*A Vercel builder for Python WSGI applications*\r\n\r\n[![NPM version](https://img.shields.io/npm/v/@ardnt/vercel-python-wsgi.svg)](https://www.npmjs.com/package/@ardnt/vercel-python-wsgi)\r\n[![Build Status](https://www.travis-ci.com/ardnt/vercel-python-wsgi.svg?branch=main)](https://www.travis-ci.com/ardnt/vercel-python-wsgi)\r\n[![License](https://img.shields.io/npm/l/@ardnt/vercel-python-wsgi)](https://github.com/ardnt/vercel-python-wsgi/blob/master/LICENSE)\r\n\r\n## Quickstart\r\n\r\nIf you have an existing WSGI app, getting this builder to work for you is a\r\npiece of 🍰!\r\n\r\n\r\n### 1. Add a Vercel configuration\r\n\r\nAdd a `vercel.json` file to the root of your application:\r\n\r\n```json\r\n{\r\n    \"builds\": [{\r\n        \"src\": \"index.py\",\r\n        \"use\": \"@ardnt/vercel-python-wsgi\",\r\n        \"config\": { \"maxLambdaSize\": \"15mb\" }\r\n    }]\r\n}\r\n```\r\n\r\nThis configuration is doing a few things in the `\"builds\"` part:\r\n\r\n1. `\"src\": \"index.py\"`\r\n   This tells Now that there is one entrypoint to build for. `index.py` is a\r\n   file we'll create shortly.\r\n2. `\"use\": \"@ardnt/vercel-python-wsgi\"`\r\n   Tell Now to use this builder when deploying your application\r\n3. `\"config\": { \"maxLambdaSize\": \"15mb\" }`\r\n   Bump up the maximum size of the built application to accommodate some larger\r\n   python WSGI libraries (like Django or Flask). This may not be necessary for\r\n   you.\r\n\r\n\r\n### 2. Add a Now entrypoint\r\n\r\nAdd `index.py` to the root of your application. This entrypoint should make\r\navailable an object named `application` that is an instance of your WSGI\r\napplication. E.g.:\r\n\r\n```python\r\n# For a Dango app\r\nfrom django_app.wsgi import application\r\n# Replace `django_app` with the appropriate name to point towards your project's\r\n# wsgi.py file\r\n```\r\n\r\nLook at your framework documentation for help getting access to the WSGI\r\napplication.\r\n\r\nIf the WSGI instance isn't named `application` you can set the\r\n`wsgiApplicationName` configuration option to match your application's name (see\r\nthe configuration section below).\r\n\r\n\r\n### 3. Deploy!\r\n\r\nThat's it, you're ready to go:\r\n\r\n```\r\n$ vercel\r\n> Deploying python-wsgi-app\r\n...\r\n> Success! Deployment ready [57s]\r\n```\r\n\r\n\r\n## Requirements\r\n\r\nYour project may optionally include a `requirements.txt` file to declare any\r\ndependencies, e.g.:\r\n\r\n```\r\n# requirements.txt\r\nDjango >=2.2,<2.3\r\n```\r\n\r\nBe aware that the builder will install `Werkzeug` as a requirement of the\r\nhandler. This can cause issues if your project requires a different version of\r\n`Werkzeug` than the handler.\r\n\r\n\r\n## Configuration options\r\n\r\n### `runtime`\r\n\r\nSelect the lambda runtime. Defaults to `python3.6`.\r\n```json\r\n{\r\n    \"builds\": [{\r\n        \"config\": { \"runtime\": \"python3.6\" }\r\n    }]\r\n}\r\n```\r\n\r\n\r\n### `wsgiApplicationName`\r\n\r\nSelect the WSGI application to run from your entrypoint. Defaults to\r\n`application`.\r\n```json\r\n{\r\n    \"builds\": [{\r\n        \"config\": { \"wsgiApplicationName\": \"application\" }\r\n    }]\r\n}\r\n```\r\n\r\n\r\n## Additional considerations\r\n\r\n### Routing\r\n\r\nYou'll likely want all requests arriving at your deployment url to be routed to\r\nyour application. You can do this by adding a route rewrite to the Now\r\nconfiguration:\r\n```json\r\n{\r\n    \"builds\": [{\r\n        \"src\": \"index.py\",\r\n        \"use\": \"@ardnt/vercel-python-wsgi\"\r\n    }],\r\n    \"routes\" : [{\r\n        \"src\" : \"/(.*)\", \"dest\":\"/\"\r\n    }]\r\n}\r\n```\r\n\r\n### Avoiding the `index.py` file\r\n\r\nIf having an extra file in your project is troublesome or seems unecessary, it's\r\nalso possible to configure Now to use your application directly, without passing\r\nit through `index.py`.\r\n\r\nIf your WSGI application lives in `vercel_app/wsgi.py` and is named `application`,\r\nthen you can configure it as the entrypoint and adjust routes accordingly:\r\n```json\r\n{\r\n    \"builds\": [{\r\n        \"src\": \"vercel_app/wsgi.py\",\r\n        \"use\": \"@ardnt/vercel-python-wsgi\"\r\n    }],\r\n    \"routes\" : [{\r\n        \"src\" : \"/(.*)\", \"dest\":\"/vercel_app/wsgi.py\"\r\n    }]\r\n}\r\n```\r\n\r\n### Lambda environment limitations\r\n\r\nAt the time of writing, Vercel runs on AWS Lambda. This has a number of\r\nimplications on what libaries will be available to you, notably:\r\n\r\n- PostgreSQL, so psycopg2 won't work out of the box\r\n- MySQL, so MySQL adapters won't work out of the box either\r\n- Sqlite, so the built-in Sqlite adapter won't be available\r\n\r\n\r\n## Contributing\r\n\r\n### To-dos\r\n\r\n- [ ] Add tests for various types of requests\r\n\r\n\r\n## Attribution\r\n\r\nThis implementation draws upon work from:\r\n\r\n- [@clement](https://github.com/rclement) on\r\n   [now-builders/#163](https://github.com/zeit/now-builders/pull/163)\r\n- [serverless](https://github.com/serverless/serverless) and\r\n   [serverless-wsgi](https://github.com/logandk/serverless-wsgi)\r\n- [@sisp](https://github.com/sisp) on\r\n   [now-builders/#95](https://github.com/zeit/now-builders/pull/95)\r\n- [Zappa](https://github.com/Miserlou/Zappa) by\r\n   [@miserlou](https://github.com/Miserlou)\r\n","readmeFilename":"README.md"}