GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing pypi.org — python-lambda python-lambda 11.8.0The bare minimum for a Python app running on Amazon Lambda. pip install python-lambda Python-lambda is a toolset for developing and deploying serverless Python code in AWS Lambda. A call for contributorsWith python-lambda and pytube both continuing to gain momentum, I'm calling for contributors to help build out new features, review pull requests, fix bugs, and maintain overall code quality. If you're interested, please email me at nficano[at]gmail.com. DescriptionAWS Lambda is a service that allows you to write Python, Java, or Node.js code that gets executed in response to events like http requests or files uploaded to S3. Working with Lambda is relatively easy, but the process of bundling and deploying your code is not as simple as it could be. The Python-Lambda library takes away the guess work of developing your Python-Lambda services by providing you a toolset to streamline the annoying parts. Requirements
Getting StartedFirst, you must create an IAM Role on your AWS account called
On your computer, create a new virtualenv and project folder. $ mkvirtualenv pylambda
(pylambda) $ mkdir pylambda
Next, download Python-Lambda using pip via pypi. (pylambda) $ pip install python-lambda
From your (pylambda) $ lambda init
This will create the following files: Let's begin by opening Next let's open def handler(event, context):
# Your code goes here!
e = event.get('e')
pi = event.get('pi')
return e + pi
This is the handler function; this is the function AWS Lambda will invoke in
response to an event. You will notice that in the sample code So if, for example, your function is responding to an http request, Next let's open the {
"pi": 3.14,
"e": 2.718
}
Here you'll find the values of If you now try and run: (pylambda) $ lambda invoke -v
You will get: # 5.858
# execution time: 0.00000310s
# function execution timeout: 15s
As you probably put together, the The When you're ready to deploy your code to Lambda simply run: (pylambda) $ lambda deploy
The deploy script will evaluate your virtualenv and identify your project dependencies. It will package these up along with your handler function to a zip file that it then uploads to AWS Lambda. You can now log into the AWS Lambda management console to verify the code deployed successfully. Wiring to an API endpointIf you're looking to develop a simple microservice you can easily wire your function up to an http endpoint. Begin by navigating to your AWS Lambda management console and clicking on your function. Click the API Endpoints tab and click "Add API endpoint". Under API endpoint type select "API Gateway". Next change Method to At last you need to change the return value of the function to comply with the standard defined for the API Gateway endpoint, the function should now look like this:
Now try and run: $ curl --header "Content-Type:application/json" \
--request POST \
--data '{"pi": 3.14, "e": 2.718}' \
https://<API endpoint URL>
# 5.8580000000000005
Environment VariablesLambda functions support environment variables. In order to set environment
variables for your deployed code to use, you can configure them in
environment_variables:
env1: foo
env2: baz
env3: ${LOCAL_ENVIRONMENT_VARIABLE_NAME}
This would create environment variables in the lambda instance upon deploy. If your functions don't need environment variables, simply leave this section out of your config. Uploading to S3You may find that you do not need the toolkit to fully
deploy your Lambda or that your code bundle is too large to upload via the API.
You can use the role: basic_s3_upload
bucket_name: 'example-bucket'
s3_key_prefix: 'path/to/file/'
Your role must have Deploying via S3You can also choose to use S3 as your source for Lambda deployments. This can
be done by issuing DevelopmentDevelopment of "python-lambda" is facilitated exclusively on GitHub. Contributions in the form of patches, tests and feature creation and/or requests are very welcome and highly encouraged. Please open an issue if this tool does not function as you'd expect. Environment Setup
Releasing to PypiOnce you pushed your chances to master, run one of the following: # If you're installing a major release:
make deploy-major
# If you're installing a minor release:
make deploy-minor
# If you're installing a patch release:
make deploy-patch
Project linksKey datesPyPI dataData sourced directly from PyPI's database.
5 maintainersPyPI dataData sourced directly from PyPI's database.
CreditsAuthor: Nick Ficano LicenseISC License (ISCL) (ISCL) Classifiers
MetadataProject linksKey datesPyPI dataData sourced directly from PyPI's database.
5 maintainersPyPI dataData sourced directly from PyPI's database.
CreditsAuthor: Nick Ficano LicenseISC License (ISCL) (ISCL) Classifiers
Release files for python-lambda 11.8.0For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation. Source distribution (sdist)
Built distribution (wheel)
Total release size: 35.9 kB Release files / python-lambda-11.8.0.tar.gz
Release files / python_lambda-11.8.0-py3-none-any.whl
Security for python-lambda 11.8.0ProvenanceProvenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats. No provenance foundNone of the files in this release were uploaded with provenance metadata. A note on package securityPyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package. To learn more about protecting yourself from malicious actors, visit our package security documentation. Release history Release notifications | RSS feed | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |