Skip to main content

nl2time (Python)

Deterministic resolution of temporal-expression IR — the Python port of nl2time, a bidirectional natural language ⇄ date/time library built around a JSON intermediate representation (TimeExpr).

Scope of this release: the language-neutral core. IR validation, TimeContext (reference instant, IANA timezone, locale-derived week/date policy, ambiguity knobs), and the full deterministic engine resolve() — every operator including calendar snapping, DST-correct offsets, holidays (computed Easter), business-day spans, and ordered ambiguity candidates. Natural-language parsing and rendering are not yet ported; today the expected producers of IR are the JS parser, an LLM emitting schema-constrained IR, or your own code. Time model: whenever (Temporal-inspired).

from nl2time import TimeContext, resolve

ctx = TimeContext.make({
    "now": "2026-07-20T17:00:00Z",
    "timeZone": "America/Los_Angeles",
    "locale": "en-US",
})

# "last week" as IR (e.g. produced by the JS parser or an LLM):
expr = {
    "op": "snap",
    "base": {"op": "offset", "base": {"op": "now"}, "amount": -1, "unit": "week"},
    "unit": "week",
}
resolve(expr, ctx)["candidates"][0]
# {"kind": "interval", "start": Instant("2026-07-12 07:00:00Z"),
#  "end": Instant("2026-07-19 07:00:00Z"), "grain": "week"}
# (values are `whenever.Instant`; candidates are ordered, ambiguity is data)

Parity guarantee

This engine reproduces the JS reference bit-exactly — instants, grains, and candidate order — across all 2,782 machine-generated engine-parity fixtures derived from the project's six-language conformance corpora, enforced in CI on every commit. Spec: ir-spec.md; strategy: porting.md; test-data provenance: corpus/ATTRIBUTIONS.md.

MIT.

Metadata

Release files for nl2time 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nl2time 0.1.2
File Size Uploaded Provenance Actions
nl2time-0.1.2.tar.gz 29.3 kB With provenance Details for nl2time-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nl2time 0.1.2
File Interpreter ABI Platform Actions
nl2time-0.1.2-py3-none-any.whl Python 3 none any Details for nl2time-0.1.2-py3-none-any.whl

Total release size: 48.7 kB

Release files / nl2time-0.1.2.tar.gz

Download URL nl2time-0.1.2.tar.gz
Size 29.3 kB
Tags Source
SHA-256 checksum
How to use checksums
63ce1e858eb5d26e7dd741f1b1da605108e6af23dd4d9cf96ab3990289daa709
BLAKE2b-256 checksum
How to use checksums
02a98b3dd842958a4e9f4649008f209b40fcd2326ab463ab96d77b10d291f79c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.

Transparency log

Release files / nl2time-0.1.2-py3-none-any.whl

Download URL nl2time-0.1.2-py3-none-any.whl
Size 19.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0010f07f16032512023cc1ef1ab99c4b8bd258399b14c05de3d0087c207eca91
BLAKE2b-256 checksum
How to use checksums
56001642120cd9c2cb81ca531744a15491e83f76e14f2384b95e864a268ff846
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.

Transparency log

Security for nl2time 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nl2time-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page