aws-lambda-builders | Python library to compile , build & package AWS Lambda | Cloud Functions library
kandi X-RAY | aws-lambda-builders Summary
kandi X-RAY | aws-lambda-builders Summary
Python library to compile, build & package AWS Lambda functions for several runtimes & framework
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Calculate name and version
- Returns the path to the package info file
- Read data from filenames
- Parse an egg - info file
- Return the name and version of the package
- Location of the build output directory
- Compute the sha1 hash of the source directory
- Returns a dictionary containing the paths to the available binaries
- Returns a list of validators
- Create a symlink
- Copy files from source to destination
- Returns a list of actions that should be downloaded from the source directory
- Creates an InstallAction object
- Returns a list of path resolvers
- Return a list of additional python binaries
- Checks the version of the Lambda function
- Parse protocol version string
- Helper function to import pip
- Return the original environ
- Invoke the esbuild command
- Find an esbuild binary
- Returns a list of all the actions needed to build source
- Calculate the actions needed to build a workflow
- Builds a workflow
- Read a sequence of filenames
- Invoke the bundle
- Write response
aws-lambda-builders Key Features
aws-lambda-builders Examples and Code Snippets
Community Discussions
Trending Discussions on aws-lambda-builders
QUESTION
I have been getting the following error in my CodeBuild execution:
ModuleNotFoundError: No module named 'cfn_tools'
Interesting note, the first time I ran this through CodeBuild with this module I had no issues. It only started happening after I made my next gitHub push that kicked off my pipeline that I saw this. The files that are related to this didn't change, and the modifications in that next push were to an unrelated section of the repo.
I have since tried to do:
pip install cfn-tools
&pip3 install cfn-tools
which mentioned that the module was already installed. These were added to the BuildSpec section. No success - still got the error- I've added a requirements.txt file with no success still got the error. I created this file using
pip freeze
also within the BuildSpec. The module shows up, but still get the error. - Originally used runtime version 3.7 of python and then tried with 3.9 which still didn't work.
python runtime 3.9 Any assistance would be appreciated.
UPDATE: To add more information I download a .tar.gz file from S3 that contains the python scripts I need for running in this build. I extract the .tar.gz then I run the script that is having the error. Here is the output for when I install cfn-tools and do a pip freeze You will see below that cfn-tools loads and is part of the output of pip freeze but yet when I run my script it give me the above error.
...ANSWER
Answered 2021-Dec-20 at 19:11The module I was trying to install wasn't the one that was being used.
The module that needed to be installed was cfn_flip
it has the cfn_tools
module that the code was trying to use. The CodeBuild didn't have it installed, so how it worked on the first run is still a mystery.
QUESTION
I am certain that this issue is down to my own ignorance of Python and pip, however, I have scoured the net and tried many things to get this to work, so far, to no avail.
I have a docker image based on the Bitbucket pipelines default image (version 2): atlassian/default-image:2
, which uses Python 2.7.x. And SAM doesn't work with that, I looked at AWS' documentation and this said that the SAM CLI no longer supports Python 2.7.x, so I removed all Python installations from the docker container (debugging the Bitbucket pipeline locally) and attempted to make sure that there was only Python3 and pip3 installed (I even setup symlinks from /usr/bin/python
to /usr/bin/python3
and from /usr/bin/pip
to /usr/bin/pip3
- although, that seems like such a dumb thing to have to do).
I also tried doing the above with Python 3.6, as the error message (shown below) seemed to show a Python 'f-String' syntax, which according to Python's docs was introduced in 3.6.
Nothing I do seems to work and the more I look at this, the more I get tied up in an seemingly never ending web of Python versions and linux packages!
The error (and python versions) can be seen here:
...ANSWER
Answered 2021-Apr-13 at 03:51In most cases, instead of modifying the python installation in an existing image or installing a new one, I would recommend just using a docker image that already has python 3 installed. This bitbucket page talks about using different base images.
There's also a page about using a python base image spectifically.
Aside from this, depending on how you want to use SAM, you may be able to use the builtin Bitbucket "pipe" for deploying to SAM instead. Here is some info on pipes.. I think this would bypass the need to install SAM in your build.
I haven't used that particular pipe myself but the way I think it works is you build your deploy artifact file in your pipeline, caching it so it's available in future steps, then you set that file as the input for the SAM pipe to deploy it. The SAM pipe runs in a separate container, so it's already installed in that container. You just pass in the file.
Finally, I have never used SAM, so take this with a grain of salt, but I don't see a reference to installing the CLI with pip
either on the official AWS Linux installation docs or on the github page. I did find this issue, from which I glean the following:
pip
installation is possible but not recommended- Python 3.5 is not supported by aws sam cli
- If you use the installer in the instructions, it sounds like it will take care of the python versioning for you.
- They would like to target a single version of Python, so if you use pip, maybe the latest or 2nd latest Python version will work. Just a guess...
QUESTION
I'm both learning python and attempting to build multiple lambdas that will both store and process Spotify listening history. I originally wrote one lambda with all dependencies packaged in the same directory and imported using relative paths.
Once creating similar functions which use the same dependencies, I've split the dependencies from the function and built them using pip3 and setup.py. When running pip3 list I can see the packages as expected. To execute the function locally using sam build && sam local invoke SpotifyPlayHistoryListener --env-vars env.json --event events/event.json
and verify success, I'm specifying a layer I've built - this works!
To avoid having to rebuild the layer and modifying my function, I'd like to be able to revert to using a requirements.txt file and removing the specified layer.
Steps to reproduce the issue:
...ANSWER
Answered 2020-Feb-13 at 08:34As my dependencies weren't published to pypi, I needed to modify the entries in requirement.txt to use the actual file path to the package.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install aws-lambda-builders
You can use aws-lambda-builders like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page