Saravanan666/pypi-org huggingface dataset:
Package: lambda-error-sns-sender
Lambda Error SNS SenderA simple solution to improve the CloudWatch alarm to receive Lambda error details by email. Available as CDK construct or as CloudFormation.How does it work?Lambda is subscribed to the SNS topic where you receive your alarms.There is a message body subscription filter that limits errors based on the Lambda error metric. You must change the filter if you defied your metric in some other way, not the default one.Lambda analyzes the message, finds a log of the failed Lambda, and queries the log group for the period that the metric was configured, plus some additional safety time, so we do not miss that error message. It extracts just a number of errors that can fit in one SNS message.Lambda sends errors to the same SNSthat you use for alerts. So, apart from the Alarm message for changing the error state, you will receive an additional one with detailed error messages.The solution is in two forms:CDK constructIf you are building your system with CDK (orSST). Available for TypeScript, Java, C#, Python, and Go.CloudFormationFor existing solutions, so you do not have to modify them. You deploy and point to the existing SNS used for CloudWatch alarms.If you are interested how to use it and how was build see theblog post.
Package: lambda-face-recognition-prebuilt
# lambda_face_recognition_prebuilt
A prebuilt set of the dependencies needed to run face_recognition in AWS Lambda.## Usagepip install lambda_face_recognition_prebuiltThen, simply place this as the first import in your lambda function’s handler:import lambda_face_recognition_prebuilt.unpack## How it Works
The libs needed for face_recognition are built inside a Docker container that matches the environment in which AWS Lambda code is ran.Since the dependencies for face_recognition exceed the source code size limit of AWS Lambda functions, we do some ridiculousness to make it work. We zip up the deps and then unzip them at runtime.The unzipping of these deps at runtime will add overhead to your function’s start time. So, please keep that in mind in deciding whether to use this package.## See it in Action
[Here](https://github.com/JonathanPorta/lambda_face_recognition_example) is an example project that uses this project as one of its dependencies.
Package: lambdafactory
LambdaFactory is a library/tool/framework that eases the development of
programming languages by allowing you to plug-in your parser, drive the factory,
create your program representation and translate it Python, JavaScript,
ActionScript or Pnuts (and you can add your own).LambdaFactory provides a fine-grained OO model to represent your program, and
also offers a flexible architecture to insert your own program transformation
passes (documentation, representation, analysis, optimization)
Package: lambda-freezer
lambda_freezerGoals:Make it easy to deploy one or many services under the same Amazon API Gateway.Make it easy to deploy a stage in an immutable way.Deploy a specific stageThe main aim of this module is to help your Amazon API Gateway work in such a way that each stage is immutable.
This is achieved by using the versioning and aliasing features of Lambda function, as well as stage variables.
The gist is this:When deploying a stage, each underlying Lambda function is frozen to a specific version.When calling the resouces for that particular stage, the "frozen" versioning of Lambda functions will be called (indirectly via an alias).For more information of how that is achieved "manually" in more details:https://aws.amazon.com/blogs/compute/using-api-gateway-stage-variables-to-manage-lambda-functions/Python3.6.9(default,Nov72019,10:44:02)[GCC8.3.0]onlinux
Type"help","copyright","credits"or"license"formoreinformation.
>>>importlambda_freezer
>>>REST_API_ID="r5ltm5nqr6">>>REGION="us-east-1">>>APILIB_DEFAULT_ALIAS_NAME="uat">>>DOMAIN_NAME="api-library.puno.io"# this guy is optional>>>deploy(REST_API_ID,REGION,"0.0.1","some description",APILIB_DEFAULT_ALIAS_NAME,DOMAIN_NAME)Flow (super opinionated)use serverless framework and configure like something below.- provider:
      name: aws
      runtime: python3.6
      stage: latest # IMPORTANT - this need to match -> APILIB_DEFAULT_ALIAS_NAME
      versionFunctions: false # versioning would be done only upon deploying/"freezing" to a stage
      apiGateway: # make sure you point to a common api gateway
        restApiId:
          'Fn::ImportValue': 'OUTPUT-ApiGatewayRestApiId-REPLACE-WITH-OWN'
        restApiRootResourceId:
          'Fn::ImportValue': 'OUTPUT-ApiGatewayRestApiRootResourceId-REPLACE-WITH-OWN'To push your functions and make sure the api gateway integration gets changed.(We want that every function integrations' are such that the api gateway can only call a specific version of any lambda functions via an alias, using a stage variable).serverlessdeployPython3.6.9(default,Nov72019,10:44:02)[GCC8.3.0]onlinux
Type"help","copyright","credits"or"license"formoreinformation.
>>>importlambda_freezer
>>>REST_API_ID="r5ltm5nqr6">>>REGION="us-east-1">>>APILIB_DEFAULT_ALIAS_NAME="uat">>>DOMAIN_NAME="api-library.puno.io"# this guy is optional>>>run_after_default_deployment(REST_API_ID,REGION,APILIB_DEFAULT_ALIAS_NAME,DOMAIN_NAME)When you like a specific version of your functions, just "freeze" them using the deploy cmd described above.
Package: lambda_gateway
Lambda GatewayTest AWS Lambda functions invoked as API Gateway proxy integrations locally.This tool extends the native Python SimpleHTTPRequestHandler to proxy requests to a local Lambda function using the ThreadingHTTPServer.This tool is was specifically implemented to use the standard Python library only. No additional pip installation is required.After installing, navigate to the directory where your Lambda function is defined and invoke it with the CLI tool using the configured handler, eg:lambda-gateway[-pPORT][-tSECONDS]lambda_function.lambda_handler# => Serving HTTP on :: port 8000 (http://[::]:8000/) ...InstallationInstall with pip.pipinstalllambda-gatewayUsageCreate a Lambda function handler in Python 3# ./lambda_function.pyimportjsondeflambda_handler(event,context=None):# Get name from qsparams=event.get('queryStringParameters')or{}name=params.get('name')or'Pythonista'# Return responsereturn{'body':json.dumps({'text':f'Hello,{name}! ~ Lambda Gateway'}),'statusCode':200,'headers':{'Content-Type':'application/json',},}Start a local server with the signature of your Lambda handler as the argument.Note — the handler must be importable from the current working directorylambda-gateway[-BPATH][-bADDR][-pPORT][-tSECONDS]lambda_function.lambda_handler# => Starting LambdaRequestHandler at http://localhost:8000/Test the function with cURL.curlhttp://localhost:8000/?name=Pythonista# => {"text": "Hello, Pythonista! ~ Lambda Gateway"}TimeoutsAPI Gateway imposes a 30 second timeout on Lambda responses. This constraint is implemented in this project using Python's async/await syntax.The timeout length can be adjusted using the-t / --timeoutCLI option.lambda-gateway-t3lambda_function.lambda_handlerAPI Gateway PayloadsAPI Gateway supportstwo versionsof proxied JSON payloads to Lambda integrations,1.0and2.0.Versions0.8+of Lambda Gateway use2.0by default, but this can be changed at startup time using the-V / --payload-versionoption:lambda-gateway-V1.0lambda_function.lambda_handler
Package: lambda-git
lambda-gitA git binary installed through PyPI for AWS Lambda - inspired by the JavaScript packagelambda-git.Installation$pipinstalllambda-gitUsageTo use this, just require it and callexec_command. E.g:importgitgit.exec_command('init')# will run 'git init'Executing commands in a specific path:AWS Lambda give you only/tmpas working directory. This package by default will execute all commands in/tmp, but it can be overridden by passingcwd.importgitnew_repo_path='/tmp/my-new-repo'os.mkdir(new_repo_path)git.exec_command('init',cwd=new_repo_path)Executing commands with separate environment:By default every git command will be executed with the system environment, but it can be overridden by settingenv.importgitcommit_env=os.environcommit_env['GIT_AUTHOR_NAME']='My Name'commit_env['GIT_AUTHOR_EMAIL']='me@email.com'commit_env['GIT_COMMITTER_NAME']='My Name'commit_env['GIT_COMMITTER_EMAIL']='me@email.com'new_repo_path='/tmp/my-new-repo'git.exec_command('add','.',cwd=new_repo_path)git.exec_command('commit','-m "first commit"',cwd=new_repo_path,env=commit_env)Testing$python-mnoseContributingThis repository isopen to contributions.
Package: lambdagram
# lambdagramlambdagram is the library to help who want to create telegram bot with [official telegram bot api](https://core.telegram.org/bots/api) using webhook on AWS lambda.## IntroductionMain target of this library is who want to create telegram bot using webhook simply and easily. Especially for AWS lambda platform. Because AWS lambda do not allow to use polling mechanism for infinite loops. Just sending and receiving message through webhook. Not a big deal. But I believe this pretty helpful for someone who telegram and AWS lambda newbies.## Installing~~~pip install lamdbgram~~~## Telegram API support- getMe- setWebhook- getWebhookInfo- deleteWebhook## Key function the lambdagram support- send_message(self, event, msg, options...) - Efficient way, but you must set webhook before use this method using web browser.(https://api.telegram.org/bot{TOKEN}/setWebhook?url={WEBHOOKURL}, remove '{' and '}')- send_message(self, event, msg, webhook_url, options...) - Inefficient way, but it's useful for beginners.## How to use~~~from lambdagram.bot import BotTOKEN = "THE TOKEN YOU GOT FROM @BotFather"def lambda_handler(event, context): # Basic function signature on AWS lambdabot = Bot(TOKEN)bot.send_message(event, "THE MESSAGE YOU WANT TO SEND")~~~or~~~from lambdagram.bot import BotWEBHOOK = "https://YOUR-WEBHOOK-URL"TOKEN = "THE TOKEN YOU GOT FROM @BotFather"def lambda_handler(event, context): # Basic function signature on AWS lambdabot = Bot(TOKEN)bot.send_message(event, "THE MESSAGE YOU WANT TO SEND", WEBHOOK)~~~
Package: lambda-httpx
Lambda-httpx; use familiar async httpx library to access HTTP
enabled (simple proxy) AWS Lambda functionsQuick startInstallationpipintalllambda-httpxUsage ExamplesLambda-httpx provides a transport which can be mounted with the httpx client.
This then relays over all requests withhttp+lambda://to AWS lambda whose name matches the hostname.Using from existing event loop:importhttpxfromlambda_httpximportAsyncLambdaTransport# ...asyncwithAsyncLambdaTransport()astransport:mounts={"http+lambda://":transport}asyncwithhttpx.AsyncClient(mounts=mounts)asclient:response=awaitclient.get("http+lambda://flaskexp-test/health")Stand alone that calls endpoint 10 times asyncronously.importasyncioimporthttpxfromlambda_httpximportAsyncLambdaTransportasyncdefmain(count):asyncwithAsyncLambdaTransport()astransport:mounts={"http+lambda://":transport}asyncwithhttpx.AsyncClient(mounts=mounts)asclient:coros=[client.get("http+lambda://flaskexp-test/health")for_inrange(count)]returnawaitasyncio.gather(*coros)if__name__=="__main__":loop=asyncio.get_event_loop()responses=loop.run_until_complete(main(10))print(responses)A synchronous Transport also exists and can be utilized as follows:importhttpxfromlambda_httpximportLambdaTransportwithLambdaTransport()astransport:mounts={"http+lambda://":transport}withhttpx.Client(mounts=mounts)asclient:response=client.get("http+lambda://flaskexp-test/health")print(response)Lambda authorization is configured viaboto3, and can be set up usingenvironment variablesor aconfiguration file. Configuration file is
recommended. Example credential file ~/.aws/credentials:[default]aws_access_key_id=XXXXXXXXXXXXXXXXXXXXaws_secret_access_key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXSimilar to authorization, region can be configured either via theenvironment
variableAWS_DEFAULT_REGION,configuration file. Region can also be set
on initialization ofAsyncLambdaTransport(region=”us-west-2”). Example configuration
file ~/.aws/config:[profile default]region=us-west-2The lambdas must supportproxy integration, which is used commonly by frameworks
such asZappa,Mangum.WhyIn using REST microservice architecture it is important to be able to
conveniently make calls from one service to another. To use this pattern
in AWS serverless ecosphere along with Lambda one is practically forced
to stand up an API Gateway in front of the lambda. This has several distinct
disadvantages, all mostly along the lines of security.API Gateway publicly exposes endpointsAPI Gateway uses own authentication / authorization schema. While Lambda
already supplies us with IAM.Extra dependencies in call chain. While availability is high, latency may
still be of concern.Over all, to reduce exposure of private sub-services, re-use IAM authentication
/ authorization and reduce latency.How does its workSimple, we register a scheme name with httpx and use a lambda
specifictransport adapterwhich translates a httpx request
tolambda invokecompatible with AWS API Gateway simple proxy format.See alsoLambda-requests: Similar library that allows same functionality via python requests library.
Package: lambda-image-utils-prebuilt
# lambda_image_utils_prebuilt
A prebuilt set of the dependencies needed to run some common image utilities in AWS Lambda. This solves two main problems:Builds some dependencies that need to be built in the AWS Lambda runtime environment.Works arounds AWS Lambda’s source code size limitation.## Usagepip install lambda_image_utils_prebuiltThen, simply place this as the first import in your lambda function’s handler:import lambda_image_utils_prebuilt.unpack## How it Works
The libs needed for face_recognition are built inside a Docker container that matches the environment in which AWS Lambda code is ran.Since the dependencies for face_recognition exceed the source code size limit of AWS Lambda functions, we do some ridiculousness to make it work. We zip up the deps and then unzip them at runtime.The dependencies inprebuilt-requirements.txtare generally large dependencies, therefore, these are included as well so that you can keep the source code size of your Lambda function small enough to deploy.The unzipping of these deps at runtime will add overhead to your function’s start time. So, please keep that in mind in deciding whether to use this package.## See it in Action
[Here](https://github.com/JonathanPorta/lambda_face_recognition_example) is an example project that uses the [face_recognition portion](https://github.com/JonathanPorta/lambda_face_recognition_prebuilt) of this project as one of its dependencies.
Package: lambdalabs-python
Unofficial Lambda Labs Python SDKA Python library for interacting with the Lambda Labs Public APIGetting StartedInstall with pip:pipinstalllambdalabs-pythonGenerate an API keySet theLAMBDALABS_API_KEYenvironment variable:exportLAMBDALABS_API_KEY="secret_xxx"Example for orderung a server:importosfromlambdalabsimportLambdaLabsClientAPI_KEY=os.environ['LAMBDALABS_API_KEY']lambdalabs=LambdaLabsClient(API_KEY)# Get all instance typesinstance_types=lambdalabs.instance_types.get()# Filter out instance types that are availableavailable_instance_types=[instance_typeforinstance_typeininstance_typesiflen(instance_type.regions_with_capacity_available)>0]# Sort instance types by price and get the instance type with the lowest priceavailable_instance_types=sorted(available_instance_types,key=lambdainstance_type:instance_type.price_cents_per_hour)# Print the available instance types sorted by the lowest priceforinstance_typeinavailable_instance_types:print(instance_type)# Launch the selected instance, change the parameters accordingly:# region_name = 'us-tx-1'# instance_type_name = 'gpu_8x_a100_80gb_sxm4'# ssh_key_names = ['my-ssh-key']# file_system_names = []# quantity = 1# name = 'lambda-test-1'lambdalabs.instances.launch(region_name,instance_type_name,ssh_key_names,quantity,name)ExamplesCheckout the/examplesdirectory for more examples on how to use the Python SDK.
Package: lambda-layer-manager
Lambda Layer ManagerOverviewAutomatically build and deploy AWS Lambda layer.Config:{"layers":[{"name":"<name_of_the_layer>","requirements":"<path_to_requirements_file>","config":{"description":"<description>","compatible_runtimes":["<python3.10>"],"compatible_architectures":["<x86_64>"]}}]}An example configuration can be found in the./exampledirectory.QuickstartRun theLambda Layer Manager(llm) with the following command:llm<path/to/config_file>ContributionInstall the dependencies:poetryinstallEnable thepre-commithooks:pre-commitinstallLicenseThis project is licensed under the MIT license.
Package: lambda-layer-version-cleaner
lambda-layer-version-cleanerlambda-layer-version-cleaneris a CDK Construct that helps you manage and automatically clean up old versions of AWS Lambda Layers. It works with both JavaScript / TypeScript and Python CDK apps. Please note that this cleaner will only clean up versions of Lambda Layers in the region where it's deployed.InstallationFor JavaScript / TypeScript projects:npminstalllambda-layer-version-cleanerFor Python projects:pipinstalllambda-layer-version-cleanerUsageTo use theLambdaLayerVersionCleanerin your CDK project, simply import it and add it to your stack. Note that the cleaner will delete old versions of Lambda Layers even if they are associated with Lambda functions. Please ensure that you are aware of this behavior before using the cleaner in your project.JavaScript / TypeScriptimport*ascdkfrom'aws-cdk-lib';import*aseventsfrom'aws-cdk-lib/aws-events';import{LambdaLayerVersionCleaner}from'lambda-layer-version-cleaner';constapp=newcdk.App();conststack=newcdk.Stack(app,'ExampleStack');newLambdaLayerVersionCleaner(stack,'LambdaLayerVersionCleaner',{retainVersions:10,layerCleanerSchedule:events.Schedule.rate(cdk.Duration.days(7)),});Pythonfromaws_cdkimportcoreascdkfromaws_cdk.aws_eventsimportSchedulefromaws_cdk.coreimportDurationfromlambda_layer_version_cleanerimportLambdaLayerVersionCleanerapp=cdk.App()stack=cdk.Stack(app,"ExampleStack")LambdaLayerVersionCleaner(stack,"LambdaLayerVersionCleaner",retain_versions=10,layer_cleaner_schedule=Schedule.rate(Duration.days(7)))app.synth()ConfigurationTheLambdaLayerVersionCleanerconstruct takes two required parameters and two optional parameters:retainVersions: The number of layer versions to retain, specified as a positive integer. The cleaner will delete older versions beyond this count. Note that if a Layer has only one version, it won't be deleted.layerCleanerSchedule: The schedule for running the cleanup process.The optional parameters are:handlerTimeout(default:cdk.Duration.minutes(15)): Maximum allowed runtime for the Lambda function.handlerMemorySize(default:256): Amount of memory allocated to the Lambda function.
Package: lambdalib
Lambdalib IntroductionLambdalib is a modular hardware abstraction layer that helps decouple hardware design from manufacturing technology and proprietary IP. Lambdalib defines a set of technology independent generic functions that can be directly instantiated within the design. Technology specific implementations can be linked in at compile time.Lambdalib includes the following hardware categories:CategoryDescriptionstdlibStandard cells (inv, nand, ff, ...)ramlibMemory (single port, dual port, fifo, ...)iolibIO cells (bidir, vdd, clamp,...)padringPadring generatorvectorlibVectorized helper library (mux, isolation)syslibVendor agnostic peripheral interface(uart, i2c,...)TheLambdapdkrepository demonstrates implementation of the Lambdalib interfaces across a number of open source process technologies.Lambdalib has successfully used in multiple tapeouts usingSiliconCompiler.LicenseMITIssues / BugsWe useGitHub Issuesfor tracking requests and bugs.
Package: lambda-local
LAMBDA LOCALRunning a AWS lambda function in local host or pycharm.
Here we can run and debug the AWS lambda function from pycharm.Lambda handler functiondef handler(events, context):
    print("events :", events)
    print("context :", context)
    return eventsLocal lambda runfrom lambda_local.lambda_local import LambdaLocal

events = {"x": 7}

context = {"timeout": 100}

LambdaLocal(handler, events, context).run()
Package: lambdalumaapi
Luma API Python clientWARNING:We are no longer actively supporting this capture API. For Genie API, please contact us for information.Installationpip install lumaapiDocshttps://lumalabs.ai/luma-api/client-docs/index.htmlTo build docs: go to docs/ andmakehtmlNeed to install requirements first time (pip install -r docs/requirements.txt)ReleaseFirst install depspip install python-build twineThen update the version inpyproject.tomlandpython-mbuild
twineuploaddist/lumaapi-<x.x.x>.tar.gzFor Luma employees: Please get the password from 1Password (search PyPI)CLI usageTo submit a video:luma submit <path> <title>,
where path can be a video, zip, or directory.This outputs a slug.To check status of the capture:luma status <slug>To search user's captures:luma get <title>To manually authenticate:luma auth(CLI will also prompt when required)To check for credits:luma creditsLibrary usagefromlumaapiimportLumaClientclient=LumaClient(api_key)slug=client.submit(video_path,title)print(client.status(slug))Then use functions corresponding to the CLI
Package: lambdantic
lambdanticPydanticmodel and lambda event handler forAWS LambdaThis project is an experimental phase.What is Lambdantic ?The name meansAWS Lambda+pydanticlambdanticdispatch handler function from aws lambda events and to assign attributes from event object.InstallationTo installlambdantic:$pipinstalllambdanticExampleAPI GatewayThe example is simple api which is invoked by API Gateway.lambdanticparseLambda Proxy Integrationrequest.The example should be deployed byServerless,AWS CDKor other framework which supportsLambda Proxy Integration.# handler.pyfromtypingimportList,OptionalfrompydanticimportBaseModel,Schemafromlambdantic.apigatewayimportHandlerhandler=Handler()classPet(BaseModel):pet_id:Optional[int]=Schema(...,alias='id')name:strage:int# databasepets=[Pet(id=1,name='dog',age=3),Pet(id=2,name='cat',age=2)]@handler.get('/pets')defget_pets()->List[Pet]:returnpets@handler.get('/pets/<pet_id>')defget_pet(pet_id:int)->Pet:forpetinpets:ifpet.pet_id==pet_id:returnpet@handler.post('/pets',body_model=Pet,status_code=201)defcrate_pet(pet:Pet)->Pet:pet.pet_id=max(p.pet_idforpinpets)pets.append(pet)returnpetIf you use Serverless then, the handler is defined like this example.functions:pet:handler:handler.handlerevents:-http:method:anypath:/{proxy+}I show common parameters for Other frameworkHandler: handler.handler
API Gateway API integration type : Lambda Proxy Integration
Path: /{proxy+}
method: ANYImplementedAPI Gateway (WIP)Not ImplementedS3SNS
... and moreDevelopmentInstall the package in editable mode:$gitclonegit@github.com:koxudaxi/lambdantic.git
$pipinstall-elambdanticPyPihttps://pypi.org/project/lambdanticSource Codehttps://github.com/koxudaxi/lambdanticDocumentationhttps://koxudaxi.github.io/lambdanticLicenselambdantic is released under the MIT License.http://www.opensource.org/licenses/mit-license