Saravanan666/pypi-org huggingface dataset:
Package: aws-lambda-builders
## Lambda Builders![Apache 2.0 License](https://img.shields.io/github/license/aws/aws-lambda-builders)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/aws/aws-lambda-builders)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/aws-lambda-builders)
![pip](https://img.shields.io/badge/pip-aws–lambda–builders-9cf)Lambda Builders is a Python library to compile, build and package AWS Lambda functions for several runtimes &
frameworks.Lambda Builders currently contains the following workflowsJava with GradleJava with MavenDotnet with amazon.lambda.toolsPython with PipJavascript with NpmTypescript with esbuildRuby with BundlerGo with ModRust with CargoIn Addition to above workflows, AWS Lambda Builders also supportsCustom Workflowsthrough a Makefile.Lambda Builders is the brains behind thesam buildcommand from [AWS SAM CLI](https://github.com/awslabs/aws-sam-cli)### Integrating with Lambda BuildersLambda Builders is a Python library.
It additionally exposes a JSON-RPC 2.0 interface to use from other languages.If you intend to integrate with Lambda Builders,
check out [this section of the DESIGN DOCUMENT](DESIGN.md#builders-library).### ContributingIf you are a developer and interested in contributing, read the [DESIGN DOCUMENT](./DESIGN.md) to understand how this works.
Package: aws-lambda-cask
aws-lambda-caskWrapper to enable usage of Python WSGI frameworks (bottle, django, flask, etc.) within AWS Lambda environments.Supports v1.0 (API Gateway) and v2.0 (Lambda URL) payload formats.Installation$ pip install aws-lambda-caskFlask exampleimportflaskimportlambda_caskapp=flask.Flask(__name__)@app.route("/")defindex():return"eyy"defhandler(event,context):returnlambda_cask.handle(app,event,context)
Package: aws-lambda-context
A micro library that provides the AWS Lambda Context class for type checking and testing.Installingpip install aws-lambda-contextUsageImport the LambdaContext on your handler file and type hint the lambda function with it:fromaws_lambda_contextimportLambdaContextdefmy_lambda_handler(event:Any,context:LambdaContext)->None:...The type hint should enables type checking withmypyand editor auto-completionThe class is also useful as a mock during tests:fromaws_lambda_contextimport(LambdaClientContext,LambdaClientContextMobileClient,LambdaCognitoIdentity,LambdaContext)deftest_handler():lambda_cognito_identity=LambdaCognitoIdentity()lambda_cognito_identity.cognito_identity_id='cognito_identity_id'lambda_cognito_identity.cognito_identity_pool_id='cognito_identity_pool_id'lambda_client_context_mobile_client=LambdaClientContextMobileClient()lambda_client_context_mobile_client.installation_id='installation_id'lambda_client_context_mobile_client.app_title='app_title'lambda_client_context_mobile_client.app_version_name='app_version_name'lambda_client_context_mobile_client.app_version_code='app_version_code'lambda_client_context_mobile_client.app_package_name='app_package_name'lambda_client_context=LambdaClientContext()lambda_client_context.client=lambda_client_context_mobile_clientlambda_client_context.custom={'custom':True}lambda_client_context.env={'env':'test'}lambda_context=LambdaContext()lambda_context.function_name='function_name'lambda_context.function_version='function_version'lambda_context.invoked_function_arn='invoked_function_arn'lambda_context.memory_limit_in_mb='memory_limit_in_mb'lambda_context.aws_request_id='aws_request_id'lambda_context.log_group_name='log_group_name'lambda_context.log_stream_name='log_stream_name'lambda_context.identity=lambda_cognito_identitylambda_context.client_context=lambda_client_contextasserthandler({},lambda_context)=='something'Referenceshttps://docs.aws.amazon.com/lambda/latest/dg/python-context-object.html
Package: aws-lambda-deployment-package
Aws Lambda Deployment PackageA library that helps you create lambda deployment packages.RemarksThe project is written byLaimonas Sutkusand is owned byiDenfy. This is an open source
library intended to be used by anyone.iDenfyaims
to share its knowledge and educate market for better and more secure IT infrastructure.Release history1.2.3Bump.1.2.2Make sh files executable, add more logging, fix sh bugs.1.2.1Fix manifest file.1.2.0Expose path to install dir.1.1.0Expose path to deployment package property.1.0.0Initial project. Not tested. No extensive readme.
Package: aws-lambda-env-modeler
AWS Lambda Environment Variables Modeler (Python)AWS-Lambda-Env-Modeler is a Python library designed to simplify the process of managing and validating environment variables in your AWS Lambda functions.It leverages the power ofPydanticmodels to define the expected structure and types of the environment variables.This library is especially handy for serverless applications where managing configuration via environment variables is a common practice.📜Documentation|Blogs websiteContact details |ran.isenberg@ranthebuilder.cloudThe ProblemEnvironment variables are often viewed as an essential utility. They serve as static AWS Lambda function configuration.Their values are set during the Lambda deployment, and the only way to change them is to redeploy the Lambda function with updated values.However, many engineers use them unsafely despite being such an integral and fundamental part of any AWS Lambda function deployment.This usage may cause nasty bugs or even crashes in production.This library allows you to correctly parse, validate, and use your environment variables in your Python AWS Lambda code.Read more about ithereFeaturesValidates the environment variables against a Pydantic model: define both semantic and syntactic validation.Serializes the string environment variables into complex classes and types.Provides means to access the environment variables safely with a global getter function in every part of the function.Provides a decorator to initialize the environment variables before executing a function.Caches the parsed model for performance improvement for multiple 'get' calls.InstallationYou can install it using pip:pipinstallaws-lambda-env-modelerGetting startedHead over to the complete project documentation pages at GitHub pages athttps://ran-isenberg.github.io/aws-lambda-env-modelerUsageFirst, define a Pydantic model for your environment variables:frompydanticimportBaseModel,HttpUrlclassMyEnvVariables(BaseModel):DB_HOST:strDB_PORT:intDB_USER:strDB_PASS:strFLAG_X:boolAPI_URL:HttpUrlYou must first use the@init_environment_variablesdecorator to automatically validate and initialize the environment variables before executing a function:fromaws_lambda_env_modelerimportinit_environment_variables@init_environment_variables(MyEnvVariables)defmy_handler_entry_function(event,context):# At this point, environment variables are already validated and initializedpassThen, you can fetch and validate the environment variables with your model:fromaws_lambda_env_modelerimportget_environment_variablesenv_vars=get_environment_variables(MyEnvVariables)print(env_vars.DB_HOST)Code ContributionsCode contributions are welcomed. Read thisguide.Code of ConductRead our code of conducthere.ConnectEmail:ran.isenberg@ranthebuilder.cloudBlog WebsiteRanTheBuilderLinkedIn:ranisenbergTwitter:IsenbergRanLicenseThis library is licensed under the MIT License. See theLICENSEfile.
Package: aws-lambda-event
Welcome toaws_lambda_eventDocumentationThis library provides Python Class interface, attribute auto-complete, type hint for AWS Lambda Events. It can parse the AWS Lambda event data, and also generate fake event data for testing.Example:# An example lambda handler python moduleimportaws_lambda_event# parse S3 Put event, convert it into a python object with type hint, auto completedefhandler(event,context):event_obj=aws_lambda_event.S3PutEvent.from_dict(event)forrecordinevent_obj.Records:# access attribute_=record.eventTime# important attributes quick access alias_=record.bucket_=record.key_=record.etag_=record.size...# generate an fake event for testingevent_obj=aws_lambda_event.S3PutEvent.fake(bucket="my-bucket",key="my-file.txt")...List of Supported Event:CloudWatchLogsEventCloudWatchScheduledEventS3PutEventS3DeleteEventSNSTopicNotificationEventSQSEventDynamodbUpdateEventKinesisStreamEventKinesisFirehoseEventYou can find the event JSON schema in two place:AWS Lambda Event Source Mapping Official Document:https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventsourcemapping.htmlGoto AWS Lambda Function Console -> Create Test Event -> Choose from Event templateInstallaws_lambda_eventis released on PyPI, so all you need is:$pipinstallaws_lambda_eventTo upgrade to latest version:$pipinstall--upgradeaws_lambda_event
Package: aws-lambda-event-handler
AWS Lambda Event HandlerThis package provides a decorator for Python Lambda functions handling individual records in theeventpayload of the AWS Lambda function.UsageThis package provides two event decorators:sns- used to handle invokations that origin from a SNS Topic.dynamodb- used to handle invokations that origin from a DynamoDB Stream.Defining the HandlerThe following demonstrates how to create a handler object that will be used as the entrypoint for various event sources that trigger a AWS Lambda invokation:fromlambda_handlerimportLambdaHandlerhandler=LambdaHandler()#pylint: disable=C0103The handler object can then be used as a decorator for various Lambda Event Sources:fromlambda_handlerimportSNSMessage@handler.snsdefsns(message:SNSMessage,context)->None:"""Handle SNS Message"""print(message)@handler.dynamodbdefdynamodb(record:dict,context)->None:"""Handle DynamoDB record"""print(record)ModelsSNSMessageTheSNSMessagemodel makes it easier to interact with the data in the records and does some of the heavy lifting of pulling payload and attributes from the event letting you focus on your business logic.Installationpipinstallaws-lambda-event-handlerRequirementsNoneAuthorsJoris Conijn
Package: aws-lambda-event-models
aws-lambda-event-modelsPydantic models for AWS EventsFree software: MIT licenseDocumentation:https://aws-lambda-event-models.readthedocs.io.FeaturesTODOCreditsThis package was created with Cookiecutter and theaudreyr/cookiecutter-pypackageproject template.Cookiecutter:https://github.com/audreyr/cookiecutteraudreyr/cookiecutter-pypackage:https://github.com/audreyr/cookiecutter-pypackageHistory0.0.1 (2019-12-19)Second release on PyPI using Travis CI.0.0.0 (2019-12-19)First release on PyPI.
Package: aws-lambda-handler
aws-lambda-handlersBetter Python 3 AWS Lambda Handlers.Currently, your only choice for making Python handlers for AWS Lambda is to create a function like so:def handler(event, context):
    return TrueThis isn't ideal when you start dealing with more than one handler, or if you want to provide a configurable and reusable handler. This package provides three base classes, theHandler, theRequest, and theResponsehandler.TheHandlerclass is acallable, you create a subclass off of this, instantiate it, and that's what you configure AWSλ to invoke.YourHandlerhas to have aperform(self, request)method, this houses your handler's business logic,Handler.__call__executes this function and expects aResponseobject.TheResponseobject behaves like a dictionary and an object, an attribute calledserializedis returned to AWSλ.Therequestargument inperform(self, request)is aRequestobject, and it houses theeventandcontextparameters that AWSλ passes to your handler. Packaging those handler arguments into an object makes them available for transparent mutations, seeaws_lambda.apig.APIGatewayRequestfor reference.The foundation of this library is tiny, I recommend reviewing themain classesto further understand how to use this package.Usagepip install aws-lambda-handlerimportaws_lambdaclassEchoHandler(aws_lambda.Handler):"""Echo handler."""defperform(self,request,**k):"""Echo perform method."""response=aws_lambda.Response()response.body=self.request.eventreturnresponseecho_handler=EchoHandler()# `echo_handler` is now a callable function you can map your AWS Lambda function toDevelopFork this library and send over PRs, I will consider applications for contributors if two of your PRs gets merged and published.pipenv sync --dev # setup
pipenv run pytest # testSupported Event SourcesAPI Gatewayaws_lambda.apigS3DynamoDBSNSSESSQSCognitoCloudwatch Logs, EventsHelpWe want support for more event sources, I am willing to entertain PRs. You can use theaws_lambda.apigsubmodule as an example of implementing more event sources.
Package: aws-lambda-layer
Welcome toaws_lambda_layerDocumentationA simple tool that automates the process of building and deploying AWS Lambda layers and source artifacts. It utilizes a purposefully designed S3 folder structure to store all historical versions of artifacts.Usage Examples:build_layer.pybuild_source.pyYou may need additional tools to build your source artifacts:dopip install buildto usepython-mbuilddopip install poetryto usepoetry buildInstallaws_lambda_layeris released on PyPI, so all you need is:$pipinstallaws_lambda_layerTo upgrade to latest version:$pipinstall--upgradeaws_lambda_layer
Package: awslambdalocal
awslambdalocalawslambdalocal is a tool to simulate running an AWS Lambda locally, for lambda functions in Python.Table of ContentsRequirementsInstallationAbout: CLIPositional ArgumentsOptional ArgumentsCLI ExamplesTutorialsDebug Python in VSCodeRequirementsPython => 3.8Poetry => 1.1.12 or another package manager that supports direct git dependenciesInstallTo install awslambdalocal, we recommend adding it to your pyproject.toml in the dev-dependencies section as shown in the example below.pipinstallawslambdalocalObs.:We recommend using Poetry. Seehttps://python-poetry.org/docs/About: CLIPositional Arguments:ArgumentDescriptionfileSpecify Lambda function file nameOptional Arguments:ArgumentDescription--helpShow this help message and exit-eSpecify Event data file name. REQUIRED without param -w-hLambda function handler name. Default is "handler"-pRead the AWS profile of the file.-rSets the AWS region, defaults to us-east-1.-tSets lambda timeout. default: 3-wStarts lambda-local in watch mode listening to the specified port [1-65535].CLI Examples# Simple usagepyhton-mawslambdalocalmain.pytest-event.json# Input all argumentspyhton-mawslambdalocalmain.pytest-event.json-pmy_profile-rmy_region-hlambda_handler-t30TutorialsThis session contains a collection of tutorials.Debug Python in VSCodeTo use vscode debug with awslambdalocal follow the steps belowClick run and debugClick create a launch.json fileChoose PythonChoose ModuleSet the module name "awslambdalocal"After this process, VSCode will create a file called launch.json in the .vscode folder located at the root of the projectCopy and paste the json below into the launch.json file, this file aims to call the awslambdalocal module and passes the necessary and optional parameters as arguments{// Use o IntelliSense para saber mais sobre os atributos possíveis.// Focalizar para exibir as descrições dos atributos existentes.// Para obter mais informações, acesse: https://go.microsoft.com/fwlink/?linkid=830387"version":"0.2.0","configurations":[{"name":"Lambda Local",// Debug configuration name"type":"python",// Type of configuration. Python, Node and etc."request":"launch","module":"awslambdalocal",// Module that will be called,"cwd":"${workspaceFolder}",// Your project's root folder"args":["file_python.py",// Main file that will be called by lambda"your_test_event.json",//Input in json format that will be received by lambda// Optional args ..."-h","handler","-p","your_profile","-r","us-east-1"]}]}
Package: aws-lambda-log-collector
AWS Lambda Log CollectorIf you usually find yourself trying to debug AWS Lambda Functions and getting lost when trying to search for logs,
this CLI is meant for you.Imagine your Lambda Function had an invocation error spike during last night. Today after arriving at your company you
need to troubleshoot that error spike. You usually need to open CloudWatch Logs console and start to scroll infinitely
through the Log Streams, even worse if the Lambda Function has millions of invocations daily.This CLI will help you to gather all the useful CloudWatch Logs from a Lambda Function, with a single command while
you can go for your morning coffee.Why?Because you can search for a subset of the these logs providing a start and end time, and even better you can also
provide aCloudWatch Logs Filter Pattern.
Making it easier to find what you are looking for!UsageUsage:aws-lambda-log-collector[OPTIONS]Options:--versionShowtheversionandexit.-f,--function-nameTEXTi.e.HelloWorld[required]-p,--profileTEXTAWSprofilename(i.e.dev)[required]-r,--regionTEXTAWSregion(i.e.eu-west-1)[required]-o,--outputPATHi.e./tmp/[required]-s,--start-timeTEXT2019-10-30T12:00:00[required]-e,--end-timeTEXT2019-10-31T12:00:00[required]--patternTEXTERROR[required]--log-level[INFO|ERROR|DEBUG]logginglevel--helpShowthismessageandexit.Parameters--function-name || -fThe desired Lambda Function Name you want to retrieve logs from.--start-time || -sThe start of the time range where the CLI search for logs, CloudWatch Logs with a timestamp before this time are not
returned.Pattern: YYYY-mm-ddThh:MM:ss--end-time || -eThe end of the time range where the CLI search for logs, CloudWatch Logs with a timestamp after this time are not
returned.Pattern: YYYY-mm-ddThh:MM:ss--patternThe filter pattern to use while searching for logs content. You can use CloudWatch LogsFilter and Pattern Syntax.--output || -oThe output path where the CLI will store the logs.--region || -rThe AWS Region where you Lambda Function belongs to.--profile || -pA configured awsprofile.InstallationFrom pippipinstallaws-lambda-log-collectorFrom sourcegitclonehttps://github.com/mvinii94/aws-lambda-log-collector&&cdaws-lambda-log-collector

pipinstall-e.Sampleaws-lambda-log-collector--function-nameMyFunction\--start-time2019-11-10T23:30:00--end-time2019-11-11T03:30:00\--pattern"ERROR"--output/tmp/--regioneu-west-1--profiledev
Package: aws-lambda-logger-for-python
Better logging for aws lambda running on python runtime environment with a
highly opinionated JSON formatting to ease parsing on any logging system.Usageimport aws_lambda_logging


def handler(event, context):
    aws_lambda_logging.setup(level='DEBUG')
    ...You can separately set the logging level for Boto (defaults to the same level):import aws_lambda_logging


def handler(event, context):
    aws_lambda_logging.setup(level='DEBUG', boto_level='CRITICAL')
    ...You can add keyword arguments to be logged each time, such as lambda request
id.import aws_lambda_logging


def handler(event, context):
    aws_lambda_logging.setup(level='DEBUG',
                             aws_request_id=context.get('aws_request_id'))
    log.debug('Just a try!')
    ...It will output JSON formatted message:{
    "level": "DEBUG",
    "timestamp": "2016-10-03 13:27:57,438",
    "apigw_request_id": "323fee86-896d-11e6-b7fd-2d914ea80962",
    "location": "root.handler:6",
    "message": "Just a try!"
}You can input a JSON string:log.debug('{"Details": [1,2,3]}')It will output JSON formatted message with the JSON string embedded properly:{
    "level": "DEBUG",
    "timestamp": "2016-10-03 13:27:57,438",
    "apigw_request_id": "323fee86-896d-11e6-b7fd-2d914ea80962",
    "location": "root.handler:6",
    "message": {
        "Details": [
            1,
            2,
            3
        ]
    }
}You can input a dict:log.debug({"Details": [1,2,3]})It will output JSON formatted message with the dict values:{
    "level": "DEBUG",
    "timestamp": "2016-10-03 13:27:57,438",
    "apigw_request_id": "323fee86-896d-11e6-b7fd-2d914ea80962",
    "location": "root.handler:6",
    "message": {
        "Details": [
            1,
            2,
            3
        ]
    }
}Any values that can otherwise be serialisabled to JSON are coerced to
strings.  This behaviour can be changed by parsing a formatter
function to thejson_defaultkeyword argument.
Package: aws-lambda-logging
Better logging for aws lambda running on python runtime environment with a
highly opinionated JSON formatting to ease parsing on any logging system.Usageimport aws_lambda_logging


def handler(event, context):
    aws_lambda_logging.setup(level='DEBUG')
    ...You can separately set the logging level for Boto (defaults to the same level):import aws_lambda_logging


def handler(event, context):
    aws_lambda_logging.setup(level='DEBUG', boto_level='CRITICAL')
    ...You can add keyword arguments to be logged each time, such as lambda request
id.import aws_lambda_logging


def handler(event, context):
    aws_lambda_logging.setup(level='DEBUG',
                             aws_request_id=context.get('aws_request_id'))
    log.debug('Just a try!')
    ...It will output JSON formatted message:{
    "level": "DEBUG",
    "timestamp": "2016-10-03 13:27:57,438",
    "apigw_request_id": "323fee86-896d-11e6-b7fd-2d914ea80962",
    "location": "root.handler:6",
    "message": "Just a try!"
}You can input a JSON string:log.debug('{"Details": [1,2,3]}')It will output JSON formatted message with the JSON string embedded properly:{
    "level": "DEBUG",
    "timestamp": "2016-10-03 13:27:57,438",
    "apigw_request_id": "323fee86-896d-11e6-b7fd-2d914ea80962",
    "location": "root.handler:6",
    "message": {
        "Details": [
            1,
            2,
            3
        ]
    }
}You can input a dict:log.debug({"Details": [1,2,3]})It will output JSON formatted message with the dict values:{
    "level": "DEBUG",
    "timestamp": "2016-10-03 13:27:57,438",
    "apigw_request_id": "323fee86-896d-11e6-b7fd-2d914ea80962",
    "location": "root.handler:6",
    "message": {
        "Details": [
            1,
            2,
            3
        ]
    }
}Any values that can otherwise be serialisabled to JSON are coerced to
strings.  This behaviour can be changed by parsing a formatter
function to thejson_defaultkeyword argument.
Package: awslambda-psycopg2
psycopg2 Python Library for AWS LambdaThis is a custom compiled psycopg2 C library for Python. Due to AWS Lambda
missing the required PostgreSQL libraries in the AMI image, we needed to
compile psycopg2 with the PostgreSQLlibpq.solibrary statically linked
libpq library instead of the default dynamic link.I am just using the follwing git source and uploaded tohttps://pypi.org/Install and setuppip install aws-psycopg2Source code :https://github.com/jkehler/awslambda-psycopg2/tree/master/psycopg2Instructions on compiling this package from scratchHere was the process that was used to build this package. You will need to
perform these steps if you want to build a newer version of the psycopg2
library.Download thePostgreSQL source codeand extract into a directory.Download thepsycopg2 source codeand extract into a directory.Go into the PostgreSQL source directory and execute the following commands:./configure --prefix {path_to_postgresql_source} --without-readline --without-zlibmakemake installGo into the psycopg2 source directory and edit thesetup.cfgfile with the following:pg_config={path_to_postgresql_source/bin/pg_config}static_libpq=1Executepython setup.py buildin the psycopg2 source directory.After the above steps have been completed you will then have a build directory
and the custom compiled psycopg2 library will be contained within it. Copy this
directory into your AWS Lambda package and you will now be able to access
PostgreSQL from within AWS Lambda using the psycopg2 library.