Skip to main content

askin

Asynchronous Keyboard Input

askin is a Python package that provides a simple way to get keyboard input asynchronously.

Installation

pip install askin

Usage

from askin import KeyboardController


class KeyState:
    def __init__(self) -> None:
        self.value = 0

    async def update(self, key: str) -> None:
        if key == "a":
            self.value += 1
        elif key == "b":
            self.value -= 1


async def key_handler(key: str) -> None:
    key_state.update(key)


async def default() -> None:
    print("Default! Resetting value to 0")
    key_state.value = 0


async def main() -> None:
    key_state = KeyState()
    controller = KeyboardController(key_handler=key_state.update, default=default, timeout=0.001)
    await controller.start()

    try:
        while True:
            print(key_state.value)
            await asyncio.sleep(0.1)
    finally:
        await controller.stop()


if __name__ == "__main__":
    asyncio.run(main())

Metadata

Release files for askin 0.0.2

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

Source distribution (sdist)

Source distribution for askin 0.0.2
File Size Uploaded Provenance
askin-0.0.2.tar.gz 5.3 kB With provenance Details

Release files / askin-0.0.2.tar.gz

Download URL askin-0.0.2.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
13de3cc748c65aeae2608679fa4f3f43ad67b0f54d0d5651f7389686891c3767
BLAKE2b-256 checksum
How to use checksums
c22cfda3a5c697a006f9bbb08fb4d9add070f56bdd372b0ee92bbba40901aaa6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 14, 2025.

Transparency log

Security for askin 0.0.2

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.

Full provenance

All 1 file in this release has been uploaded with provenance metadata.

Attestation for askin-0.0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 14, 2025.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file Full provenance

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