Saravanan666/pypi-org huggingface dataset:
Package: trio-click
\$ trio-click\_==============What's Trio-Click?------------------Trio-Click ist a fork of Click that works well with Trio, asyncio, orcurio.Click is a Python package for creating beautiful command line interfacesin a composable way with as little code as necessary. It's the "CommandLine Interface Creation Kit". It's highly configurable but comes withsensible defaults out of the box.It aims to make the process of writing command line tools quick and funwhile also preventing any frustration caused by the inability toimplement an intended CLI API.Click in three points:-   Arbitrary nesting of commands-   Automatic help page generation-   Supports lazy loading of subcommands at runtimeInstalling----------Install and update using `pip`_:.. code-block:: text$ pip install trio-clickTrio-Click supports Python 3.5 and newer, and PyPy3... _pip: https://pip.pypa.io/en/stable/quickstart/A Simple Example----------------What does it look like? Here is an example of a simple Click program:.. code-block:: pythonimport anyioimport trio_click as click@click.command()@click.option("--count", default=1, help="Number of greetings.")@click.option("--name", prompt="Your name",help="The person to greet.")async def hello(count, name):"""Simple program that greets NAME for a total of COUNT times."""for x in range(count):if x: await anyio.sleep(0.1)click.echo("Hello, %s!" % name)if __name__ == '__main__':hello(_anyio_backend="trio")  # or asyncio, or curio.. note::Trio-Click automagically starts an anyio event loop and runs yourcode asynchronously.And what it looks like when run:.. code-block:: text$ python hello.py --count=3Your name: ClickHello, Click!Hello, Click!Hello, Click!Donate------The Pallets organization develops and supports Click and other popularpackages. In order to grow the community of contributors and users, andallow the maintainers to devote more time to the projects, `pleasedonate today`_... _please donate today: https://palletsprojects.com/donateThe Trio-Click fork is maintained by Matthias Urlichs <matthias@urlichs.de>.It's not a lot of work, so if you'd like to motivate me, donate to thecharity of your choice and tell me that you've done so. ;-)Links-----*   Website: https://palletsprojects.com/p/click/*   Documentation: https://click.palletsprojects.com/*   License: `BSD <https://github.com/pallets/click/blob/master/LICENSE.rst>`_*   Releases: https://pypi.org/project/click/*   Code: https://github.com/pallets/click*   Issue tracker: https://github.com/pallets/click/issues*   Test status:*   Linux, Mac: https://travis-ci.org/pallets/click*   Windows: https://ci.appveyor.com/project/pallets/click*   Test coverage: https://codecov.io/gh/pallets/click
Package: trio-engineio
Trio-Engine.IOAn asynchronousEngine.IOclient using thetrioframework.Only the revision3of the Engine.IO protocol is supported.RequirementsPython 3.7+triohttpcoretrio-websocketUsageimporttriofromtrio_engineio.trio_clientimportEngineIoClient,EngineIoConnectionErrordefon_connect():print(f"***** Connected")defon_message(msg):print(f"***** Received message:{msg}")defon_disconnect():print(f"***** Disconnected")asyncdefmain():eio=EngineIoClient(logger=False)eio.on("connect",on_connect)eio.on("message",on_message)eio.on("disconnect",on_disconnect)asyncwithtrio.open_nursery()asnursery:try:awaiteio.connect(nursery,"http://127.0.0.1:1234")exceptEngineIoConnectionError:returnFalsereturnTruetrio.run(main)
Package: trio-future
trio-futureOverviewtrio-futureallows you to capture the return values of concurrently executed trio functions. It's an altnerative to using trio channels to communicate results between tasks that feels more like programming with normal functions.Consider an example with this simple echo function:asyncdefecho(a:str)->str:awaittrio.sleep(0.5)returnaWe can call our function and get its result back later when we are ready:asyncwithtrio.open_nursery()asnursery:# Call trio_future.run to synchronously get back a Futurefuture=trio_future.run(nursery,echo,"hello")# When we call `await` and yield to scheduler, our function begins executingawaittrio.sleep(0.1)# We can `await` the function when we are readyhello=awaitfuture.get()# hello == "hello"A common use-case is to run several tasks concurrently and wait for them all to complete.trio-futurehas agatherfunction likeasyncio.gatherto do this:asyncwithtrio.open_nursery()asnursery:fut_1=run(nursery,echo,"hello")fut_2=run(nursery,echo,"world")# Call `gather` to package the two Futures into a single Future object.# Note that this is again a synchronous function.joined_future=gather(nursery,[fut_1,fut_2])# Again, when we `await` the result, we yield to the scheduler. This time, both# of our futures will execute concurrently.hello_world=awaitjoin_future.get()# hello_world = ["hello", "world"]
Package: trio-gtk
trio-gtkTrio guest mode wrapper for PyGTKUsing theTrio guest modefeature, we can run both the Trio and PyGTK event loops alongside each other in a single program. This allows us to make use of the Trio library and the usualasync/awaitsyntax and not have to directly manage thread pools. This library provides a thin wrapper for initialising the guest mode and exposes a single public API function,trio_gtk.runinto which you can pass your Trio main function.Install$pipinstalltrio-gtkPlease note,trio-gtkdoes installpygobjectdirectly as a Python package. We use relaxed bounds to ensure that the hard dependency on system packages (seecairo integration documentationwill not stop you having a successful installation. This may not always work out. If you see a build error during your Pip installation, please raise a ticket and we will see what we can do.Exampleimportgiimporttriogi.require_version("Gtk","3.0")fromgi.repositoryimportGtkasgtkimporttrio_gtkclassExample(gtk.Window):def__init__(self,nursery):gtk.Window.__init__(self,title="Example")self.button=gtk.Button(label="Create a task")self.button.connect("clicked",self.on_click)self.add(self.button)self.counter=0self.nursery=nurseryself.connect("destroy",gtk.main_quit)self.show_all()defon_click(self,widget):self.counter+=1self.nursery.start_soon(self.say_hi,self.counter)asyncdefsay_hi(self,count):whileTrue:awaittrio.sleep(1)print(f"hi from task{count}")asyncdefmain():asyncwithtrio.open_nursery()asnursery:Example(nursery)awaittrio.sleep_forever()trio_gtk.run(main)
Package: trio-inspector
# Trio InspectorNote: This is a very early prototype.![Trio Inspector](docs/trio_inspector.png)## InstallationCurrently requires Python 3.7 due to ``quart-trio`` dependency.```pip install trio-inspector```## Usage```from trio_inspector import TrioInspector...async with trio.open_nursery() as nursery:nursery.start_soon(TrioInspector().run)```Then, point your browser to: http://127.0.0.1:5000/If you want to try it out, you can download and run [this example](tests/example.py).
Package: trio-jsonrpc
JSON-RPC v2.0 for TrioThis project provides an implementation ofJSON-RPC v
2.0based onsansio-jsonrpcwith all of the I/O
implemented using theTrio asynchronous framework.Quick StartInstall from PyPI:$ pip install trio-jsonrpcThe following example shows a basic JSON-RPC client.fromtrio_jsonrpcimportopen_jsonrpc_ws,JsonRpcExceptionasyncdefmain():asyncwithopen_jsonrpc_ws('ws://example.com/')asclient:try:result=awaitclient.request(method='open_vault_door',{'employee':'Mark','pin':1234})print('vault open:',result['vault_open'])awaitclient.notify(method='hello_world')exceptJsonRpcExceptionasjre:print('RPC failed:',jre)trio.run(main)For more information, seethe complete
documentation.
Package: trio-mongodb
trio-mongodbTrio-mongodb was created because motor is coded in the most stupid + complex way possible I just cbaThis creates a AsyncMongoClient that starts a seperate python process
The process will use trio's to_sync to execute queries using pymongoUltimately, this results in a 100% nonblocking GIL bypassed trio lib for mongodbUsing threads only can potentially result in a massive slow down for your main process, code is provided for both, below is an example using process+threadsimport trio

from trio_mongodb.process import AsyncMongoClient

async def main():
    client = AsyncMongoClient("mongodb://localhost:27017/", "your_database")
    collection = client.get_collection('your_collection')

    # Perform operations
    result = await collection.insert_one({"name": "Alice", "age": 30})
    print(f"Inserted ID: {result.inserted_id}")
    
    updateResult = await collection.update_one({"name": "Alice"}, {"$set": {"age": 31}})
    print(f"Updated count: {updateResult.modified_count} | Matched count: {updateResult.matched_count}")

    # Don't forget to close the client
    client.close()

if __name__ == "__main__":
    trio.run(main)
Package: trio-mysql
Trio-MySQLTable of ContentsRequirementsInstallationDocumentationExampleResourcesLicenseThis package contains a pure-Python and Trio-enhanced MySQL client library.
It is a mostly-straightforward clone of PyMySQL, adding async methods
compatible with the Trio framework.NOTE: Trio-MySQL tries to adhere to (an async version of) the high level
database APIs defined inPEP 249. Some differences, however, are
unavoidable.RequirementsPython – one of the following:CPython: 3.6 and newerPyPy: Latest 3.x versionMySQL Server – one of the following:MySQL>= 5.6MariaDB>= 10.0InstallationPackage is uploaded onPyPI.You can install it with pip:$ python3 -m pip install trio_mysqlTo use “sha256_password” or “caching_sha2_password” for authenticate,
you need to install additional dependency:$ python3 -m pip install trio_mysql[rsa]To use MariaDB’s “ed25519” authentication method, you need to install
additional dependency:$ python3 -m pip install PyMySQL[ed25519]DocumentationDocumentation is available online:http://trio_mysql.readthedocs.io/For support, please refer to theStackOverflow.ExampleThe following examples make use of a simple tableCREATETABLE`users`(`id`int(11)NOTNULLAUTO_INCREMENT,`email`varchar(255)COLLATEutf8_binNOTNULL,`password`varchar(255)COLLATEutf8_binNOTNULL,PRIMARYKEY(`id`))ENGINE=InnoDBDEFAULTCHARSET=utf8mb4COLLATE=utf8mb4_binAUTO_INCREMENT=1;importtrio_mysql.cursors# Connect to the databaseconnection=trio_mysql.connect(host='localhost',user='user',password='passwd',charset='utf8mb4',database='db',cursorclass=trio_mysql.cursors.DictCursor)asyncwithconnectionasconn:asyncwithconn.cursor()ascursor:# Create a new recordsql="INSERT INTO `users` (`email`, `password`) VALUES (%s,%s)"awaitcursor.execute(sql,('webmaster@python.org','very-secret'))# connection is not autocommit by default. So you must commit to save# your changes.conn.commit()# You can set up a transaction:asyncwithconn.transaction():asyncwithconn.cursor()ascursor:# Create a new recordsql="INSERT INTO `users` (`email`, `password`) VALUES (%s,%s)"awaitcursor.execute(sql,('webmistress@python.org','totally-secret'))# ... or use a cursor directly, for autocommit:asyncwithconn.cursor()ascursor:# Read a single recordsql="SELECT `id`, `password` FROM `users` WHERE `email`=%s"awaitcursor.execute(sql,('webmaster@python.org',))result=awaitcursor.fetchone()print(result)This example will print:{'password':'very-secret','id':1}ResourcesDB-API 2.0:https://www.python.org/dev/peps/pep-0249/MySQL Reference Manuals:https://dev.mysql.com/doc/MySQL client/server protocol:https://dev.mysql.com/doc/internals/en/client-server-protocol.html“Connector” channel in MySQL Community Slack:https://lefred.be/mysql-community-on-slack/Trio chat:https://gitter.im/python-trio/generalLicenseTrio-MySQL is released under the MIT License. See LICENSE for more information.
Package: triones-api
triones_apidescriptionTriones_api provides methods encapsulated HTTP interface used when building a tenant ofTrionesPaaS.List the methodsfromtriones_apiimportTenantprint(Tenant.__doc__)Every secondary key in the dict below is a method name and the corresponding value demonstrate argument of the method.Additionally, keyword argumentdatawill always be parsed as the request body of a HTTP Request.{"one":{"get_metas":"all-metas?acl=false","get_meta":"{meta_name}/meta","get_records":"{meta_name}/query?{query:offset=0&limit=500&order_by=created_at&order_flag=DESC}","get_record":"{meta_name}/{id}","create_record":"{meta_name}","update_record":"{meta_name}/{id}","delete_record":"{meta_name}/{id}/?version={version}","dsl_query":"dsl/query?dsl={dsl}","get_common_scripts":"common-scripts","get_common_script":"common-scripts/{name}","create_territory_type":""},"one/service/territory":{"get_territory_types":"type","create_territory_type":"type","update_territory_type":"type/name","get_territory_models":"model?offset=-1&limit=-1","create_territory_model":"model","get_territory_nodes":"node/query?tenant_id={tenant_id}","add_public_territory_node":"node","add_private_territory_node":"node/private/{user_id}","update_territory_node":"node/{territory_id}/config","get_territory_members_in_node":"node/{territory_id}/member?offset=-1&limit=-1","get_territory_members":"member?limit=-1&offset=-1","add_member":"member","delete_member":"member/{member_id}","add_territory_permission":"permission","add_member_to_node":"node/{node_id}/member","remove_member_from_node":"node/{node_id}/member","add_member_to_permission":"member-permission","remove_member_from_permission":"member-permission"}}Invoke a methodfromtriones_apiimportTenanttoken="******"t=Tenant(token)# positional argumentt.get_meta("User")t.get_record("User","AQACQqweGRMBAAAAAxqWI4VnaBXazAEA")t.delete_record("Account","AQACQqweGRMBAAAAnyK7Z6Q-cxVqXQUA",0)# positional argument with keyword argumentt.get_records("Account",query='offset=0&limit=1&order_by=created_at&order_flag=DESC')t.get_records("Account")# keyword argument `data` represent the request body of a HTTP Request.t.create_record("Account",data={"objects":[{"t1":"John"}]})t.update_display_name("Account",data={"display_name":"Customer"})
Package: trionesControl
trionesControlThis module implements the triones protocol reverse engineered bymadheadwith python, offering a programmatic way to control these kind of lights without needing the app on your phone. To learn more about the protocol, please read the following specification:madhead - saberlight/protocols/Triones/protocol.mdRequirementsThis package only works on Linux, it uses pygatt and depends on blueZ.The package has been tested in python 3 (3.8.5) but it may work on previous versions, even python 2.7, as long aspygatt requirementsare met.InstallationInstalltrionesControlwith pip from PyPI:pip install trionesControlThis will install all the dependencies used by this package andpexpect, an optionalpygattneeded to use it's BlueZ backend.DocumentationConnexion handlingconnect(MAC): Connect to the device with the mac address specified.connect(MAC, False): Connect to the device with the mac address specified and dont reset previous connections for using multiple devices at once.disconnect(device): Disconnects from the specified device.LED ControlpowerOn(device): Powers on the device, the LEDs will turn on.powerOff(device): Powers off the device, the LEDs will turn off.setRGB(r: int, g: int, b: int, device): Sets the LED color configuration of the device to the r, g and b colors. (0-255)setWhite(intensity: int, device): Sets the device's LED to white with the specified intensiy. (0-255)setBuiltIn(mode: int, speed: int, device): Activates the selected predefined built-in mode at the selected speed (0-255). The built modes go from 37 to 56.All the functions do not wait for any response from the device by default. This can be overriden by adding an aditional argument set to True.powerOn(device, True): Powers on the device, the LEDs will turn on and waits for a reponse.Example useThe unittest code available intests/test.pycan be used as a sample to use the available functions of the package. You can test your bulb / LED strip by using the following code too.Connect and power on the deviceimporttimeimporttrionesControl.trionesControlastc#Change the mac address to the one of your bulb or LED stripdevice=tc.connect('00:00:00:00:00:00')tc.powerOn(device)Change colors# RGB modetc.setRGB(100,100,100,device)time.sleep(1)tc.setRGB(255,255,255,device)time.sleep(1)tc.setRGB(255,0,0,device)time.sleep(1)tc.setRGB(0,255,0,device)#White modetime.sleep(10)tc.setWhite(255,device)Built-in modes#Change built-in modes (37-56)time.sleep(10)tc.setBuiltIn(37,1)tc.time(10)Power off and disconnecttc.powerOff(device)tc.disconnect(device)LicenceMIT Licence - Copyright 2020 Aritz HerreroFor more information, checkLICENCEfile.
Package: trionesDevice
trionesDeviceThe module inspired bytrionesControlmodule fromAritz Herrero.
It provides API to control LED devices usingtriones protocol.
The motivation to build this module was to make it cross-platform using BLEAK module instead of pygatt.RequirmentsUsing BLEAK client this module is supposed to support every platform that BLEAK supports:Windows 10, version 16299 (Fall Creators Update) or greaterLinux distributions with BlueZ >= 5.43OS X/macOS support via Core Bluetooth API, from at least OS X version 10.11InstallationInstalltrionesControlwith pip from PyPI:pip install trionesControlOr clone this repository and usebuildmodule to generate wheel:python -m buildLicenceMIT Licence - Copyright 2023 Bukreev DmitriyFor more information, checkLICENCEfile.
Package: trio-owfs
This library allows you to access 1wire buses with Python, using any
async library (trio, asyncio, curio).This code doesnottry to talk to any 1wire interface by itself; it
uses TCP port 4304 (by default) to access one or moreowservers.Bus enumeration (when starting up, plus periodically in the background
if desired) is automatic and can be turned off.This code supports background polling, alerts, and simultaneous
conversions. Bus couplers (DS2509) are handled transparently. Accessors to
device attributes are created from device descriptors, read fromowserverand augmented by device-specific classes when necessary.The name of this library is (a) historic, (b) its main author strongly
prefers Trio.
Package: trio-paho-mqtt
trio_paho_mqtttriospecific async MQTT client. The goal of this project is to have all
the MQTT protocol stuff handled bypaho-mqtt,
while the async loopy stuff is handled by trio. This keeps our MQTT communication async, without having to
shove paho-mqtt into a thread, and without having to reimplement the MQTT protocol.All callbacks are also removed to be more trio-like. Messages are accessed through anasync forloop.This is meant to be a light-as-possible wrapper around paho-mqtt. That way if something goes wrong with MQTT message
parsing, it's not my fault ;-)UsageFirst, see theexample.pyand paho-mqtt documentation.
The goal is to expose all the same methods as the paho-mqttClient. If any methods (besides callbacks) are missing
or do something unexpected, this is a bug. Please open an issue.AsyncClientis initialized with a syncmqtt.Clientand atrio.Nurserybut then otherwise should operate much
like the syncClient.  Methods arenotcoroutines, they are non-blocking functions, so you do not need to callawait. The only exception is accessing messages throughasync for.Exampleimportpaho.mqtt.clientasmqttimporttriofromtrio_paho_mqttimportAsyncClientasyncdefhandle_messages(client):asyncformsginclient.messages():print(f"Received msg:{msg}")asyncwithtrio.open_nursery()asnursery:sync_client=mqtt.Client()client=AsyncClient(sync_client,nursery)client.connect('mqtt.eclipse.org',1883,60)client.subscribe(topic)client.publish(topic,msg)nursery.start_soon(handle_messages,client)Related projectsgmqtt- Uses asyncio and callbacks. Isn't compatible with trio.hbmqtt- Uses asyncio. Reimplements the MQTT protocol.aiomqtt- Uses asyncio and wraps paho, but still uses the loop from
paho-mqtt. I believe all operations are put into a worker thread.distmqtt- anyio-ified hbmqtt fork. Works with trio.
Package: trio-paho-mqtt-up1
trio_paho_mqtttriospecific async MQTT client. The goal of this project is to have all
the MQTT protocol stuff handled bypaho-mqtt,
while the async loopy stuff is handled by trio. This keeps our MQTT communication async, without having to
shove paho-mqtt into a thread, and without having to reimplement the MQTT protocol.All callbacks are also removed to be more trio-like. Messages are accessed through anasync forloop.This is meant to be a light-as-possible wrapper around paho-mqtt. That way if something goes wrong with MQTT message
parsing, it's not my fault ;-)UsageFirst, see theexample.pyand paho-mqtt documentation.
The goal is to expose all the same methods as the paho-mqttClient. If any methods (besides callbacks) are missing
or do something unexpected, this is a bug. Please open an issue.AsyncClientis initialized with a syncmqtt.Clientand atrio.Nurserybut then otherwise should operate much
like the syncClient.  Methods arenotcoroutines, they are non-blocking functions, so you do not need to callawait. The only exception is accessing messages throughasync for.ExamplePlease seeexample.pyfor a working example!
(example in README removed because it was not working)Related projectsgmqtt- Uses asyncio and callbacks. Isn't compatible with trio.hbmqtt- Uses asyncio. Reimplements the MQTT protocol.aiomqtt- Uses asyncio and wraps paho, but still uses the loop from
paho-mqtt. I believe all operations are put into a worker thread.distmqtt- anyio-ified hbmqtt fork. Works with trio.asyncio-mqtt- Same idea as this lib (a light wrapper for paho mqtt), but for asyncio.
Package: triopg
triopgWelcome totriopg!PostgreSQL client forTriobased onasyncpg.License: Your choice of MIT or Apache License 2.0Quick example:importtrio_asyncioimporttriopgasyncdefmain():asyncwithtriopg.connect()asconn:awaitconn.execute("""
            DROP TABLE IF EXISTS users;
            CREATE TABLE IF NOT EXISTS users (
                _id SERIAL PRIMARY KEY,
                user_id VARCHAR(32) UNIQUE
            )""")asyncwithconn.transaction():awaitconn.execute("INSERT INTO users (user_id) VALUES (1)")awaitconn.execute("INSERT INTO users (user_id) VALUES (2)")awaitconn.execute("INSERT INTO users (user_id) VALUES (3)")print(awaitconn.fetch("SELECT * FROM users"))trio_asyncio.run(main)API basicstriopgis a thin Trio-compatible wrapper aroundasyncpg. The API is the same,
with one exception -triopgdoes not support manual resource management.
Inasyncpgyou can manage pools, connections and transactions manually:conn=awaitasyncpg.connect()tr=conn.transaction()# ..tr.commit()conn.close()While intriopgyou canonlyuseasync withblocks:asyncwithtriopg.connect()asconn:asyncwithconn.transaction():# ...Otherwise you can followasyncpgtutorialandreference.
Everything should work the same way. Pleasefile an issueif it doesn’t.HelpersIn addition toasyncpg-compatible API,triopgprovides Trio-style.listen()helper for the eponymousPostgres statement:asyncwithconn.listen('some.channel',max_buffer_size=1)asnotifications:asyncfornotificationinnotifications:ifnotification!=triopg.NOTIFY_OVERFLOW:print('Notification received:',notification)max_buffer_sizeis the amount of notifications you are willing to queue in memory.If youdon’twant to think about buffering, set the buffer size tomath.infand everything will just work in regular non-pathological situations.Otherwise, you can set a finite buffer. In this case you should handletriopg.NOTIFY_OVERFLOWmarker and react according to your use case.
For example, you could re-scan the tables, like you would do at startup.
Or could you simply ignore the marker if you are only interested in the
newest notifications.For detailed discussion on buffering, see Trio manual,“Buffering in channels”section.Note:we can’t politely ask Postgres to slow down:LISTENbackpressure isnot supported by asyncpg.
There’s also an inherent challenge with Postgres. Postgres (like most
broadcast systems) doesn’t really have a good way to communicate backpressure
further upstream to the clients that are callingNOTIFY.