|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +DeepDiff is a Python library for deep comparison, searching, and hashing of Python objects. It provides: |
| 8 | +- **DeepDiff**: Deep difference detection between objects |
| 9 | +- **DeepSearch**: Search for objects within other objects |
| 10 | +- **DeepHash**: Content-based hashing for any object |
| 11 | +- **Delta**: Git-like diff objects that can be applied to other objects |
| 12 | +- **CLI**: Command-line interface via `deep` command |
| 13 | + |
| 14 | +## Development Commands |
| 15 | + |
| 16 | +### Setup |
| 17 | +```bash |
| 18 | +# Install with all development dependencies |
| 19 | +pip install -e ".[cli,coverage,dev,docs,static,test]" |
| 20 | +# OR using uv (recommended) |
| 21 | +uv sync --all-extras |
| 22 | +``` |
| 23 | + |
| 24 | +### Testing |
| 25 | +```bash |
| 26 | +# Run tests with coverage |
| 27 | +pytest --cov=deepdiff --cov-report term-missing |
| 28 | + |
| 29 | +# Run tests including slow ones |
| 30 | +pytest --cov=deepdiff --runslow |
| 31 | + |
| 32 | +# Run single test file |
| 33 | +pytest tests/test_diff_text.py |
| 34 | + |
| 35 | +# Run tests across multiple Python versions |
| 36 | +nox -s pytest |
| 37 | +``` |
| 38 | + |
| 39 | +### Quality Checks |
| 40 | +```bash |
| 41 | +# Linting (max line length: 120) |
| 42 | +nox -s flake8 |
| 43 | + |
| 44 | +# Type checking |
| 45 | +nox -s mypy |
| 46 | + |
| 47 | +# Run all quality checks |
| 48 | +nox |
| 49 | +``` |
| 50 | + |
| 51 | +## Architecture |
| 52 | + |
| 53 | +### Core Structure |
| 54 | +- **deepdiff/diff.py**: Main DeepDiff implementation (most complex component) |
| 55 | +- **deepdiff/deephash.py**: DeepHash functionality |
| 56 | +- **deepdiff/base.py**: Shared base classes and functionality |
| 57 | +- **deepdiff/model.py**: Core data structures and result objects |
| 58 | +- **deepdiff/helper.py**: Utility functions and type definitions |
| 59 | +- **deepdiff/delta.py**: Delta objects for applying changes |
| 60 | + |
| 61 | +### Key Patterns |
| 62 | +- **Inheritance**: `Base` class provides common functionality with mixins |
| 63 | +- **Result Objects**: Different result formats (`ResultDict`, `TreeResult`, `TextResult`) |
| 64 | +- **Path Navigation**: Consistent path notation for nested object access |
| 65 | +- **Performance**: LRU caching and numpy array optimization |
| 66 | + |
| 67 | +### Testing |
| 68 | +- Located in `/tests/` directory |
| 69 | +- Organized by functionality (e.g., `test_diff_text.py`, `test_hash.py`) |
| 70 | +- Aims for ~100% test coverage |
| 71 | +- Uses pytest with comprehensive fixtures |
| 72 | + |
| 73 | +## Development Notes |
| 74 | + |
| 75 | +- **Python Support**: 3.9+ and PyPy3 |
| 76 | +- **Main Branch**: `master` (PRs typically go to `dev` branch) |
| 77 | +- **Build System**: Modern `pyproject.toml` with `flit_core` |
| 78 | +- **Dependencies**: Core dependency is `orderly-set>=5.4.1,<6` |
| 79 | +- **CLI Tool**: Available as `deep` command after installation with `[cli]` extra |
0 commit comments