A time library that prioritises clean and safe APIs.
Project description
Welcome to goodtime, a Python date/time library that prioritises safety and correctness.
>>> from goodtime import *
>>> Instant.now()
Instant(unix_timestamp_ns=1770029789026987530)
>>> Instant.now() + hours(1)
Instant(unix_timestamp_ns=1770033404038049963)
>>> Instant.now().to_unix_seconds()
1770029824
>>> Instant.from_unix_seconds(1770029824)
Instant(unix_timestamp_ns=1770029824000000000)
Handling of timestamps, durations and human-readable dates and times is notoriously error-prone due to issues with time zones, ambiguous arithmetics, ambiguous units, etc. This is especially true in distributed systems, where interacting systems may be written by multiple teams that did not have shared assumptions about date/time semantics.
The goal of goodtime is to minimise the potential for errors by:
- using types that have well-defined semantics,
- preventing ambiguous conversions (e.g. timestamp to integer),
- providing explicit interfaces to interoperate with non-goodtime code.
See package documentation for more information on provided types, operations, and best practices.
Getting Started
Install goodtime from PyPI using your favourite Python package manager:
$ python -m pip install goodtime
$ poetry add goodtime
$ uv add goodtime
Contributing
We are open to feedback and contributions under the terms of the MIT license. Feel free to open a Github issue or a pull request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file goodtime-0.4.0.tar.gz.
File metadata
- Download URL: goodtime-0.4.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b43ad3cf2769926a56634b82c104eebb2e1b5331521bc67c76edcef46763b47a
|
|
| MD5 |
be99e30406415dc966771b4ec1dfdefd
|
|
| BLAKE2b-256 |
a520e6284d390fa3d1cd774233e57aac7f542c3e32b8a4024c053b0aefb2c593
|
File details
Details for the file goodtime-0.4.0-py3-none-any.whl.
File metadata
- Download URL: goodtime-0.4.0-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cca6bdbef341f272b2c70eeb85b276e59ae613102436cfaf6cd8060b537e971
|
|
| MD5 |
f4dee23d4ddafa1c1ac7defa7fde3821
|
|
| BLAKE2b-256 |
1a01eaaf9eb9f380514ed64e498dcdb857a079e30144f00c7eb267889a2b3f80
|