skillfed

backports-datetime-fromisoformat

Backport of Python 3.11's datetime.fromisoformat

backports-datetime-fromisoformat v2.0.3 2.1M downloads/30d#3,259 on PyPI29
Permissive license MIT License Copyright (c) 2018 Michael Overmeyer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) AGING released

What it is and what it does

This package backports the expanded `datetime.fromisoformat` methods from Python 3.11 to earlier versions, allowing you to parse ISO 8601 timestamps with much broader format coverage than the built-in methods provide. The standard library's `fromisoformat` in older Python versions only handles timestamps produced by `isoformat` itself; this backport extends that to parse most of the ISO 8601 specification, including timezone offsets and various timestamp formats.

The implementation is a C port of CPython code, using a custom timezone implementation for timezone-aware objects. It requires explicit monkey-patching via `MonkeyPatch.patch_fromisoformat()` to replace the standard library methods. On Python 3.11 and later, the package has no effect—the native methods already have the full ISO 8601 support.

Use it for:

  • Parse ISO 8601 timestamps from APIs or data sources in earlier Python versions without manual string manipulation.
  • Handle timezone-aware datetime strings with non-standard offsets in legacy Python environments.
  • Upgrade code to use the modern `fromisoformat` API while maintaining compatibility with older Python versions.
  • Avoid dependency on third-party datetime libraries when only ISO 8601 parsing is needed.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Backports expanded `datetime.fromisoformat` methods to earlier Python versions, enabling parsing of ISO 8601 timestamps with broader format support than the standard library provides in older releases.

Yes, if you support Python versions earlier than 3.11 and need to parse ISO 8601 timestamps reliably. The package is stable, permissively licensed, and has no runtime dependencies. Install it conditionally so it only activates on older Python versions. Not needed for Python 3.11 and later.

Install

backports-datetime-fromisoformat on PyPI

pip

pip install backports-datetime-fromisoformat

uv

uv add backports-datetime-fromisoformat

poetry

poetry add backports-datetime-fromisoformat

Installing backports-datetime-fromisoformat

Before you install

Medium install friction due to platform-specific wheels across macOS, Linux, Windows, and musl variants. Last release was 594 days ago; maintenance status is aging but the repository remains active with a recent commit on 2025-03-31. Development is described as complete, so infrequent updates are expected.

License in practice

MIT License permits unrestricted use, modification, and distribution with minimal restrictions—suitable for any project type.

Quickstart

pip install backports-datetime-fromisoformat

from datetime import datetime
from backports.datetime_fromisoformat import MonkeyPatch
MonkeyPatch.patch_fromisoformat()

dt = datetime.fromisoformat("2014-01-09T21:48:00-05:30")

Requires explicit monkey-patching to override the standard library methods. Only affects Python versions earlier than 3.11.

Verify before relying

  • Performance characteristics of the C implementation compared to pure-Python alternatives in typical workloads.
  • Full compatibility scope with timezone-aware datetime objects beyond the custom timezone implementation mentioned.

Package facts

License MIT License Copyright (c) 2018 Michael Overmeyer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) (permissive)
Python support supports the current Python release (>3)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance aging — 594 days since the last release
Last repo commit
First released
Downloads 2,139,707/month — #3,259 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: backports_datetime_fromisoformat-2.0.3-cp310-cp310-macosx_11_0_arm64.whl; backports_datetime_fromisoformat-2.0.3-cp310-cp310-macosx_11_0_universal2.whl; backports_datetime_fromisoformat-2.0.3-cp310-cp310-macosx_11_0_x86_64.whl; backports_datetime_fromisoformat-2.0.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; backports_datetime_fromisoformat-2.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; backports_datetime_fromisoformat-2.0.3-cp310-cp310-musllinux_1_2_aarch64.whl; backports_datetime_fromisoformat-2.0.3-cp310-cp310-musllinux_1_2_x86_64.whl; backports_datetime_fromisoformat-2.0.3-cp310-cp310-win_amd64.whl; backports_datetime_fromisoformat-2.0.3-cp311-cp311-macosx_11_0_arm64.whl; backports_datetime_fromisoformat-2.0.3-cp311-cp311-macosx_11_0_universal2.whl; backports_datetime_fromisoformat-2.0.3-cp311-cp311-macosx_11_0_x86_64.whl; backports_datetime_fromisoformat-2.0.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; backports_datetime_fromisoformat-2.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; backports_datetime_fromisoformat-2.0.3-cp311-cp311-musllinux_1_2_aarch64.whl; backports_datetime_fromisoformat-2.0.3-cp311-cp311-musllinux_1_2_x86_64.whl; backports_datetime_fromisoformat-2.0.3-cp311-cp311-win_amd64.whl; backports_datetime_fromisoformat-2.0.3-cp312-cp312-macosx_11_0_arm64.whl; backports_datetime_fromisoformat-2.0.3-cp312-cp312-macosx_11_0_universal2.whl; backports_datetime_fromisoformat-2.0.3-cp312-cp312-macosx_11_0_x86_64.whl; backports_datetime_fromisoformat-2.0.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules

Tags

iso 8601 datetime parsingfromisoformat backportparse iso timestampsdatetime iso format supporttimezone aware datetime parsingiso 8601 compliancelegacy python datetime
datetime-parsingiso-8601backport

More Python Modules packages