Saravanan666/pypi-org huggingface dataset:
Package: aiojobs
Job scheduler for managing background tasks (asyncio)The library gives a controlled way for scheduling background tasks for
asyncio applications.Installation$pip3installaiojobsUsage exampleimportasyncioimportaiojobsasyncdefcoro(timeout):awaitasyncio.sleep(timeout)asyncdefmain():scheduler=aiojobs.Scheduler()foriinrange(100):# spawn jobsawaitscheduler.spawn(coro(i/10))awaitasyncio.sleep(5.0)# not all scheduled jobs are finished at the moment# gracefully close spawned jobsawaitscheduler.close()asyncio.get_event_loop().run_until_complete(main())Integration with aiohttp.webfromaiohttpimportwebfromaiojobs.aiohttpimportsetup,spawnasyncdefhandler(request):awaitspawn(request,coro())returnweb.Response()app=web.Application()app.router.add_get('/',handler)setup(app)or justfromaiojobs.aiohttpimportatomic@atomicasyncdefhandler(request):returnweb.Response()For more information read documentation:https://aiojobs.readthedocs.ioCommunication channelsaio-libsgoogle group:https://groups.google.com/forum/#!forum/aio-libsFeel free to post your questions and ideas here.Gitter Chathttps://gitter.im/aio-libs/LobbyWe supportStack Overflow.
Please addpython-asynciooraiohttptag to your question there.Author and LicenseTheaiojobspackage is written by Andrew Svetlov.It’sApache 2licensed and freely available.
Package: aiojobs-fork
ImportantThis is a manintained fork of an abandoned package. The originalaiojobspackage is written by Andrew Svetlov.
The purpose of this fork is to merge open pull requests that were open for a very long time without any feedback from the maintainer side.aiojobsJobs scheduler for managing background task (asyncio)The library gives controlled way for scheduling background tasks for
asyncio applications.Installation$pip3installaiojobsUsage exampleimportasyncioimportaiojobsasyncdefcoro(timeout):awaitasyncio.sleep(timeout)asyncdefmain():scheduler=awaitaiojobs.create_scheduler()foriinrange(100):# spawn jobsawaitscheduler.spawn(coro(i/10))awaitasyncio.sleep(5.0)# not all scheduled jobs are finished at the moment# gracefully close spawned jobsawaitscheduler.close()asyncio.get_event_loop().run_until_complete(main())Integration with aiohttp.webfromaiohttpimportwebfromaiojobs.aiohttpimportsetup,spawnasyncdefhandler(request):awaitspawn(request,coro())returnweb.Response()app=web.Application()app.router.add_get('/',handler)setup(app)or justfromaiojobs.aiohttpimportatomic@atomicasyncdefhandler(request):returnweb.Response()For more information read documentation:https://aiojobs.readthedocs.ioCommunication channelsaio-libsgoogle group:https://groups.google.com/forum/#!forum/aio-libsFeel free to post your questions and ideas here.Gitter Chathttps://gitter.im/aio-libs/LobbyWe supportStack Overflow.
Please addpython-asynciooraiohttptag to your question there.Author and LicenseTheaiojobspackage is written by Andrew Svetlov.It’sApache 2licensed and freely available.
Package: aiojsonrpc2
``aiojsonrpc2`` is a Python3 JSONRPC module built using ``asyncio``.Supports Python 3.5+ only (usesasync/awaitsyntax)Plain socket transport (not JSONRPC over HTTP)Supports secure TLS (ie. SSL) socketsThis is a new, fast, and modern JSONRPC module originally built to
support`aiostratum_proxy<https://github.com/wetblanketcc/aiostratum_proxy>`__
(a next-gen, extensible cryptocurrency mining proxy). However, releasing
it as it’s own independent Python package made the most sense.InstallationThere are currently no external dependencies required foraiojsonrpc2, and installation is simple:pip install aiojsonrpc2UsageTo useaiojsonrpc2and depending on your needs, you need to
implement either a client or server ‘protocol’. BothClientProtocolandServerProtocollet you handle bi-directional JSONRPC
communication.All incoming JSONRPC requests infer a protocol instance method from the
JSONRPCmethodparameter. For example, if themethodcontainsclient.show_message, then the protocol class implementation must
have an instance method calledhandle_client_show_message:from aiojsonrpc2 import ClientProtocol, ServerProtocol

