Saravanan666/pypi-org huggingface dataset:
Package: aiosqs
aiosqsPython asynchronous and lightweight SQS client. The goal of this library is to provide fast and optimal access to SQS
for Python projects, e.g. when you need a high-load queue consumer or high-load queue producer written in Python.Supports Python versions 3.8, 3.9, 3.10, 3.11, 3.12.Supported and tested Amazon-like SQS providers: Amazon, VK Cloud.Why aiosqs?Main problem ofbotocoreandaiobotocoreis huge memory and CPU consumption.
Alsoaiobotocoreitself is a transition ofbotocoreto async interface without any optimizations.Related issues:https://github.com/boto/boto3/issues/1670https://github.com/aio-libs/aiobotocore/issues/940https://github.com/aio-libs/aiobotocore/issues/970InstallationInstall package:pipinstallaiosqsUsageCreate a client:fromaiosqsimportSQSClientclient=SQSClient(aws_access_key_id="access_key_id",aws_secret_access_key="secret_access_key",region_name="us-west-2",host="sqs.us-west-2.amazonaws.com",)Receive the queue url by queue name:response=awaitclient.get_queue_url(queue_name=queue_name)queue_url=response["QueueUrl"]Send a message to the queue:response=awaitclient.send_message(queue_url=queue_url,message_body=json.dumps({"demo":1,"key":"value"}),delay_seconds=0,)print(response)Receive a message from the queue:response=awaitclient.receive_message(queue_url=queue_url,max_number_of_messages=1,visibility_timeout=30,)ifresponse:print(response)receipt_handle=response[0]["ReceiptHandle"]Delete the message from the queue:awaitclient.delete_message(queue_url=queue_url,receipt_handle=receipt_handle,)Close the client at the end:awaitclient.close()Another option is to useSQSClientas an async context manager. No need to callclosemanually in this case. Example:fromaiosqsimportSQSClientasyncwithSQSClient(aws_access_key_id="access_key_id",aws_secret_access_key="secret_access_key",region_name="us-west-2",host="sqs.us-west-2.amazonaws.com",)asclient:response=awaitclient.get_queue_url(queue_name="dev_orders")queue_url=response["QueueUrl"]print(queue_url)
Package: aiossdb
# aiossdbaiossdb is a library for accessing an ssdb database from AsyncIO[![Coverage Status](https://coveralls.io/repos/github/Microndgt/aiossdb/badge.svg?branch=master)](https://coveralls.io/github/Microndgt/aiossdb?branch=master)![https://travis-ci.org/Microndgt/aiossdb.svg?branch=master](https://travis-ci.org/Microndgt/aiossdb.svg?branch=master)Requirements------------- Python 3.6+DONE and TODO-------------- [x] base async ssdb connection- [x] async ssdb parser- [x] async ssdb connection pool- [x] easy using ssdb async client- [x] tests- [ ] detailed docs- [ ] suppress ReplyError as a choice- [ ] releasing...- [ ] and more...Quick Start------------ ClientClient will create a connection pool, each time you execute the command will be from the available connection pool to get the connection, and then execute the command, and then releaseClient会创建一个连接池，在每次执行命令的时候都会去从可用连接池中拿到连接，然后执行命令，然后释放```loop = asyncio.new_event_loop()asyncio.set_event_loop(loop)async def just_look():c = Client(loop=loop)await c.set('a', 1)res = await c.get('a')print(res)await c.close()return resloop.run_until_complete(just_look())loop.close()```- ConnectionPool```import asynciofrom aiossdb import create_poolloop = asyncio.get_event_loop()async def connect_tcp():pool = await create_pool(('localhost', 8888), loop=loop, minsize=5, maxsize=10)# Use the direct implementation of the command pool# 使用pool直接执行命令await pool.execute('set', 'a', 2)val = await pool.execute('hget', 'hash_name', 'hash_key')print(val)# Use the pool to get the connection# 使用pool获取连接conn, addr = await pool.get_connection()await conn.execute('set', 'a', 2)val = await conn.execute('hget', 'hash_name', 'hash_key')print(val)# Get the final connection to be released# 获取的连接最后一定要releaseawait pool.release(conn)pool.close()await pool.wait_closed()loop.run_until_complete(connect_tcp())loop.close()```If you request a non-existent key, a `ReplyError` will be raised and the type of error may be: `not_found`, `error`, `fail`, `client_error`如果获取不存在的键等情况会引发`ReplyError`, 错误类型可能有: `not_found`, `error`, `fail`, `client_error````try:val = await conn.execute('hget', 'hash_name', 'hash_key')except ReplyError as e:print("Error type: {}".format(e.etype))print("Executed command: {}".format(e.command))```- Connection```import asynciofrom aiossdb import create_connection, ReplyErrorloop = asyncio.get_event_loop()async def connect_tcp():conn = await create_connection(('localhost', 8888), loop=loop)await conn.execute('set', 'a', 2)val = await conn.execute('hget', 'hash_name', 'hash_key')print(val)conn.close()await conn.wait_closed()loop.run_until_complete(connect_tcp())loop.close()```Exceptions----------- SSDBError- ConnectionClosedError- ReplyError- ProtocolError- PoolClosedErrorNOTES------ The preliminary test shows that `aiossdb` is 25 times fast than [pyssdb](https://github.com/ifduyue/pyssdb)Contributor===========Kevin Du--------- Email: `dgt_x@foxmail.com`- Site: `http://skyrover.me`
Package: aiossechat
aio-sse-chatSpecial python aio sse client module especially for parsing server-sent events (SSE) response from LLM.Modified fromaiohttp-sse-clientWhy need this?Normal SSE packages will not get correct value from streaming LLM response(in case you have not escape\nto\\n) since it will not parse the response correctly. This module will parse the response correctly and return the correct value.Also, LLM request usually need to submit aPOSTrequest while most current aio sse modules choose to raise error when submit aPOSTrequest. Though it is not a good practice to usePOSTrequest to get a streaming response, but it helps a lot for simplifying the code.Installationpipinstallaio-sse-chatUsageCreate your aiohttp session and useaiosseclientto wrap the session to do request.# fastapi side@app.post('/sse')# support all http methodsasyncdefsse_endpoint(data:dict):asyncdeff():foriinrange(10):yield'\n'awaitasyncio.sleep(0.2)returnEventSourceResponse(f())################### client sideimportaiohttpfromaiossechatimportaiosseclientasyncforeventinaiosseclient(url=some_url,method='post',json=some_data):print(data,end='',flush=True)# can get single `'\n'` correctly
Package: aiosseclient
Asynchronous Server Side Events (SSE) ClientSimilar tosseclientandsseclient-py, a tiny package for supporting Server Side Events (SSE) with py3.9asyncioandaiohttp.Install it with this:pip3 install aiosseclientSample code (read more):importasyncioimportaiohttpfromaiosseclientimportaiosseclientasyncdefmain():asyncforeventinaiosseclient('https://stream.wikimedia.org/v2/stream/recentchange'):print(event)loop=asyncio.get_event_loop()loop.run_until_complete(main())Alternative librariesThere are different libraries, apparently inspired from this library initially, that right now are
handling session close better using a different API,https://github.com/rtfol/aiohttp-sse-clienthttps://github.com/JelleZijlstra/aiohttp-sse-client2
Package: aiostalk
aiostalk is a small and shameless Python client library for communicating
with thebeanstalkdwork queue.It is based on (and requires) another library calledgreenstalkby Justin Mayhew.Getting StartedPresuming beanstalkd running on localhost at standard port.>>>importasyncio>>>importaiostalk>>>>>>asyncdefmain():...client=aiostalk.Client(('127.0.0.1',11300))...awaitclient.connect()...job_id=awaitclient.put('hello')...print(job_id)...job=awaitclient.reserve()...print(job.id)...print(job.body)...awaitclient.delete(job)...awaitclient.close()>>>>>>asyncio.run(main())1
1
helloUsing the Client as an asyncio context manager is also supported.DocumentationPlease see greenstalk docs atRead the Docs.
Package: aio-standalone
aio-standaloneStandalone application server framework using asyncio.InstallationGrab it off pypi:pip install aio-standaloneOr grab it off github:git clone https://github.com/kblin/aio-standalone.git
cd aio-standalone
pip install .LicenseAll code is available under the Apache License version 2, see theLICENSEfile for details.
Package: aiostaticmap
Static MapA small, python-based library for creating map images with lines and markers.Examplem=StaticMap(300,400,10)m.add_line(Line(((13.4,52.5),(2.3,48.9)),'blue',3))image=awaitm.render()image.save('map.png')This will create a 300px x 400px map with a blue line drawn from Berlin to Paris.InstallationStaticMap is a small library, all it takes is python and two python packages:Pillowandrequest. Install staticmap via:pipinstallaiostaticmapUsageCreate a new map instance:m=StaticMap(width,height,padding_x,padding_y,url_template,tile_size)parameterdescriptionwidthwidth of the image in pixelsheightheight of the image in pixelspadding_x(optional) minimum distance in pixel between map features (lines, markers) and map borderpadding_y(optional) minimum distance in pixel between map features (lines, markers) and map borderurl_template(optional) the tile server URL for the map base layer, e.g.http://a.tile.osm.org/{z}/{x}/{y}.pngtile_size(optional) tile size in pixel, usually 256Add a line:line=Line(coordinates,color,width))m.add_line(line)parameterdescriptioncoordinatea sequence of lon/lat pairscolora color definition Pillowsupportswidththe stroke width of the line in pixelsimplifywhether to simplify coordinates, looks less shaky, default is trueAdd a map circle marker:marker=CircleMarker(coordinate,color,width))m.add_marker(marker)parameterdescriptioncoordinatea lon/lat pair: e.g.(120.1, 47.3)colora color definition Pillowsupportswidthdiameter of marker in pixelAdd a polygon:polygon=Polygon(coordinates,fill_color,outline_color,simplify)m.add_polygon(polygon)parameterdescriptioncoordinatea lon/lat pair: e.g.[[9.628, 47.144], [9.531, 47.270], [9.468, 47.057], [9.623, 47.050], [9.628, 47.144]]fill_colora color definition Pillowsupportsoutline_colora color definition Pillowsupportssimplifywhether to simplify coordinates, looks less shaky, default is trueSamplesShow Position on MapfromsrcimportStaticMap,CircleMarkerm=StaticMap(200,200,url_template='http://a.tile.osm.org/{z}/{x}/{y}.png')marker_outline=CircleMarker((10,47),'white',18)marker=CircleMarker((10,47),'#0036FF',12)m.add_marker(marker_outline)m.add_marker(marker)image=awaitm.render(zoom=5)image.save('marker.png')Show Ferry ConnectionfromsrcimportStaticMap,Linem=StaticMap(200,200,80)coordinates=[[12.422,45.427],[13.749,44.885]]line_outline=Line(coordinates,'white',6)line=Line(coordinates,'#D2322D',4)m.add_line(line_outline)m.add_line(line)image=awaitm.render()image.save('ferry.png')Show Icon MarkerfromsrcimportStaticMap,IconMarkerm=StaticMap(240,240,80)icon_flag=IconMarker((6.63204,45.85378),'./samples/icon-flag.png',12,32)icon_factory=IconMarker((6.6015,45.8485),'./samples/icon-factory.png',18,18)m.add_marker(icon_flag)m.add_marker(icon_factory)image=awaitm.render()image.save('icons.png')LicenceStaticMap is open source and licensed under Apache License, Version 2.0The map samples on this page are made withOSMdata, ©OpenStreetMapcontributors
Package: aiosteady
aiosteadyis an MIT licensed library, written in Python, for rate limiting
in asyncio applications using Redis and theaioredislibrary.aiosteady currently implements theleaky bucket algorithmin a very efficient way.max_capacity=10# The bucket can contain up to 10 drops, starts with 0drop_recharge=5.0# 5 seconds between drop recharges.throttler=Throttler(aioredis,max_capacity,drop_recharge)# consume() returns information about success, the current bucket level,# how long until the next drop recharges, etc.res=awaitthrottler.consume(f'user:{user_id}')InstallationTo install aiosteady, simply:$pipinstallaiosteadyUsageThe leaky bucket algorithm follows a simple model.A single bucket contains a number of drops, called the bucket level. Buckets start with zero drops.Buckets have a maximum capacity of drops.Each use of the bucket (consumption) inserts one or more drops into the bucket, up until the maximum capacity. If the bucket would overflow, the consumption fails.One drop leaks out everydrop_rechargeseconds, freeing space in the bucket for a new drop to be put into it.The bucket may also be manually drained.In addition to making the consumption fail, full buckets can optionally be configured to block further attempts to consume for a period.Create an instance ofaiosteady.leakybucket.Throttler, giving it an instance
of anaioredisclient and rate limiting parameters (the maximum bucket
capacity, the number of seconds it takes for a drop to leak out, and an
optional blocking duration).AThrottlersupports two operations: consuming and peeking.awaitThrottler.consume("a_key")(consumebecause it consumes bucket resources)
attempts to put the given number of drops (default 1) into the bucket at the
given key. It returns an instance ofaiosteady.leakybucket.ThrottleResult,
with fields for:success: a boolean, describing whether the consumption was successfullevel: an integer, describing the new level of the bucketuntil_next_drop: a float, describing the number of seconds left after the next drop regeneratesblocked_for: an optional float, if blocking is being used and the bucket is blocked, the number of seconds until the block expiresIf the number of drops given is negative, drops are instead removed from the bucket. The bucket may not go below zero drops.awaitThrottler.peek("a_key")returns the sameThrottleResultbut without attempting to
consume any drops.Both operations are implemented using a single Redis call, using Lua scripting.Changelog22.1.0 (UNRELEASED)Switch to CalVer.Add Python 3.10 support.Add support for recharging the bucket (removing existing drops).Switch the main branch name frommastertomain.0.2.1 (2021-05-12)Improve theattrsdependency specification, sinceattrsuses CalVer.0.2.0 (2021-04-08)Use the Redisevalshainstead ofeval, for efficiency.0.1.0 (2021-03-07)Initial release.CreditsThe Lua Redis script for atomic leaky bucket has been taken and heavily adapted from theProrateproject.
Package: aiosteamist
Async SteamistControl Steamist steam systemsInstallationInstall this via pip (or your favourite package manager):pip install aiosteamistContributors ✨Thanks goes to these wonderful people (emoji key):This project follows theall-contributorsspecification. Contributions of any kind welcome!CreditsThis package was created withCookiecutterand thebrowniebroke/cookiecutter-pypackageproject template.
Package: aiosteampy
AIOSTEAMPYPreviously this library was a soft fork ofbukson/steampyand created only to
provide asynchronous methods and proxies support.
But now itstandaloneproject. Created by myself for steam trading purposes mostly.[!IMPORTANT]
See full documentationhere📖InstallationpipinstallaiosteampypipenvinstallaiosteampypoetryaddaiosteampyProject have extracurrencies converterwith
target dependencyaiosteampy[converter]. For instance:poetryaddaiosteampy[converter][!TIP]aiohttp docsrecommends installing speedups (aiodns,cchardet, ...)AIOSTEAMPY useaiohttpunderneath to do asynchronous requests to steam servers,
with modern async/await syntax.Generally, project inspired most
byDoctorMcKay/node-steamcommunityKey featuresStateless: the main idea was a low-middle layer API wrapper of some steam services and methods like market,
tradeoffers, confirmations, steamguard, etc. But if you want to cache your entities data (listings, confirmations,
...)there is some methods to help.Declarative: there is models almost for every data.Typed: for editor support most things are typed.Short: I really tried to fit most important for steam trading methods.What can I do with thisOperate with steam trade offers for any manner.Sell, buy items on market. Place, cancel orders.Login trough steam to 3rd party sites.Fetch data from market.Manipulate many accounts with proxies for each session.Store and load cookies to stay logged in.Convert market prices into different currencies.What I can't doChat (at least for now).Get apps, packages.All, that need connection to CM.Interact with game servers (inspect CS2 (ex. CSGO) items, ...).Edit profile, social interaction(groups, clans).Handle entities (listings, items, tradeoffers) lifecycle for easy if you need to store it.Tests 🧪Readtest documentation📖Contribution 💛There is no rules or requirements to contribute. Feedbacks, suggests, other are welcome.
I will be very grateful for helping me get the things right.Creditsbukson/steampyDoctorMcKay/node-steamcommunityIdentifying Steam itemsRevadike/InternalSteamWebAPIGobot1234/steam.pySteam Market id's storage reposteamapi.xpaw.meSteam Exchange Rate Tracker
Package: aiostomp
AiostompSimple asyncio stomp 1.1 client for python 3.6.Heavely inspired ontorstomp.Installwith pip:pipinstallaiostompUsageimportsysimportloggingimportasynciofromaiostompimportAioStomplogging.basicConfig(format="%(asctime)s-%(filename)s:%(lineno)d- ""%(levelname)s-%(message)s",level='DEBUG')asyncdefrun():client=AioStomp('localhost',61613,error_handler=report_error)client.subscribe('/queue/channel',handler=on_message)awaitclient.connect()client.send('/queue/channel',body=u'Thanks',headers={})asyncdefon_message(frame,message):print('on_message:',message)returnTrueasyncdefreport_error(error):print('report_error:',error)defmain(args):loop=asyncio.get_event_loop()loop.run_until_complete(run())loop.run_forever()if__name__=='__main__':main(sys.argv)DevelopmentWith empty virtualenv for this project, run this command:makesetupand run all tests =)maketestContributingFork, patch, test, and send a pull request.
Package: aiostp
asyncio client library for stpmex.comSTP – Async python client library for stpmex.comInstallationpip install aiostpAuthenticationThe preferred way to configure the credentials for the client is to set theSTP_PRIVATE_LOCATIONandSTP_KEY_PASSPHRASEenvironment variables. The client
library will automatically configure based on the values of those variables.STP_PRIVATE_LOCATIONcan be the route to the file, or the private key itself.To configure manually:importaiostpaiostp.configure(priv_key='PKxxxx',priv_key_passphrase='yyyyyy')
Package: aiostream
Generator-based operators for asynchronous iterationSynopsisaiostreamprovides a collection of stream operators that can be combined to create
asynchronous pipelines of operations.It can be seen as an asynchronous version ofitertools, although some aspects are slightly different.
Essentially, all the provided operators return a unified interface called a stream.
A stream is an enhanced asynchronous iterable providing the following features:Operator pipe-lining- using pipe symbol|Repeatability- every iteration creates a different iteratorSafe iteration context- usingasync withand thestreammethodSimplified execution- get the last element from a stream usingawaitSlicing and indexing- using square brackets[]Concatenation- using addition symbol+RequirementsThe stream operators rely heavily on asynchronous generators (PEP 525):python >= 3.6Stream operatorsThestream operatorsare separated in 7 categories:creationiterate,preserve,just,call,empty,throw,never,repeat,count,rangetransformationmap,enumerate,starmap,cycle,chunksselectiontake,takelast,skip,skiplast,getitem,filter,until,takewhile,dropwhilecombinationmap,zip,merge,chain,ziplatestaggregationaccumulate,reduce,listadvancedconcat,flatten,switch,concatmap,flatmap,switchmaptimingspaceout,timeout,delaymiscellaneousaction,printDemonstrationThe following example demonstrates most of the streams capabilities:importasynciofromaiostreamimportstream,pipeasyncdefmain():# Create a counting stream with a 0.2 seconds intervalxs=stream.count(interval=0.2)# Operators can be piped using '|'ys=xs|pipe.map(lambdax:x**2)# Streams can be slicedzs=ys[1:10:2]# Use a stream context for proper resource managementasyncwithzs.stream()asstreamer:# Asynchronous iterationasyncforzinstreamer:# Print 1, 9, 25, 49 and 81print('->',z)# Streams can be awaited and return the last valueprint('9² = ',awaitzs)# Streams can run several timesprint('9² = ',awaitzs)# Streams can be concatenatedone_two_three=stream.just(1)+stream.range(2,4)# Print [1, 2, 3]print(awaitstream.list(one_two_three))# Run main coroutineloop=asyncio.get_event_loop()loop.run_until_complete(main())loop.close()More examples are available in theexample sectionof the documentation.ContactVincent Michel:vxgmichel@gmail.com
Package: aiostun
Async STUN client for PythonKey FeaturesSupport RFC3489Transports UDP, TCP and TLSIPv4 and IPv6 supportSupport RFC5389Support RFC5780Support RFC8489InstallationThis module can be installed frompypiwebsitepipinstallaiostunGetting your mapped addressimportaiostunimportasyncioasyncdefmain():asyncwithaiostun.Client(host='openrelay.metered.ca',port=443,ipproto=aiostun.TLS)asstunc:mapped_addr=awaitstunc.get_mapped_address()print(mapped_addr){'family':'IPv4','port':38778,'ip':'xx.xx.xx.xx'}asyncio.run(main())Default constants for family:aiostun.IP4(default)aiostun.IP6Default constants for IP protocol:aiostun.UDP(default)aiostun.TCPaiostun.TLSThe default remote port is3478with a timeout connection of2 seconds.For developersRunning all test units.python3-munittestdiscovertests/-v
Package: aiosu
Simple and fast asynchronous osu! API v1 and v2 library with various utilities.FeaturesSupport for modern async syntax (async with)Support for API v1 and API v2Rate limit handlingUtilities for osu! related calculationsEasy to useInstallingPython 3.9 or higher is requiredTo install the library, simply run the following commands# Linux/macOSpython3-mpipinstall-Uaiosu# Windowspy-3-mpipinstall-UaiosuTo install the development version, do the following:$gitclonehttps://github.com/NiceAesth/aiosu$cdaiosu$python3-mpipinstall-U.API v1 Exampleimportaiosuimportasyncioasyncdefmain():# async with syntaxasyncwithaiosu.v1.Client("osu api token")asclient:user=awaitclient.get_user(7782553)# regular syntaxclient=aiosu.v1.Client("osu api token")user=awaitclient.get_user(7782553)awaitclient.aclose()if__name__=="__main__":asyncio.run(main())API v2 Exampleimportaiosuimportasyncioimportdatetimeasyncdefmain():token=aiosu.models.OAuthToken.model_validate(json_token_from_api)# ortoken=aiosu.models.OAuthToken(access_token="access token",refresh_token="refresh token",expires_on=datetime.datetime.utcnow()+datetime.timedelta(days=1),# can also be string)# async with syntaxasyncwithaiosu.v2.Client(client_secret="secret",client_id=1000,token=token)asclient:user=awaitclient.get_me()# regular syntaxclient=aiosu.v2.Client(client_secret="secret",client_id=1000,token=token)user=awaitclient.get_me()awaitclient.aclose()if__name__=="__main__":asyncio.run(main())You can find more examples in the examples directory.ContributingPlease read theCONTRIBUTING.rstto learn how to contribute to aiosu!Acknowledgmentsdiscord.pyfor README formattingosu!Akatsukifor performance and accuracy utils
Package: aiosubprocess
UsageReleaseDevelopmentaiosubprocessAzero-dependencyasync subprocess that keeps on getting stdout and stderr.How to useExample 1: Hello WorldA classic Hello World. It printsHello World!in the shell and
redirects the stdout toprint().importasynciofromaiosubprocessimportProcessasyncio.get_event_loop().run_until_complete(Process("echo Hello World!",stdout=print).shell())$>pythonex1_minimal.py[AIOSubprocess-0]HelloWorld!

Processfinishedwithexitcode0Example 2: Two ProcessesOne process writes to a file, and a second process logs the content of the file
in real time.importasynciofromaiosubprocessimportProcessloop=asyncio.get_event_loop()reader=Process("""for i in {1..5}doecho "Hello $i World" > tempfile.logsleep 1done""",loop=loop,name="Writer",)writer=Process("timeout --foreground 10s tail -f tempfile.log",loop=loop,name="Reader",expected_returncode=124,# Because timeout is expected)awaitable_reader=reader.shell()awaitable_writer=writer.shell()gathered=asyncio.gather(awaitable_reader,awaitable_writer,loop=loop)asyncio.get_event_loop().run_until_complete(gathered)assertgathered.result()==[True,True]Which does exactly this:Why?There are many scenario where we need to keep an eye on
a subprocess output. If we want to do so in realtime
(and redirect it to logs or a GUI), the boilerplate is
tedious.The other solution is to wait for the subprocess to
exit and read the stdout/stderr afterwards.This library implements this boilerplate, so you don't have to.