Skip to main content

non_blocking_io_wrapper

Description:

non_blocking_io_wrapper.NonBlockingReader is a wrapper class to build a non blocking stream from any read stream. It can be used for example to wrap the stdout pipe of a subprocess in a non blocking way.

It is a true io.RawIOBase subclass. Because of that, any method valid on an input byte stream should work seamlessly. Yet, a line access (readline, or iterator) will raise an OSError if no data is available at call time (you can use the select method to test/wait for that condition). If some data is available a line will be returned, or a partial one if no newline is available in the buffer.

If no data is present, a read will return None instead of blocking.

Additional methods

drain(timeout=None)

Waits for the underlying stream to reach its end of file.

If timeout is given and is not None it is the maximum time in seconds to wait.

Returns True if it succeeded or False on timeout.

It is intended to force a blocking wait after signaling an end of communication to a peer.

select(timeout=None)

Waits for data to become available.

If timeout is given and is not None it is the maximum time in seconds to wait.

Returns True if it succeeded or False on timeout

It is intended to allow to wait for availability of some data.

Installation

From PyPI

Released version are normally available from PyPI. Just user pip to install the last one:

pip install non_blocking_io_wrapper

From GitHUB

You can also clone the main repository from GitHUB:

git clone https://github.com/s-ball/non_blocking_io_wrapper.git

Contribution - development

A test package (97% coverage as of 0.5) is included in the GitHUB repository and in the source packages on PyPI.

Special processing for version.py

Versioning file is not included in the GitHUB repository because it is generated with setuptools_scm. It is of course included in PyPI packages so you should make sure to have a true git repository, or to get the sources from PyPI. The symptom is that you get a version number of 0.0.0 ...

Disclaimer: beta quality

It is fully functional and pass tests for Python 3.6 to 3.9 on Travis-CI. Yet it could have a better documentation, and has not been extensively tested.

License

This work is licenced under a MIT Licence. See LICENSE.txt

Metadata

Release files for non-blocking-io-wrapper 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for non-blocking-io-wrapper 0.7.0
File Size Uploaded Provenance Actions
non_blocking_io_wrapper-0.7.0.tar.gz 6.6 kB Without provenance Details for non_blocking_io_wrapper-0.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for non-blocking-io-wrapper 0.7.0
File Interpreter ABI Platform Actions
non_blocking_io_wrapper-0.7.0-py3-none-any.whl Python 3 none any Details for non_blocking_io_wrapper-0.7.0-py3-none-any.whl

Total release size: 12.0 kB

Release files / non_blocking_io_wrapper-0.7.0.tar.gz

Download URL non_blocking_io_wrapper-0.7.0.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
36e5f9e47eb0250324570a30366343d4a8a560131752b6a4710752d6b76a8106
BLAKE2b-256 checksum
How to use checksums
fd1b0c3083a1cbf26f6314f9406828e8eedd85c40ca88b962f70ceb2372c898c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.4

Release files / non_blocking_io_wrapper-0.7.0-py3-none-any.whl

Download URL non_blocking_io_wrapper-0.7.0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d306acf288616fb037fbe69950aaa635b975fe32377926c6cbc2dfbcf12d2c18
BLAKE2b-256 checksum
How to use checksums
d4d24adf4596ec5a2301333a3cb638690a333ed708135c71cffff7fadadf898d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.4

Security for non-blocking-io-wrapper 0.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page