up
up copied to clipboard
Better Python integration
I'm not too familiar with the ecosystem, it seems a little confusing to get it installing deps in the CWD without creating issues elsewhere. Need to research what the idiomatic approach is and adjust the default hooks accordingly—these may also vary for python2.7 and python3, I'm not positive.
Seems like homebrew's installation is also non-standard, which makes it more confusing :D
Most of this stuff works very similar to how node deps works, you just need to run pipenv
first to setup a "virtual python environment" using a specified Python version. Heroku handles this by checking for a runtime.txt
which contains python version .e.g 3.7
A very basic way to get this to work better is to also support pipenv
, which is nowadays the best practice in python-land.
E.g.
pipenv --python 3.7
pipenv install
Just like now its checking for requirements.txt
and running pip
, it could check for Pipfile.lock
and run the commands above
https://docs.pipenv.org/en/latest/basics/
For example, I prefer to use poetry instead of pipenv
. Someone may say conda. I think there are two options:
- Use
pip
to install dependencies fromrequirements.txt
and force user to update this file before deploy their code.pip
is available in all versions of Python out of box.pipenv
andpoetry
has a command to export dependencies torequirements.txt
. - Give an option to user to specify package management tool they use in the project. So the
up
will discover appropriate command to run to install dependencies.
Just verifying an assumption -- I've got an app written in python that's using python 3.6 features. It appears that the node10
Lambda runtimes appear to no longer ship with any python interpreter (I get "message": "sh: python: command not found"
when attempting to invoke it after deploying with up
) and the AWS node8
runtime appears to have an older python (3.4, maybe?) included.
Given that, I'm assuming that at this moment, there's not a good path for me deploying with up
, and I should bide my time or try another framework? (I still have a couple of lambdas deployed with apex
, still... ;)
Consider the above a scenario for which I'd love to use up
someday, regardless.
@adamehirsch yea that's correct unfortunately, they removed the binaries. If they ever make Lambda Layers more flexible, then I could easily add support for the other languages, but as-is they're not.
Even something similar like exposing the existing runtimes they support as Layer ARNs, I mentioned this stuff to them a year or so ago, but they don't seem interested. They make it really hard to add a "proxy" layer which handles the event while also allowing the user to choose their runtime.