durationpy
Module for converting between datetime.timedelta and Go's Duration strings.
Decision gist · record as of 2026-08-14
Yes, if you need Go-to-Python duration conversion. The package is simple, dependency-free, and permissively licensed. However, note that maintenance is aging (last update 2025-05-17, last commit 2026-02-03); verify compatibility with your Python version before relying on it for production use.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Nanosecond precision is lost because datetime.timedelta uses microsecond resolution.
- Low friction: pure Python wheel with no runtime dependencies.
- Maintenance is aging—last commit was 2026-02-03 and the package has not been updated since 2025-05-17, though the repository remains active and unarchived.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package with minimal restrictions, provided you retain the license notice.
last release 2025-05-17 (454 days) · last repo commit 2026-02-03 · 41 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 78,620,724 downloads/mo, #434 on PyPI
Alternatives
Verify before relying
pip install durationpy
import durationpy
td = durationpy.from_str("4h3m2s1ms")
result = durationpy.to_str(td)- Whether the package actively maintains compatibility with current Python versions, given the aging maintenance status.
What it is and what it does
durationpy is a lightweight utility for bidirectional conversion between Python's `datetime.timedelta` objects and Go's duration string format. It parses Go-style duration strings (using units like ns, us, ms, s, m, h, d, w, mm, y) into timedelta objects and formats timedelta objects back into Go duration strings. This is useful when integrating Python code with Go systems or APIs that communicate durations in Go's native format.
The package has no runtime dependencies and installs as a pure Python wheel. It is straightforward to use: call `from_str()` to parse a duration string and `to_str()` to format a timedelta. One important limitation is that nanosecond precision is lost during conversion because Python's timedelta operates at microsecond resolution.
Use it for
- Parse Go duration strings from configuration files or API responses into Python timedelta objects for scheduling or timing logic.
- Format Python timedelta objects into Go duration strings when communicating with Go microservices or APIs.
- Convert between Go and Python duration representations in polyglot systems that mix both languages.
- Handle duration data in interoperability layers or middleware that bridges Go and Python components.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need Go-to-Python duration conversion.
The package is simple, dependency-free, and permissively licensed. However, note that maintenance is aging (last update 2025-05-17, last commit 2026-02-03); verify compatibility with your Python version before relying on it for production use.
Install
durationpy on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Maintenance is aging—last commit was 2026-02-03 and the package has not been updated since 2025-05-17, though the repository remains active and unarchived.
Nanosecond precision is lost because datetime.timedelta uses microsecond resolution.
License in practice
MIT license is permissive; you can use, modify, and distribute this package with minimal restrictions, provided you retain the license notice.
Quickstart
pip install durationpy
import durationpy
td = durationpy.from_str("4h3m2s1ms")
result = durationpy.to_str(td)
Verify before relying
- Whether the package actively maintains compatibility with current Python versions, given the aging maintenance status.
Package facts
| License | MIT permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Aging 454 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 78,620,724 / month, #434 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: durationpy-0.10-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “timedelta to go duration string”
- durationpyConverts between Python's `datetime.timedelta` and Go-style duration…
- pytimeparse2Parses human-readable time expressions (like '2h32m', '1.2 minutes',…
- isodateParses and formats ISO 8601 date, time, duration, and timezone…
Give your agent the search over MCP, or paste the wish link into any chat.
Similar packages
Parses human-readable duration strings like '1 hour' or '2 months and 3 weeks' into Python timedelta objects, with optional context-aware calculation for months and years.
No—install only if you have no alternative and can verify compatibility with your Python version.
Parses and formats ISO 8601 date, time, duration, and timezone strings into Python standard types like date, time, datetime, timedelta, and a custom Duration class.
Install it if you need to parse or format ISO 8601 strings.
Parses human-readable time expressions (like '2h32m', '1.2 minutes', '2 days, 4:13:02') into seconds or timedelta objects.
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.
Hightime provides drop-in replacements for Python's datetime and timedelta types that support precision down to yoctoseconds, enabling sub-microsecond time arithmetic and representation.
Install only if you actually need precision beyond microseconds; standard datetime is simpler and faster for typical applications.
Timple extends Matplotlib with locators and formatters for plotting timedelta values, enabling readable time-interval axis ticks and automatic formatting of duration data.
However, dormant maintenance (last update 2023-12-27) means you should verify compatibility with your current Matplotlib and pandas versions before relying on it in…
Neotime provides temporal data classes (Duration, Date, Time, DateTime) with nanosecond precision, similar to the standard library's datetime module but with finer granularity.
Install only if you are maintaining legacy code that already depends on it.
See also ago · humanreadable · aniso8601 · pytimeparse