class MyClientProtocol(ClientProtocol):
    # NOTE: the opposing connection (perhaps a server) would
    # have sent the `client.show_message` request;
    # bidirectional communication!
    def handle_client_show_message(self, connection, params, **kwargs):
        # assuming the message to show is `params[0]`
        print(params[0])Note how all.(ie. full stops/periods) from the JSONRPCmethodparameter are replaced by_(ie. underscore).Future ConsiderationsCommunity involvement is appreciated.Code
review,pull requests
for bug fixes &
improvements,reporting
issues,
spreading the word - all appreciated.TODO:teststravis integrationhandlehaproxy ``PROXY`protocol <http://www.haproxy.org/download/1.8/doc/proxy-protocol.txt>`__
Package: aio-jsonrpc-2.0
aio-jsonrpc-2.0Descriptionjson rpc 2.0 protocol implementation for asyncio, without transport.specification:http://www.jsonrpc.org/Usage:Example to resolve request:importasyncioimportjsonfromaio_jsonrpc_20importRequestResolverasyncdeffoo(msg):awaitasyncio.sleep(0.1)return'foobar '+str(msg)router={'foo':foo}resolver=RequestResolver(router)json_request=json.dumps({"jsonrpc":"2.0","method":"foo","params":["toto"],"id":1})asyncdefmain():json_response=awaitresolver.handle(json_request)print(json_response)loop=asyncio.get_event_loop()loop.run_until_complete(main())Result:{"jsonrpc":"2.0","result":"foobar toto","id":1}Example to build request:fromaio_jsonrpc_20importRequestBuilderbuilder=RequestBuilder()json_request=builder.call(method="foo",params={"name":"bar"})print(json_request)json_request=builder.call(method="foo",params={"name":"bar2"})print(json_request)json_request=builder.notify(method="log",params=["hello"])print(json_request)Result:{"jsonrpc":"2.0","method":"foo","params":{"name":"bar"},"id":1}{"jsonrpc":"2.0","method":"foo","params":{"name":"bar2"},"id":2}{"jsonrpc":"2.0","method":"log","params":["hello"]}Example to build batch request:fromaio_jsonrpc_20importBatchRequestBuilderbatch_builder=BatchRequestBuilder()id1=batch_builder.call(method="foo",params={"name":"bar"})id2=batch_builder.call(method="foo2",params={"name":"bar"})print(id1,id2)batch_builder.notify(method="foo3",params={"name":"bar"})json_request=batch_builder.get_request()print(json_request)Result:12[{"jsonrpc":"2.0","method":"foo","params":{"name":"bar"},"id":1},{"jsonrpc":"2.0","method":"foo2","params":{"name":"bar"},"id":2},{"jsonrpc":"2.0","method":"foo3","params":{"name":"bar"}}]TODO:Fix definitely interface for buildersMore TestDocumentationOptimisation...Testing:py.test --cov=aio_jsonrpc_20 --cov-report term-missing tests/0.1.2fix(README): Fixed encoding error0.1.0Initial release.
Package: aiok8s
aiok8sThis a client library meant for building asynchronous Kubernetes controllers
using Python. It currently integrates withkubernetes_asyncio.Most of the code is directly translated from and attributed toclient-goandcontroller-runtime.
This approach is taken to help ensure that the logic is battle-tested and
reduce overhead in maintaining the library. It's meant to replicate only some
of the most desirable APIs of the Go libraries, not all of them.This is in early development. APIs may be adjusted or even removed.
Package: aiokafka
asyncio client for KafkaAIOKafkaProducerAIOKafkaProducer is a high-level, asynchronous message producer.Example of AIOKafkaProducer usage:fromaiokafkaimportAIOKafkaProducerimportasyncioasyncdefsend_one():producer=AIOKafkaProducer(bootstrap_servers='localhost:9092')# Get cluster layout and initial topic/partition leadership informationawaitproducer.start()try:# Produce messageawaitproducer.send_and_wait("my_topic",b"Super message")finally:# Wait for all pending messages to be delivered or expire.awaitproducer.stop()asyncio.run(send_one())AIOKafkaConsumerAIOKafkaConsumer is a high-level, asynchronous message consumer.
It interacts with the assigned Kafka Group Coordinator node to allow multiple
consumers to load balance consumption of topics (requires kafka >= 0.9.0.0).Example of AIOKafkaConsumer usage:fromaiokafkaimportAIOKafkaConsumerimportasyncioasyncdefconsume():consumer=AIOKafkaConsumer('my_topic','my_other_topic',bootstrap_servers='localhost:9092',group_id="my-group")# Get cluster layout and join group `my-group`awaitconsumer.start()try:# Consume messagesasyncformsginconsumer:print("consumed: ",msg.topic,msg.partition,msg.offset,msg.key,msg.value,msg.timestamp)finally:# Will leave consumer group; perform autocommit if enabled.awaitconsumer.stop()asyncio.run(consume())Running testsDocker is required to run tests. Seehttps://docs.docker.com/engine/installationfor installation notes. Also note, thatlz4compression libraries for python will requirepython-devpackage,
or python source header files for compilation on Linux.
NOTE: You will also need a valid java installation. It’s required for thekeytoolutility, used to
generate ssh keys for some tests.Setting up tests requirements (assuming you’re within virtualenv on ubuntu 14.04+):sudo apt-get install -y libsnappy-dev libzstd-dev libkrb5-dev krb5-user
make setupRunning tests with coverage:make covTo run tests with a specific version of Kafka (default one is 1.0.2) use KAFKA_VERSION variable:make cov KAFKA_VERSION=0.10.2.1Test running cheatsheat:make testFLAGS="-l-x--ff"- run until 1 failure, rerun failed tests first. Great for cleaning up a lot of errors, say after a big refactor.make testFLAGS="-kconsumer"- run only the consumer tests.make testFLAGS="-m'not ssl'"- run tests excluding ssl.make testFLAGS="--no-pull"- do not try to pull new docker image before test run.
Package: aiokatcp
aiokatcp is an implementation of thekatcpprotocol based around the Python
asyncio system module. It requires Python 3.7 or later. It is loosely inspired
by thePython 2 bindings, but has a much narrower scope.The current implementation provides both client and server APIs. It only
supports katcp version 5, and does not support a number of features that are
marked deprecated in version 5.Full documentation can be found onreadthedocs.
Package: aiokdb
aiokdbPython asyncio connector to KDB. Pure python, so does not depend on thek.hbindings or kdb shared objects, or numpy/pandas. Fully type hinted to comply withPEP-561. No non-core dependancies, and tested on Python 3.9 - 3.11.Peer review & motivationqPythonis a widely used library for this task and it maps objects to Pandas Dataframes which might be more suitable for the majority of applications.This library takes a different approach and aims to replicate using the KDB C-library functions, ie. being 100% explicit about KDB types. It was built working from the publically documentedSerialization ExamplesandC API for kdb+pages. Users might also need to be familiar withk.h.A simple example:fromaiokdb.socketimportkhpu# run ./q -p 12345 &h=khpu("localhost",12345,"kdb:pass")result=h.k("2.0+3.0")# if the remote returns a Q Exception, this gets raised, unless khpu(..., raise_krr=False)assertresult.aF()==5.0Theresultobject is a K-like Python object (aKObj), having the usual signed integer type available asresult.type. Accessors for the primitive types are prefixed with anaand check at runtime that the accessor is appropriate for the stored type (.aI(),.aJ(),.aH(),.aF()etc.). Atoms store their value to abytesobject irrespective of the type, and encode/decode on demand. Atomic values can be set with (.i(3),.j(12),.ss("hello")).Arrays are implemented with subtypes that usePython's native arrays modulefor efficient array types. TheMutableSequencearrays are returned using the usual array accessor functions.kI(),.kB(),.kS()etc.Serialisation is handled byb9which returns a python bytes, andd9which takes a bytes and returns a K-object.Atoms are created byka,kb,ku,kg,kh,ki,kj,ke,kf,kc,ks,kt,kd,kz,ktjLists withktnandknkDictionaries withxdand tables withxt.Python manages garbage collection, none of the refcounting primitives exist, ie.k.rand functionsr1,r0andm9,setmare absent.RPCClient support using python asyncio is built into the package, and usesprompt_toolkitfor line editing:$pipinstallaiokdbprompt_toolkit
$./q-p12345&$python-maiokdb.cli--hostlocalhost--port12345(eval)>([s:760Nj]x:3?0Ng;y:2)s|xy
-|---------------------------------------7|409031f3-b19c-6770-ee84-6e9369c9869726|52cb20d9-f12c-9963-2829-3c64d8d8cb142|cddeceef-9ee9-3847-9172-3e3d7ab39b262(eval)>\\$TestsThe unit tests intest/test_rpc.pywill use a real KDB binary to test against (over RPC) if you setKDB_PYTEST_SERVICEto a URL of the formkdb://user:password@hostname:port, otherwise that test is skipped and they are self contained.Formatting withruff check .Formatting withblack .importsisort --check --profile black .Check type annotations withmypy --strict .Runpytest .in the root directory
Package: aiokef
Asyncio Python API for KEF speakersSupported:KEF LS50 Wireless(tested with latest firmware of 19-11-2019: p6.3001902221.105039422 and older firmware: p6.2101809171.105039422)
Untested:KEF LSXSupported featuresGet and set volumeMute and unmuteGet and set source inputTurn speaker on and offInvert L/R to R/LPlay and pause (only works with Wifi and Bluetooth)Previous and next track (only works with Wifi and Bluetooth)Set the standby time to infinite, 20 minutes, or 60 minutesAutomatically connects and disconnects when speakers goes online/offlineControlallDSP settings!Use in Home AssistantSeebasnijholt/media_player.kef.InstallpipinstallaiokefDiscussionSee thisHome Assistant discussion threadwhere the creation of the KEF speakers is discussed.LicenseMIT LicenseContributionsBas NijholtRobin Grönberg (@Gronis)Bastian Beggel (@bastianbeggel)chimpy (@chimpy)
Package: aiokevoplus
This started as a fork ofhttps://github.com/Bahnburner/pykevoplusbut at this point is pretty much a rewrite.This library has been converted to be compatible with asyncio and also to use the latest version of the Kevo API including support for
realtime updates via websockets.UsagefromaiokevoplusimportKevoApidefstatus_changed(lock):print("Status changed for "+lock.name)api=KevoApi()try:awaitapi.login("username@email.com","password123")api.register_callback(status_changed)awaitapi.websocket_connect()locks=api.get_locks()forlockinlocks:lock.lock()exceptExceptionase:print("Something went wrong "+e)
Package: aiokinesis
AIOKinesis==========Asyncio client library for AWS KinesisInstallation------------```pip install aiokinesis```AIOKinesisProducer------------------Usage:```pythonimport asyciofrom aiokinesis import AIOKinesisProducerasync def send_message():loop = asyncio.get_event_loop()producer = AIOKinesisProducer('my-stream-name', loop, region_name='us-east-1')await producer.start()await producer.send('partition-key', {'data': 'blah'})await asyncio.sleep(1)await producer.stop()loop.run_until_complete(send_message())```Limitations:- Stopping the producer before all messages are sent will prevent in flight messages from being sent- AIOKinesis only supports one shard so the producer is rate limited to 5 requests per rolling secondAIOKinesisConsumer------------------Usage:```pythonimport asynciofrom aiokinesis import AIOKinesisConsumerasync def get_messages():loop = asyncio.get_event_loop()consumer = AIOKinesisConsumer('my-stream-name', loop, region_name='us-east-1')await consumer.start()try:async for message in consumer:print("Consumed message: ", message)except KeyboardInterrupt:await consumer.stop()loop.run_until_complete()```Limitations:- AIOKinesis only supports one shard so the consumer is rate limited to 5 requests per rolling second
Package: aio-kong
Async Python Client for KongTested withkongv3.3Installation & TestingTo install the packagepip install aio-kongTo run tests, clone andmake test:warning: If you don't have Kong or postgres running locally, run the services firstmakeservicestest certificates were generated using the commandopenssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -subj '/CN=localhost'ClientThe client can be imported viafromkong.clientimportKongIn a coroutine:asyncwithKong()ascli:services=awaitcli.services.get_list()print(json.dumps([s.dataforsinservices],indent=2))By default the url is obtained from the "KONG_ADMIN_URL" environment variable which defaults tohttp://127.0.0.1:8001.The client has handlers for all Kong objectscli.servicesCRUD operations on servicescli.routesCRUD operations on routescli.pluginsCRUD operations on pluginscli.consumersCRUD operations on consumerscli.certificatesCRUD operations on TLS certificatescli.snisCRUD operations on SNIscli.aclsTo list all ACLsApply a configurationThe client allow to apply a configuration object to kong:awaitcli.apply_json(config)Command line toolThe library install thekongfigcommand line tool for uploading kong configuration files.kongfig --yaml config.yaml
Package: aiokonstsmide
aiokonstsmideAn asynchronous library to communicate with Konstsmide Bluetooth string lights.DocumentationSupported featuresConnect with a device and send the password as pairing mechanismTurn the device on/offControl the devices function, brightness and flash speedCreate timers on the device to turn on/off the device or specific functions at specific times and weekdaysInstallation$pipinstallaiokonstsmideUsageasyncwithaiokonstsmide.Device("11:22:33:44:55:66")asdev:awaitdev.on()Also check theexamplesfolder.
Package: aio-krpc-server
Asyncio Kademlia RPC-serverKademlia protocol based RPC-server.Exampleimportasyncioloop=asyncio.get_event_loop()udp=UDPServer()udp.run("0.0.0.0",12346,loop=loop)app=KRPCServer(server=udp,loop=loop)@app.callcack(arg_schema={"id":{"type":"integer","required":True}})defping(addr,id):print(addr,id)return{"id":id}if__name__=='__main__':loop.run_forever()
Package: aiokubemq
AIOKubeMQAboutAsynchronous Python KubeMQ Client.Basically an optimized reimplementation ofhttps://github.com/kubemq-io/kubemq-Pythonwith asyncio and typed methods.NoteThis repository is mirrored fromGitlabtoGithub.
Most features like Issues, MRs/PRs etc. are disabled onGithub, please use theGitlab repositoryfor theseFeaturesModern Pythonic API using asyncioTypedPretty lowlevel, wrappers can be built as seen fitHow to useimportaiokubemqasyncdefmain():asyncwithaiokubemq.KubeMQClient("client-id","host:50000")asclient:result=awaitclient.ping()print(f"We're connected to host '{result.Host}'")seethe examples folderfor more
Package: aiokwikset
aiokwikset - Python interface for the Kwikset APIPython library for communicating with theKwikset Smart Locksvia the Kwikset cloud API.WARNINGThis library only works if you have signed up for and created a home/had a home shared with you from the Kwikset Application.IOSAndroidNOTE:This library is community supported, please submit changes and improvements.This is a very basic interface, not well thought out at this point, but works for the use cases that initially prompted spitting this out from.Supportslocking/unlockingretrieving basic informationInstallationpip install aiokwiksetExamplesimportasynciofromaiokwiksetimportAPIasyncdefmain()->None:"""Run!"""#initialize the APIapi=API("<EMAIL>")#start auth#<CODE_TYPE> = [phone, email]pre_auth=awaitapi.authenticate('<PASSWORD>','<CODE_TYPE>')#MFA verificationawaitapi.verify_user(pre_auth,input("Code:"))# Get user account information:user_info=awaitapi.user.get_info()# Get the homeshomes=awaitapi.user.get_homes()# Get the devices for the first homedevices=awaitapi.device.get_devices(homes[0]['homeid'])# Get information for a specific devicedevice_info=awaitapi.device.get_device_info(devices[0]['deviceid'])# Lock the specific devicelock=awaitapi.device.lock_device(device_info,user_info)# Set led statusled=awaitapi.device.set_ledstatus(device_info,"false")# Set audio statusaudio=awaitapi.device.set_audiostatus(device_info,"false")# Set secure screen statusscreen=awaitapi.device.set_securescreenstatus(device_info,"false")asyncio.run(main())Known Issuesnot all APIs supported
Package: aiolambda
aiolambdaPython async microservices fasts and functional!TechnologiesPython librariescoreconnexion:
Swagger/OpenAPI First framework for Python on top of Flask with automatic endpoint validation & OAuth2 supportaiohttp:
Asynchronous HTTP client/server framework for asyncio and PythonDatabasesasyncpg:
A fast PostgreSQL Database Client Library for Python/asyncio.AMPQaio-pika:
Wrapper for the PIKA for asyncio and humans.SoftwareContainersDockerContinuous Integrationtravis-ci
Package: aiolancium
aiolanciumaiolancium is a simplistic python REST client for the Lancium Compute REST API utilizing asyncio. The client itself has
been developed against theLancium Compute REST API documentation.Installationaiolancium can be installed viaPyPiusingpipinstallaiolanciumHow to use aiolanciumfromaiolancium.authimportAuthenticatorfromaiolancium.clientimportLanciumClient# Authenticate yourself against the API and refresh your token if necessaryauth=Authenticator(api_key="<your_api_key>")# Initialise the actual clientclient=LanciumClient(api_url="https://portal.lancium.com/api/v1/",auth=auth)# List details about the `lancium/ubuntu` containerawaitclient.images.list_image("lancium/ubuntu")# Create your hellow world first job.job={"job":{"name":"GridKa Test Job","qos":"high","image":"lancium/ubuntu","command_line":'echo "Hello World"',"max_run_time":600}}awaitclient.jobs.create_job(**job)# Show all your jobs and their status in Lancium computejobs=awaitclient.jobs.show_jobs()forjobinjobs["jobs"]:# Retrieve the stdout/stdin output of your finished jobsawaitclient.jobs.download_job_output(job["id"],"stdout.txt")awaitclient.jobs.download_job_output(job["id"],"stderr.txt")# or download them to diskawaitclient.download_file_helper("stdout.txt","stdout.txt",job["id"])awaitclient.download_file_helper("stderr.txt","stderr.txt",job["id"])# Delete all your jobs in Lancium computeforjobinjobs["jobs"]:awaitclient.jobs.delete_job(id=job["id"])In order to simplify file uploads and downloads to/from the Lancium compute platform, an upload/download helper method
has been added to the client.
The upload helper takes care of reading a file in binary format and uploading it in 32 MB chunks (default) to the
Lancium persistent storage. The download helper downloads a file from the Lancium persistent storage to the local disks.
The download helper also supports the download of jobs outputs (stdout.txt, stderr.txt) to local disk (see example
above).
Unfortunately, streaming of data is not support by the underlyingsimple-rest-client. Thus, the entire file is
downloaded to memory before writing to the disk.fromaiolancium.authimportAuthenticatorfromaiolancium.clientimportLanciumClient# Authenticate yourself against the API and refresh your token if necessaryauth=Authenticator(api_key="<your_api_key>")# Initialise the actual clientclient=LanciumClient(api_url="https://portal.lancium.com/api/v1/",auth=auth)# Upload /bin/bash to /test on the Lancium persistent storageawaitclient.upload_file_helper(path="test",source="/bin/bash")# Get information about the uploaded fileawaitclient.data.get_file_info("/test")# Download the file againawaitclient.download_file_helper("/test",destination="test_downloaded_again")# Delete the uploaded file again, thearg={"file-path":"/test"}awaitclient.data.delete_data_item(**arg)# Alternative approach to delete the uploaded fileawaitclient.data.delete_data_item("/test")
Package: aiolavapy
Async Lava API libraryExample to useimportasynciofromaiolavaimportLavaBusinessClientasyncdefmain():client=LavaBusinessClient(private_key="INSERT_PRIVATE_KEY",shop_id="INSERT_SHOP_ID"# optional)invoice=awaitclient.create_invoice(sum_=10,order_id="order#10")print(invoice.data.url)status=awaitclient.check_invoice_status(order_id="order#10")print(status.data.status)if__name__=='__main__':asyncio.run(main())All documentation you can findhere