Skip to main content
Build Status Documentation Status

Description

pyRFC3339 parses and generates RFC 3339-compliant timestamps using Python datetime.datetime objects.

>>> from pyrfc3339 import generate, parse
>>> from datetime import UTC, datetime
>>> generate(datetime.now(UTC)) #doctest:+ELLIPSIS
'...T...Z'
>>> parse('2009-01-01T10:01:02Z')
datetime.datetime(2009, 1, 1, 10, 1, 2, tzinfo=datetime.timezone.utc)
>>> parse('2009-01-01T14:01:02-04:00')
datetime.datetime(2009, 1, 1, 14, 1, 2, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=72000)))

Status

The first lines of code for what would become pyRFC3339 were written in 2009, as part of a larger project which would itself never see the light of day. At the time, the most expedient approach to parsing RFC 3339 timestamps seemed to be to use a regular expression derived from the ABNF grammar contained in the RFC. In retrospect, this seems absurd. Seventeen years later, the Python standard library is now well-suited to the task.

To be blunt: you do not need pyRFC3339 on any modern version of Python [1]. This library is now merely a thin wrapper around the datetime.datetime.fromisoformat() and datetime.datetime.isoformat(). You can call these functions yourself and eliminate a dependency from your dependency tree.

It is completely true that once upon a time, handling of ISO 8601 (and, by extension, RFC 3339) timestamps was a notable blindspot in Python’s “batteries-included” standard library. But this is no longer the case. There is now built-in support for the IANA time zone database as well as all of the relevant parts of ISO 8601.

Installation

To install the latest version from PyPI:

$ pip install pyRFC3339

To install the latest development version:

$ pip install https://github.com/kurtraschke/pyRFC3339/tarball/main#egg=pyRFC3339-dev

Tests as well as enforcement of code style, formatting, and type safety are run with tox:

$ tox

To build the documentation with Sphinx:

$ tox -e docs

The documentation is also available online at:

https://pyrfc3339.readthedocs.io/

Footnotes

Metadata

Release files for pyRFC3339 2.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 pyRFC3339 2.1.2
File Size Uploaded Provenance Actions
pyrfc3339-2.1.2.tar.gz 14.5 kB With provenance Details for pyrfc3339-2.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 21.4 kB

Release files / pyrfc3339-2.1.2.tar.gz

Download URL pyrfc3339-2.1.2.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
87a8c8567da96b618e5604e9a9e9bf6eaaa9cf676181b78edb63d29a00f110f9
BLAKE2b-256 checksum
How to use checksums
abb14c4a57a07bacead52ee3f16e8297dbcc84956592f6f7be8d89ba4302c668
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 28, 2026.

Transparency log

Release files / pyrfc3339-2.1.2-py3-none-any.whl

Download URL pyrfc3339-2.1.2-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c2db465c924229de372e1480da8c32d9b9658b39485daa2fc5467e263f5eb3be
BLAKE2b-256 checksum
How to use checksums
cbd1f08592d6f900ba2445646aa21afe3be1ef5242b29f6fc62a0dcab05938eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 28, 2026.

Transparency log

Security for pyRFC3339 2.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyrfc3339-2.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 Nov 28, 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