Miserlou / Zappa

Serverless Python
https://blog.zappa.io/
MIT License
11.88k stars 1.2k forks source link

Can PYTHONPATH be made extendable? #1278

Open jefftriplett opened 6 years ago

jefftriplett commented 6 years ago

I'd love to see a setting for extending Python's PYTHONPATH.

Context

I ran into a corner case where I have two or three private checkouts of code. In a virtualenv, I can use add2virtualenv to extend PYTHONPATH, but I couldn't find an equivalent in Zappa.

I think this would be useful for others since I'm sure it's not uncommon.

efimerdlerkravitz commented 6 years ago

I had a similar problem in which I needed to extend PYTHONPATH, not sure you can exetend it from within a python script (Zappa in the end is Python). To avoid the problem I wrapped zappa with a small bash script, for example:

#!/usr/bin/env bash
export PYTHONPATH=`pwd`
zappa update
scoates commented 6 years ago

Pardon my ignorance (I haven't had to modify the PYTHONPATH with my previous Zappa work), but is this enough?

$ PYTHONPATH="$PYTHONPATH:/path/to/other/pythonpath:/tmp/etc" zappa update

?

If not, could you expand on what you need? I just don't understand.