Skip to content

Commit 92f1a81

Browse files
update docs wip
1 parent 2315b8f commit 92f1a81

12 files changed

Lines changed: 275 additions & 47 deletions

docs/api/diffly.cli.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
diffly.cli module
2+
=================
3+
4+
.. automodule:: diffly.cli
5+
:members:
6+
:show-inheritance:
7+
:undoc-members:

docs/api/diffly.comparison.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
diffly.comparison module
2+
========================
3+
4+
.. automodule:: diffly.comparison
5+
:members:
6+
:show-inheritance:
7+
:undoc-members:

docs/api/diffly.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
diffly package
2+
==============
3+
4+
Submodules
5+
----------
6+
7+
.. toctree::
8+
:maxdepth: 4
9+
10+
diffly.cli
11+
diffly.comparison
12+
diffly.summary
13+
diffly.testing
14+
15+
Module contents
16+
---------------
17+
18+
.. automodule:: diffly
19+
:members:
20+
:show-inheritance:
21+
:undoc-members:

docs/api/diffly.summary.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
diffly.summary module
2+
=====================
3+
4+
.. automodule:: diffly.summary
5+
:members:
6+
:show-inheritance:
7+
:undoc-members:

docs/api/diffly.testing.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
diffly.testing module
2+
=====================
3+
4+
.. automodule:: diffly.testing
5+
:members:
6+
:show-inheritance:
7+
:undoc-members:

docs/api/modules.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
diffly
2+
======
3+
4+
.. toctree::
5+
:maxdepth: 4
6+
7+
diffly

docs/conf.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
"numpydoc",
4141
"sphinx.ext.linkcode",
4242
"sphinxcontrib.apidoc",
43+
"myst_parser",
44+
"sphinx_copybutton",
4345
]
4446

4547
apidoc_module_dir = "../diffly"
@@ -49,9 +51,29 @@
4951

5052
templates_path = ["_templates"]
5153
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
52-
html_theme = "sphinx_rtd_theme"
54+
html_theme = "pydata_sphinx_theme"
55+
pygments_style = "lovelace"
56+
html_theme_options = {
57+
"external_links": [],
58+
"icon_links": [
59+
{
60+
"name": "GitHub",
61+
"url": "https://github.com/Quantco/diffly",
62+
"icon": "fa-brands fa-github",
63+
},
64+
],
65+
}
66+
html_title = "Diffly"
5367
html_static_path = ["_static"]
5468

69+
# object signatures
70+
maximum_signature_line_length = 88
71+
72+
source_suffix = {
73+
".rst": "restructuredtext",
74+
".md": "markdown",
75+
}
76+
5577

5678
# Copied and adapted from
5779
# https://github.com/pandas-dev/pandas/blob/4a14d064187367cacab3ff4652a12a0e45d0711b/doc/source/conf.py#L613-L659

docs/guides/index.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# User Guide
2+
3+
```{toctree}
4+
:maxdepth: 2
5+
:hidden:
6+
7+
quickstart
8+
examples/index
9+
features/index
10+
faq
11+
```
12+
13+
## Installation
14+
15+
To install `diffly`, use your favorite package manager, e.g., using `pixi` or `pip`:
16+
17+
```bash
18+
pixi add diffly
19+
pip install diffly
20+
```

docs/index.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Diffly
2+
3+
A utility package for comparing Polars DataFrames.
4+
5+
```{toctree}
6+
:maxdepth: 2
7+
:hidden:
8+
9+
guides/index
10+
API Reference <api/modules>
11+
```
12+
13+
## What is Diffly?
14+
15+
Diffly is a utility package for comparing Polars DataFrames and LazyFrames with detailed analysis capabilities. It identifies differences between datasets including:
16+
17+
- **Schema differences**: Columns that exist only in one DataFrame
18+
- **Row-level mismatches**: Rows that are different between DataFrames
19+
- **Missing rows**: Rows that exist only in one DataFrame
20+
- **Column value changes**: Detailed analysis of which columns differ and by how much
21+
22+
## Key Features
23+
24+
- **Primary key-based comparison**: Join DataFrames on specified primary keys for row-by-row comparison
25+
- **Tolerance-based equality**: Configure absolute and relative tolerances for floating point comparisons
26+
- **Temporal tolerance**: Support for comparing temporal types (dates, datetimes) with configurable tolerances
27+
- **Rich summaries**: Generate detailed, visually formatted comparison reports
28+
- **Lazy evaluation**: Uses Polars LazyFrames internally for efficient computation
29+
- **Method caching**: Automatically caches comparison results to avoid recomputation
30+
- **Per-column tolerances**: Fine-grained control over comparison tolerances for each column
31+
- **Testing utilities**: Built-in assertion functions for DataFrame and Collection equality in tests
32+
33+
## Quick Example
34+
35+
```python
36+
import polars as pl
37+
from diffly import compare_frames
38+
39+
# Create two DataFrames to compare
40+
left = pl.DataFrame({
41+
"id": ["a", "b", "c"],
42+
"value": [1.0, 2.0, 3.0],
43+
"category": ["x", "y", "z"]
44+
})
45+
46+
right = pl.DataFrame({
47+
"id": ["a", "b", "d"],
48+
"value": [1.0, 2.1, 4.0],
49+
"category": ["x", "y", "w"]
50+
})
51+
52+
# Compare the DataFrames
53+
comparison = compare_frames(left, right, primary_key="id")
54+
55+
# Check if they're equal
56+
if not comparison.equal():
57+
# Display a detailed summary
58+
summary = comparison.summary(
59+
show_perfect_column_matches=True,
60+
top_k_column_changes=5
61+
)
62+
print(summary)
63+
```
64+
65+
## Next Steps
66+
67+
- Follow the [Quickstart Guide](guides/quickstart.md) for a comprehensive introduction
68+
- Explore [Examples](guides/examples/index.md) for common use cases
69+
- Learn about advanced [Features](guides/features/index.md) like tolerances and custom summaries
70+
- Check the [API Reference](api/modules.rst) for detailed function documentation

docs/index.rst

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)