# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Build/Test Commands - Build: `make build` - Run all tests: `make check` - Run single test: `PYTHONPATH=$(pwd) python3 -m unittest tests.test_module_name.TestClassName.test_method_name` - Type checking: `make typing` or `python3 -m mypy dulwich` - Lint code: `make style` or `ruff check .` - Fix lint issues: `make fix` or `ruff check --fix .` - Format code: `make reformat` or `ruff format .` - Generate coverage: `make coverage` or `make coverage-html` for HTML report ## Code Style Guidelines - Follow PEP8 with accommodations listed in `pyproject.toml` (ruff config) - Use Google-style docstrings for public methods, functions and classes - Triple quotes should always be """, single quotes are ' (unless " reduces escaping) - Git paths/filenames are treated as bytestrings (bytes), not unicode strings - On-disk filenames: use regular strings or pathlib.Path objects - Ensure all functionality is available in pure Python (Rust implementations optional) - Add unit tests for new functionality and bug fixes - All contributions must be under Apache License 2.0+ or GPL 2.0+ - When adding new test files, ensure the test accumulation functions are updated (i.e. ``self_test_suite()`` in `tests/__init__.py` or ``test_suite()`` in `tests/compat/__init__.py`) - Do not ignore exceptions. Never catch ``Exception`` unless you're going to re-raise it, always something more specific. Catch specific exceptions. Don't catch OSError, but specific subclasses. - Keep code in try/except blocks to a minimum, and use else:. This keeps the code that can raise an exception to a minimum. - There is almost never a good reason to catch AttributeError.