Feature Request: AWS Lambda
Answered
I don't know if this is feasible or not, but what about adding an AWS Lambda project type. There are some peculiar packaging and deployment requirements that might be handled very nicely by the some IDE features. Dependency files get bundled with each lambda code file and each lambda function sort of is a stand-alone app.
Testing would also be great if you could store some test profiles and have them submitted to the lambda function on AWS. I think a lot of the integration would just be a matter of file management and shelling out to an AWS CLI call on the local workstation.
just a thought.
Please sign in to leave a comment.
To date we've shied away from trying to support more of the various deployment services. Adding Docker proved to consume a bunch of effort and it was a struggle to get it right. And now, everything changed and we have to re-do it. :)
That said, it's worth considering. File a ticket in YouTrack and see if it gets a bunch of votes, thus percolating it higher on the list.
I will say that it might be a place we can add value. I read yesterday that it is a good service, but takes 20 steps to do anything with Python.
Fair enough. I've been wrestling with Docker myself and it has been daunting for a simple developer. All of this new DevOps stuff is really promising, but they are all so new that many of these technologies fell half-baked to me.
I'm planning on just using the raw python project type in pycharm to see if I can use it to manage my Lambda files. I'll take a shot at leveraging as much of the already included build tools to see how far I get before I have to drop to the command line.
If you were to take a look at something like this, I think the biggest area where PyCharm could add value would be in creating the uploadable packages and including/limiting the dependent libraries. I'm still new at this (like everyone else), so I'm not sure how that would actually play out.
Cheers!
Mike / Paul, Pycharm works well enough with AWS Lambda. My one question though is, is there a way to specify that the files in a particular folder should have different module import settings than other folders?
That is, for example, I might have two lambda functions, with these files
foo/lambda_fuction.py
foo/helpers.py
bar/lambda_function.py
bar/helpers.py
Is there a way to specify that all imports in folder "foo" should be done as if the application was being run from the directory "foo"? Or is there some way to do imports so that the "unresolved reference" warning doesn't appear and Python knows that I'm importing from the directory that lambda_function is stored in?
At this point, I think we've probably missed the boat a bit. Both serverless.com and the new aws sam frameworks have found ways to ease the pain of packaging and deploying node.js code. They both also support python and some compiled languages, but the node.js stuff just seems easier.
Owen: The first and best choice is to convert your project to a Python package with setup.py. The Python Packaging guide has a good tutorial on this. Also, Kenneth Reitz has a "packaging for humans" repo with best practices.
If it's just in PyCharm that you want that working, set your Run Configuration to have a working directory in foo for running each of those two lambdas, ditto for the other one.
Hi Paul, it's just PyCharm that I'm experiencing the pathing issue.
So, can you send a link to how to "have a working directory in foo for each of those two lambdas"?
I'm trying to get rid of the "unresolved reference" error.
Did you mark the directory as a sources root?
Awesome! - Setting it as source root totally fixed my issue.
Thank you Paul!
I've run across this thread a few times over the past year or so and dug it up specifically to post this:
https://aws.amazon.com/blogs/aws/new-aws-toolkits-for-pycharm-intellij-preview-and-visual-studio-code-preview/
Not directly a Lambda project type like what was asked for here, but definitely a step above what was previously available.
Enjoy!