--- id: durationpy version: "0.10" license: MIT license_treatment: permissive maintenance: aging --- # durationpy — Module for converting between datetime.timedelta and Go's Duration strings. License: permissive · Maintenance: aging · Popularity: top 1,000 on PyPI ## Install pip install durationpy uv add durationpy poetry add durationpy ## Description # durationpy > Module for converting between `datetime.timedelta` and Go's Duration strings. ### Install ``` sh $ pip install durationpy ``` ### Parse * `ns` - nanoseconds * `us` - microseconds * `ms` - millisecond * `s` - second * `m` - minute * `h` - hour * `d` - day * `w` - week * `mm` - month * `y` - year ``` py # parse td = durationpy.from_str("4h3m2s1ms") # format durationpy.to_str(td) ``` **Note:** nanosecond precision is lost because `datetime.timedelta` uses microsecond resolution. ## AI interpretation — verify before relying Converts between Python's datetime.timedelta objects and Go-style duration strings (e.g., "4h3m2s"), enabling easy parsing and formatting of human-readable time intervals. Verdict: A lightweight, stable utility for Go↔Python duration interop with no dependencies and permissive licensing. Aging maintenance (453 days since last commit) is a minor concern for a stable, narrowly-scoped library with no known vulnerabilities. [View on SkillFed](https://skillfed.io/packages/durationpy) · [View on PyPI](https://pypi.org/project/durationpy/)