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.0rc1

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.0rc1
File Size Uploaded
pytest_ditto_polars-2.0.0rc1.tar.gz 4.2 kB Details

Built distribution (wheel)

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

Total release size: 8.2 kB

Release files / pytest_ditto_polars-2.0.0rc1.tar.gz

Download URL pytest_ditto_polars-2.0.0rc1.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1f8d1809952ab2af005ca25fa22bcd9fb398b6010bdb63b64c221d4b3d3e1e86
BLAKE2b-256 checksum
How to use checksums
e27cf0790b7803990ee2d0cff70bf0d8cb67765791392236cb896cc8dcbf218c
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 30, 2026.

Transparency log

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

Download URL pytest_ditto_polars-2.0.0rc1-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4df14f1d7fce2d2fd0dec34589964f41e492d4fcc5717df9f150e5527b94f22
BLAKE2b-256 checksum
How to use checksums
e6d34164ec2e10b761fadace0d81d2b70a20e5e370cd4844a51253f868d6e96b
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 30, 2026.

Transparency log

Release history Release notifications | RSS feed

2.0.0

2 release files

This release

2.0.0rc1 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