Metadata-Version: 2.4
Name: durationpy
Version: 0.12
Summary: Module for converting between datetime.timedelta and Go's Duration strings.
Author-email: Ilia Choly <ilia.choly@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/icholy/durationpy
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# 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.
