Skip to content

Commit 3f97cc3

Browse files
committed
Small updates to AGENTS.md to reflect recent changes
1 parent 615e06d commit 3f97cc3

2 files changed

Lines changed: 37 additions & 14 deletions

File tree

AGENTS.md

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1-
# CLAUDE.md
1+
# AGENTS.md
22

3-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
3+
This file provides guidance to coding agents when working with code in this repository.
4+
5+
To use it with Claude Code, simply run the following command in a terminal:
6+
7+
```bash
8+
echo "@AGENTS.md" > CLAUDE.md
9+
```
410

511
## Development Commands
612

713
This project uses uv as the package manager and taskipy for task automation.
814

915
**Setup:**
1016
```bash
11-
uv sync --locked --all-extras --dev
17+
uv sync --dev --all-extras
1218
```
1319

1420
**Testing:**
@@ -47,20 +53,27 @@ xarray-validate is a lightweight validation library for xarray DataArrays and Da
4753
- `SchemaError`: Custom exception for validation failures
4854

4955
**Validation Components (`components.py`):**
50-
- `DTypeSchema`: Validates NumPy data types
56+
- `DTypeSchema`: Validates NumPy data types (supports dtype generics and multiple matches)
5157
- `DimsSchema`: Validates dimensions (with ordered/unordered support via `ordered` parameter)
5258
- `ShapeSchema`: Validates array shapes (supports wildcards with None)
5359
- `NameSchema`: Validates names
5460
- `ChunksSchema`: Validates dask chunks (bool or dict specification)
5561
- `ArrayTypeSchema`: Validates underlying array types
56-
- `AttrSchema`/`AttrsSchema`: Validates attributes
62+
- `AttrSchema`/`AttrsSchema`: Validates attributes (supports pattern matching for keys and values)
63+
- `UnitsSchema`: Validates physical units using Pint (requires pint optional dependency)
5764

5865
**Pattern Matching Utilities (`_match.py`):**
5966
- `_is_regex_pattern()`: Checks if a key is a regex pattern (enclosed in curly braces)
6067
- `_is_glob_pattern()`: Checks if a key is a glob pattern (contains * or ?)
6168
- `_is_pattern_key()`: Checks if a key is any kind of pattern
6269
- `_pattern_to_regex()`: Converts glob or regex patterns to compiled regex objects
63-
- Used for pattern-based matching in coordinate and data variable keys
70+
- Used for pattern-based matching in coordinate keys, data variable keys, and attribute keys/values
71+
72+
**Unit Validation Utilities (`units.py`):**
73+
- `set_registry()`: Set the global Pint unit registry
74+
- `get_registry()`: Get the current Pint unit registry
75+
- `parse()`: Parse unit strings with error handling
76+
- Provides utilities for validating physical units in attributes
6477

6578
**High-Level Schemas:**
6679
- `DataArraySchema` (`dataarray.py`): Combines all validation components for xarray.DataArray objects
@@ -84,18 +97,25 @@ xarray-validate is a lightweight validation library for xarray DataArrays and Da
8497
## Testing Structure
8598

8699
Tests are organized by component:
87-
- `tests/test_components.py`: Tests for validation components
100+
- `tests/test_components.py`: Tests for validation components (including unit validation)
88101
- `tests/test_dataarray.py`: Tests for DataArray schema validation
89102
- `tests/test_dataset.py`: Tests for Dataset schema validation
90-
- `tests/conftest.py`: Shared test fixtures
103+
- `tests/test_lazy_validation.py`: Tests for lazy validation mode
104+
- `tests/test_match.py`: Tests for pattern matching utilities
105+
- `tests/test_yaml_examples.py`: Tests for YAML schema loading
106+
- `conftest.py`: Shared test fixtures (located in project root)
91107

92-
The project targets >90% test coverage and uses pytest with coverage reporting.
108+
The project uses pytest with xdoctest for docstring testing and coverage reporting.
93109

94110
## Dependencies and Compatibility
95111

96112
**Core dependencies:** attrs, numpy, xarray
97-
**Optional dependencies:** dask (for chunk validation), ruamel-yaml (for YAML support)
98-
**Python support:** 3.8 through 3.13
113+
**Optional dependencies:**
114+
- dask (for chunk validation)
115+
- ruamel-yaml (for YAML support)
116+
- pint (for unit validation)
117+
118+
**Python support:** 3.8 through 3.14
99119
**Build system:** hatchling with uv as package manager
100120

101121
## Code Style
@@ -109,11 +129,14 @@ The project targets >90% test coverage and uses pytest with coverage reporting.
109129

110130
**Module Structure:**
111131
- `base.py`: Base classes and core abstractions
112-
- `components.py`: Individual validation components
113-
- `_match.py`: Pattern matching utilities (shared by dataarray.py and dataset.py)
132+
- `components.py`: Individual validation components (including UnitsSchema)
133+
- `_match.py`: Pattern matching utilities (used by dataarray.py, dataset.py, and components.py)
134+
- `units.py`: Unit validation utilities using Pint
114135
- `dataarray.py`: DataArray and Coordinates schemas
115136
- `dataset.py`: Dataset schema
116137
- `types.py`: Type definitions
138+
- `testing.py`: Testing utilities
139+
- `converters.py`: Type converters for attrs
117140

118141
**Key Principles:**
119142
- Shared utilities are factored into dedicated modules (e.g., `_match.py`)

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Development installation:
7777

7878
.. code:: shell
7979
80-
uv sync --all-groups --all-extras
80+
uv sync --dev --all-extras
8181
8282
.. toctree::
8383
:maxdepth: 2

0 commit comments

Comments
 (0)