--- id: pytimeparse2 version: "1.7.1" license: MIT license_treatment: permissive maintenance: dormant --- # pytimeparse2 — Time expression parser. License: permissive · Maintenance: dormant · Downloads: 3.5M/mo ## What it is and what it does pytimeparse2 is a lightweight parser that converts time expressions written in natural language into numeric seconds or Python timedelta objects. It handles a wide variety of formats: shorthand notation (32m, 2h32m, 3d2h32m), colon-separated time (4:13:02), English prose (5 hours, 34 minutes, 56 seconds), and uptime-style output (2 days, 4:13:02). The library also supports months and years using fixed assumptions (30 days per month, 365 days per year). The package has no runtime dependencies and installs as a pure Python wheel, making it simple to add to any project. It is marked Production/Stable and supports Python 3.6 through 3.11. Maintenance is dormant (last update in 2023), but the codebase carries no known vulnerabilities and the API is straightforward: call parse() with a time string and optionally request a timedelta object instead of raw seconds. Use it for: - Parse user-supplied timeout or delay values in configuration files or CLI arguments. - Convert uptime or system log timestamps into standardized seconds for calculations. - Accept human-friendly duration input in web forms or APIs and normalize to timedelta. - Build retry logic or rate-limiting that reads duration strings from environment variables. - Parse scheduling expressions that use natural time notation. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parses human-readable time expressions (like '2h32m', '1.2 minutes', '2 days, 4:13:02') into seconds or timedelta objects. Yes. pytimeparse2 solves a specific, well-defined problem with zero dependencies, permissive licensing, and no security issues. It is stable and dormant rather than actively maintained, but that is appropriate for a mature parsing utility. Install it if you need to accept time expressions from users or configuration; skip it if you only work with numeric seconds or strict time formats. ## Install pip install pytimeparse2 uv add pytimeparse2 poetry add pytimeparse2 ## Installing pytimeparse2 Before you install: Low friction: pure Python wheel with no runtime dependencies. Maintenance is dormant (last commit 2023-09-29, 1191 days ago), but the package is marked Production/Stable and carries no known vulnerabilities. License in practice: MIT license (permissive) — you may use, modify, and distribute freely with minimal restrictions; include the license text. Quickstart: pip install pytimeparse2 from pytimeparse2 import parse result = parse('2h32m') print(result) # seconds as integer or float Verify before relying: - Whether dateutil is automatically installed or optional; the description mentions conditional relativedelta support but does not clarify the dependency status. - Performance characteristics and parsing speed for large batches of expressions. - Exact behavior and edge cases for month/year calculations (the description notes assumptions but does not detail all corner cases). ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 3.5M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags parse time expressions, convert time string to seconds, human readable duration parsing, timedelta from string, uptime format parser, time duration parser, parse duration strings, parsing, time-utilities [View on SkillFed](https://skillfed.io/packages/pytimeparse2) · [View on PyPI](https://pypi.org/project/pytimeparse2/)