Skip to main content

Provides an asynchronous interface for print() using aiofiles.

Project description

aioprint

aioprint provides an asynchronous interface for print by using aiofiles as a backend.

Installation

Using PyPI

pip3 install -U aioprint

Using git with this GitHub repo

pip3 install -U git+https://github.com/crrapi/aioprint

Usage

import asyncio
import sys

import aioprint


class A:

    async def __aiostr__(self):
        # The __aiostr__ magic method is preferred
        # over the __str__ method to provide
        # a coroutine interface
        return "pony trick yasuo"

async def main():
    await print(["sub", 2, "pew"], "he is great", end="", sep="LOL")
    a = A()
    await print("error", file=sys.stderr)
    await print(a, file="out.txt")

loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Acknowledgements

Special thanks to Gelbpunkt aka Adrian for reviving this and making it useful

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aioprint-0.0.4.tar.gz (67.7 kB view details)

Uploaded Source

File details

Details for the file aioprint-0.0.4.tar.gz.

File metadata

  • Download URL: aioprint-0.0.4.tar.gz
  • Upload date:
  • Size: 67.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.1

File hashes

Hashes for aioprint-0.0.4.tar.gz
Algorithm Hash digest
SHA256 37d8f905a33ba04db86e865b704469774d2d196de9f43d1861fc1f2e13e286a6
MD5 7fd3117e74094868ead5d47b224718ee
BLAKE2b-256 a8c088a7d4c6d1b4767537e253bc76ea6c4e776a9b3996cf5da33d78dc1af9b2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page