Registry / serialization / nr-date

nr-date

JSON →
library2.1.0pypiunverified

nr-date is a fast, regex-based Python library designed for parsing human-readable dates and ISO 8601 durations in pure Python. It provides functionality to handle various date and time formats and is known for its performance compared to some standard library alternatives. The library is currently at version 2.1.0 and receives periodic updates, with major releases occurring roughly every few years.

pip install nr-date
INSTALL
IMPORT
SIG · NR-DATE
N
nr-date
serializationenv2.1.0
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.9MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ISO_8601
from nr.parsing.date import ISO_8601
import nr_date
The package is installed as 'nr-date' but its core functionality is exposed via the 'nr.parsing.date' module.
duration
from nr.parsing.date import duration
import nr_date
The package is installed as 'nr-date' but its core functionality is exposed via the 'nr.parsing.date' module.

Demonstrates parsing an ISO 8601 datetime string and an ISO 8601 duration string using the respective parsers from `nr.parsing.date`.

from nr.parsing.date import ISO_8601, duration # Parse an ISO 8601 datetime string datetime_obj = ISO_8601.parse('2021-04-21T10:13:00.124+0000') print(f"Parsed datetime: {datetime_obj}") # Parse an ISO 8601 duration string duration_obj = duration.parse('P3Y6M4DT12H30M5S') print(f"Parsed duration: {duration_obj}")
Debug
Known issues
gotchaWhen installing `nr-date` via pip, the core functionalities for parsing dates and durations are typically found within the `nr.parsing.date` module, not directly under `nr_date`. Attempting `import nr_date` will likely result in a `ModuleNotFoundError`.
fix
Always use `from nr.parsing.date import ISO_8601, duration` or similar specific imports.
affects: All known versions (1.0.0+)
gotchaAs a regex-based parser, `nr-date` can be sensitive to the exact formatting of input strings. While flexible, unexpected input variations (e.g., missing optional separators or components) might lead to `None` being returned or incorrect parsing if not explicitly handled by a custom regex format.
fix
Familiarize yourself with the supported format options and ensure input data conforms closely to these patterns. Consider adding custom format strings for highly variable inputs.
affects: All known versions (1.0.0+)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'nr_date'
The package is installed as 'nr-date' on PyPI, but its internal Python module structure does not expose `nr_date` directly as a top-level module. The primary components are within `nr.parsing.date`.
fix
Change your import statement from `import nr_date` to `from nr.parsing.date import ISO_8601, duration` (or other specific components you need).
AttributeError: module 'nr.parsing.date' has no attribute 'parse'
The `nr.parsing.date` module itself does not expose a global `parse` function. Instead, parsing is done through specific parser objects like `ISO_8601` or `duration` that are imported from the module.
fix
Instead of `nr.parsing.date.parse('...')`, you should use `ISO_8601.parse('...')` or `duration.parse('...')` depending on what you intend to parse.
Upgrade
Version history
2.1.0latest on PyPI · released Aug 16, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources

No resource links recorded.

nr-date — pip install nr-date · libregistry