skillfed

freezegun

Let your Python tests travel through time

freezegun Permissive license Apache-2.0 AGING 4,521 v1.5.5 released

Install

freezegun on PyPI

pip

pip install freezegun

uv

uv add freezegun

poetry

poetry add freezegun

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 1 — python-dateutil
Maintenance aging — 369 days since the last release
Last repo commit
First released
Popularity one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13)
Known vulnerabilities none known (OSV.dev, checked 2026-08-13)

Evidence: freezegun-1.5.5-py3-none-any.whl

Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

About freezegun

from the package's own PyPI description — quoted content, verbatim

FreezeGun: Let your Python tests travel through time

.. image:: https://img.shields.io/pypi/v/freezegun.svg :target: https://pypi.python.org/pypi/freezegun/ .. image:: https://github.com/spulec/freezegun/workflows/CI/badge.svg :target: https://github.com/spulec/freezegun/actions .. image:: https://coveralls.io/repos/spulec/freezegun/badge.svg?branch=master :target: https://coveralls.io/r/spulec/freezegun

FreezeGun is a library that allows your Python tests to travel through time by mocking the datetime module.

Usage

Once the decorator or context manager have been invoked, all calls to datetime.datetime.now(), datetime.datetime.utcnow(), datetime.date.today(), time.time(), time.localtime(), time.gmtime(), and time.strftime() will return the time that has been frozen. time.monotonic() and time.perf_counter() will also be frozen, but as usual it makes no guarantees about their absolute value, only their changes over time.

Decorator ~~~~~~~~~

.. code-block:: python

from freezegun import freeze_time
import datetime
import unittest

# Freeze time for a pytest style test:...

Read as markdown · JSON record · Source repository · Homepage · Docs

AI interpretation — verify before relying

AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page

FreezeGun mocks Python's datetime and time modules to let tests control the current time, enabling you to test time-dependent code without waiting or dealing with real clock progression.

Low friction: pure Python wheel with only python-dateutil as a runtime dependency. Last release was 369 days ago; repository remains active with recent commits (2025-08-19) and 4521 stars, though maintenance status is aging.

Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions—suitable for most projects including proprietary codebases.

Usage

pip install freezegun
from freezegun import freeze_time
import datetime

@freeze_time("2012-01-14")
def test():
    assert datetime.datetime.now() == datetime.datetime(2012, 1, 14)

Verdict: FreezeGun is a mature, well-maintained testing utility with no known vulnerabilities and permissive licensing. Its single lightweight dependency and broad Python 3.8+ support make it low-risk to adopt. The aging maintenance status (369 days since last release) is typical for stable libraries and does not indicate abandonment given recent repository activity.

Needs verification

  • Whether the 369-day gap reflects a stable, feature-complete package or signals reduced active development
  • Compatibility with newer Python 3.13+ features or any edge cases in time mocking across different platforms
mock datetime for testingfreeze time in teststest time-dependent codedatetime mocking librarycontrol system time in teststime travel for unit testsfake clock for testing

Similar packages