Skip to main content

timedinput

PyPI version Python versions Tests License

A Python module that waits for a specified amount of time for user input. If no input is received within the given timeout period, the module returns a default value or raises an exception.

Unlike standard timeout modules, timedinput actively monitors keystrokes and fully supports modern interactive environments like Jupyter Notebooks, Google Colab, and VS Code.

Installation

Standard installation for standard terminals (Windows/macOS/Linux):

pip install timedinput

For Jupyter/Colab Support: To enable timeout functionality inside Jupyter environments, install the optional UI dependencies:

pip install timedinput[jupyter]

(If you use timedinput in Jupyter without these dependencies, it will gracefully fall back to a standard, non-timing input() prompt to prevent crashes).

Usage

The timedinput function takes three optional arguments: prompt, timeout, and default.

from timedinput import timedinput

# Prompt the user for input with a timeout of 10 seconds
user_input = timedinput("Enter something: ", timeout=10)

# Prompt the user for input with a timeout of 5 seconds and a default value
user_input = timedinput("Enter something: ", timeout=5, default="default")

If the user enters input within the specified timeout, the function returns the user's input as a string. If the user does not enter input within the specified timeout, the function returns the default value (if one was provided) or raises a TimeoutOccurred exception.

Compatibility

  • Terminals: Works perfectly on all standard terminals across Windows and Unix-like operating systems.
  • Interactive: Fully compatible with JupyterLab, Classic Notebook, Google Colab, and VS Code Interactive windows.

License

Released under the MIT License. See the LICENSE file for more information.

Release files for timedinput 2.0.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 timedinput 2.0.0
File Size Uploaded
timedinput-2.0.0.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for timedinput 2.0.0
File Interpreter ABI Platform
timedinput-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.8 kB

Release files / timedinput-2.0.0.tar.gz

Download URL timedinput-2.0.0.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d61eaf08d48266f32bf75645f9b0ce6ea30a76bbdb119aea602875100402b2cc
BLAKE2b-256 checksum
How to use checksums
336ae770d376a87dbbf14ee02c2c771c55804a914aef9ebfe35223278fbb0916
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 15, 2026.

Transparency log

Release files / timedinput-2.0.0-py3-none-any.whl

Download URL timedinput-2.0.0-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82123979328243a36e0e9d077078d7ec7123ac71ec915ff423daebaac80cf99a
BLAKE2b-256 checksum
How to use checksums
738f043c779d8b57fa5291306b757a89266c567394929c7a4c1ee899a55e4115
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.0.1

2 release files

0.1.1

2 release files

0.1.0

2 release files

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