Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

pytest-ditto-polars

Extension plugin for pytest-ditto for polars DataFrame snapshots.

Use the following marks for their associated recorder:

  • @ditto.polars.parquet
  • @ditto.polars.ipc
  • @ditto.polars.csv
  • @ditto.polars.ndjson

Each mark is shorthand for @ditto.record("polars.<format>").

Installation

pip install pytest-ditto[polars]

Usage

import polars as pl
import polars.testing

import ditto


def awesome_fn_to_test(df: pl.DataFrame) -> pl.DataFrame:
    return df.with_columns(pl.col("a") * 2)


# The following test uses polars.DataFrame.write_parquet to write the data snapshot
# to the `.ditto` directory with filename:
# `<module>.test_fn_with_parquet_dataframe_snapshot@ab_dataframe.polars.parquet`.


@ditto.polars.parquet
def test_fn_with_parquet_dataframe_snapshot(snapshot):
    input_data = pl.DataFrame({"a": [1, 2, 3], "b": [4, 5, 9]})
    result = awesome_fn_to_test(input_data)
    pl.testing.assert_frame_equal(result, snapshot(result, key="ab_dataframe"))

Format notes

Prefer @ditto.polars.parquet. It round-trips a DataFrame's values and dtypes. The other formats are available when you need them, with these limits:

Format Values and dtypes
parquet preserved
ipc preserved; Polars marks write_ipc unstable, so snapshots can break across Polars versions
csv re-inferred from text
ndjson re-inferred from JSON

IPC uses Polars' Arrow IPC writer. Polars documents write_ipc as unstable, so a snapshot recorded on one Polars version may fail to load or compare on another even if the DataFrame under test did not change.

CSV and NDJSON keep no type metadata, so dtypes are inferred again on load. Frames of ints, floats, and strings round-trip in the plugin tests. Do not use these formats for categoricals, enums, nested, or temporal columns.

Metadata

Release files for pytest-ditto-polars 2.0.0rc2

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

Source distribution (sdist)

Source distribution for pytest-ditto-polars 2.0.0rc2
File Size Uploaded
pytest_ditto_polars-2.0.0rc2.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-ditto-polars 2.0.0rc2
File Interpreter ABI Platform
pytest_ditto_polars-2.0.0rc2-py3-none-any.whl Python 3 none any Details

Total release size: 8.2 kB

Release files / pytest_ditto_polars-2.0.0rc2.tar.gz

Download URL pytest_ditto_polars-2.0.0rc2.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
633396e153be818f03e3651c935927a74eb80ca0010b740c1610466b0aa0608c
BLAKE2b-256 checksum
How to use checksums
529d4de46f74d665ceddc953404078884a1f66cec5dfb7be4c25f4b2555118c8
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 Oct 7, 2026.

Transparency log

Release files / pytest_ditto_polars-2.0.0rc2-py3-none-any.whl

Download URL pytest_ditto_polars-2.0.0rc2-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0adee424990d8b27cb078ab90341e89c494d19c5d0ec3638dd76a80b0a453fc
BLAKE2b-256 checksum
How to use checksums
4953b3b4fa68e24dd97e15f6fe8d53d0e2e71c0954cbdd5468c0f8a4ea13d7b2
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 Oct 7, 2026.

Transparency log

Release history Release notifications | RSS feed

2.0.0

2 release files

This release

2.0.0rc2 This release

2 release files

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