Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
924acb4
Reorganize repository to match rms-devenv/repo_template
markshowalter Aug 9, 2026
e947c1f
Make ruff the linter of record and port agent config to .claude
markshowalter Aug 10, 2026
5f46fcc
Convert the test suite to pytest with per-behavior test functions
markshowalter Aug 10, 2026
9db937e
Fix twelve defects in indexing, masking, and object copying
markshowalter Aug 10, 2026
d60e7dc
Make array indexing independent of the length of the indexed axis
markshowalter Aug 10, 2026
4c768a1
Add a code critique of the src tree
markshowalter Aug 10, 2026
5549d10
Add Matrix.solve() for the equation A X = B
markshowalter Aug 10, 2026
cf3acd7
Support denominators in Vector.cross_product_as_matrix()
markshowalter Aug 10, 2026
383bb1b
Bind __ipow__ and drop the remaining unreachable code
markshowalter Aug 10, 2026
52b3475
Add a fast internal constructor for operation results
markshowalter Aug 10, 2026
d902b5f
Test concrete numeric types before the numbers ABCs
markshowalter Aug 10, 2026
64605c6
Reduce the array work in reductions and array operations
markshowalter Aug 10, 2026
588e49e
Contract dot products with einsum
markshowalter Aug 10, 2026
641e3c9
Replace np.rollaxis with np.moveaxis
markshowalter Aug 10, 2026
3a607be
Record the outcome of the performance review in the critique
markshowalter Aug 10, 2026
fc6fb66
Stop four pickler tests depending on a global a fifth one sets
markshowalter Aug 10, 2026
81ca412
Fix seven correctness risks found by review
markshowalter Aug 10, 2026
8e77171
Make the API and its docstrings consistent
markshowalter Aug 10, 2026
3787046
Tighten the packaging and test configuration
markshowalter Aug 10, 2026
fc6d7ed
Publish PEP 561 stubs for the whole public API
markshowalter Aug 10, 2026
077daee
Record the review outcome for sections 2, 6 and 7
markshowalter Aug 10, 2026
b9de277
Fix Polynomial derivative propagation and derivative classes
markshowalter Aug 10, 2026
338e333
Declare __all__ in every module
markshowalter Aug 10, 2026
1c36bb4
Rewrite the unit-name parser and drop the name override
markshowalter Aug 10, 2026
84bc71a
Close the review by recording the outcome for section 4
markshowalter Aug 10, 2026
8667cfe
Include the trace when selecting the Quaternion.from_matrix3 branch
markshowalter Aug 10, 2026
2f654da
Implement derivatives in Quaternion.from_matrix3
markshowalter Aug 10, 2026
b19765f
Delete Quaternion._from_matrix3_experimental
markshowalter Aug 10, 2026
84d6427
Encode Matrix3 as a unit quaternion when pickling
markshowalter Aug 10, 2026
dea0fa0
Take the shape products from the example in Qube._new_from_parts
markshowalter Aug 11, 2026
7841761
Document that Unit operators raise TypeError, not NotImplementedError
markshowalter Aug 11, 2026
1795b68
Name the offending value when a pickle digit or reference is invalid
markshowalter Aug 11, 2026
08fc6df
Compare against a number directly in mask_where_eq and mask_where_ne
markshowalter Aug 11, 2026
65f7546
Add a performance critique of the src tree
markshowalter Aug 11, 2026
6a98197
Substitute replacement values without copying the whole object
markshowalter Aug 11, 2026
690dd44
Build the result of Qube.cast with the fast constructor
markshowalter Aug 11, 2026
7eb4a89
Take the shape products from the example in Qube.__init__ too
markshowalter Aug 11, 2026
ac8dc4a
Contract matrix products directly instead of by broadcasting
markshowalter Aug 11, 2026
c74473d
Contract the norm instead of squaring the whole array
markshowalter Aug 11, 2026
915939c
Copy attributes by name in Qube.clone and Qube.wod
markshowalter Aug 11, 2026
3ae8699
Build unary, reduction and indexing results with the fast constructor
markshowalter Aug 11, 2026
41c709d
Record the outcome of the performance critique
markshowalter Aug 11, 2026
085f1fd
Give a Matrix3 derivative the Matrix class
markshowalter Aug 11, 2026
2d29bed
Tabulate the performance result against main in the critique
markshowalter Aug 11, 2026
5bfa754
Bind the extension methods before the subclasses load
markshowalter Aug 11, 2026
a0995b0
Collect the error-message helpers into extensions/errors.py
markshowalter Aug 11, 2026
4cd2496
Move the derivative operations into extensions/deriv_ops.py
markshowalter Aug 11, 2026
4794830
Move the unit operations into extensions/unit_ops.py
markshowalter Aug 11, 2026
5132717
Move the read-only and copying operations into extensions
markshowalter Aug 11, 2026
6011332
Move the conversions between subclasses into extensions/casting.py
markshowalter Aug 11, 2026
1db2a03
Move the mask machinery into extensions/masking.py
markshowalter Aug 11, 2026
4cd21cf
Move the data type machinery into extensions/dtypes.py
markshowalter Aug 11, 2026
3824806
Record what keeps the extension binding working
markshowalter Aug 11, 2026
a393f91
Align the continuation lines that pycodestyle flags
markshowalter Aug 11, 2026
87f97b6
Gate continuation-line indentation with flake8
markshowalter Aug 11, 2026
6e7ecfd
Rephrase docstring summaries as noun phrases
markshowalter Aug 11, 2026
657a705
Add Polynomial to the class overview lists
markshowalter Aug 11, 2026
041bae9
Assert integrality, not width, in the norm_sq integer test
markshowalter Aug 11, 2026
77cbb4f
Fix the cross-references that nitpicky Sphinx reports as broken
markshowalter Aug 11, 2026
62713f0
Make an unresolved cross-reference fail the documentation build
markshowalter Aug 11, 2026
602b7eb
Add Qube.add_attr for custom attributes carried by copies
markshowalter Aug 14, 2026
9e2e10a
Overlooked, pre-existing tests
markshowalter Aug 14, 2026
cfbab03
Restore the derived attributes missing from an older pickle
markshowalter Aug 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .claude/rules/dependency_management.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
description: Standards for declaring, installing, and maintaining Python project dependencies.
---

# Dependency Management

## 1. Single Source of Truth

- Declare ALL dependencies in **`pyproject.toml`** under `[project]` (PEP 621).
- Do NOT maintain a separate hand-written `requirements.txt` for runtime dependencies. If a `requirements.txt` is kept, it should contain only `-e .` for backward compatibility.

## 2. Dependency Groups

| Group | Section | Install command | Purpose |
|-------|---------|-----------------|---------|
| **Runtime** | `[project].dependencies` | `pip install .` | Required for the package to function. |
| **Dev** | `[project.optional-dependencies].dev` | `pip install -e ".[dev]"` | Testing, linting, type-checking, coverage. |
| **Docs** | `[project.optional-dependencies].docs` | `pip install -e ".[docs]"` | Sphinx and documentation extensions. |

## 3. Version Constraints

- Specify **minimum** compatible versions for direct dependencies (e.g., `numpy>=2.2.0`).
- Do NOT pin exact versions (`==`) in library projects; exact pinning belongs in lock files or application deployments.
- For dev/docs dependencies, specify minimum versions to ensure consistent tool behavior across contributors.

## 4. Adding or Updating Dependencies

1. Add the dependency to the correct section in `pyproject.toml`.
2. Run `pip install -e ".[dev]"` (or the relevant group) to verify installation.
3. Run the full test suite and type-check to confirm compatibility.
4. Commit the `pyproject.toml` change with a `build:` commit type.

## 5. Security and Maintenance

- Run `pip audit` in CI to catch known vulnerabilities.
- Enable automated dependency update tooling (Dependabot, Renovate).
- Review update PRs for breaking changes before merging.
- Periodically remove unused dependencies to reduce attack surface.

## 6. Tooling Configuration

Consolidate all tool configuration into `pyproject.toml` where supported:

| Tool | Section |
|------|---------|
| pytest | `[tool.pytest.ini_options]` |
| coverage | `[tool.coverage.run]`, `[tool.coverage.report]` |
| mypy | `[tool.mypy]`, `[[tool.mypy.overrides]]` |
| ruff | `[tool.ruff]`, `[tool.ruff.lint]` — use explicit `select = [...]` for E, F, W, I, UP, B, SIM, C4, A, N, PT, RUF (see python) |
| setuptools_scm | `[tool.setuptools_scm]` |

Do NOT create separate config files (`.coveragerc`, `.mypy.ini`, `.flake8`, `setup.cfg`) when the tool supports `pyproject.toml`.
122 changes: 122 additions & 0 deletions .claude/rules/doc_dev_guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
---
description: Format, layout, and completeness rules for the developer/contributor guide of a Python package, covering repository layout, class diagrams, per-module prose, and the API reference.
paths:
- "docs/**/*.rst"
- "docs/**/*.md"
---

# Developer Guide

The developer guide is the manual for people who **modify, extend, build, test,
or release** the package. It explains how the code is organized, how the pieces
cooperate, and how to work on it safely. Build on `doc_python` (Sphinx,
cross-references, prose, build discipline). Assume a competent Python developer
who is new to *this* codebase; favor architecture and contracts over restating
what the code already says.

## 1. File Layout

- Live under `docs/` (commonly a `dev_guide/` subdirectory) as reStructuredText.
- A single landing page (e.g. `dev_guide.rst`) holds a 1-2 sentence audience
statement and a `toctree` (deep `:maxdepth:`) listing the chapters in reading
order, ending with the API reference and the contribution guide.
- Organize chapters by subsystem, plus cross-cutting chapters (introduction,
architecture/class hierarchy, extending, conventions). Name files with a
shared prefix (`dev_guide_<topic>.rst`).
- The landing page is reachable from the documentation root `toctree`.

## 2. Required Chapters

- **Introduction** — who the guide is for, how it differs from the user guide,
and a package overview (what it does, the runtime and key dependencies).
- **Repository layout** — an annotated directory tree (a `::` literal block)
with a one-line comment on each significant directory and top-level file,
and a statement of which part is the importable public package versus
supporting code.
- **Environment setup** — how to get a working development checkout:
- Clone, virtual-environment creation, and an editable install with the dev
extras (`pip install -e ".[dev]"`).
- Every environment variable needed to run, test, or build, with defaults.
- How to run the package's entry points locally, including a smoke test.
- How to run the test suite: the default invocation, how to include slower
or integration tiers, parallel/CI-matching flags, running a single
file/test, and coverage. Note the test layout and any required markers.
- How to run linters, type checks, formatters, and the docs build, plus any
one-command wrapper that runs them all.
- The CI/CD pipeline (what runs on which trigger) and the release process.
- The contribution workflow, or a pointer to the contribution guide.
- **Architecture / class hierarchy** — see Section 3.
- **Per-subsystem chapters** — see Section 4.
- **Extending the system** — see Section 5.
- **Coding conventions** — the project's style and quality rules, or a pointer
to where they live.
- **API reference** — see Section 6.

## 3. Architecture and Class Diagrams

- Include at least one **class diagram** (a Mermaid `classDiagram` or
equivalent) showing the principal classes, their key public members, and the
relationships between them (inheritance, composition, "produces"/"consumes").
- Mark abstract classes and dataclasses; show the methods that define each
abstract contract.
- Follow every diagram with narrative prose that walks each group of classes in
turn — a diagram alone is not documentation.
- Cross-reference every class named in the narrative per `doc_python` Section 5.
Do NOT cross-reference inside the diagram block itself.
- Keep the diagram in sync with the code: a renamed or removed class invalidates
the diagram and must be fixed in the same change.

## 4. Per-Subsystem / Per-Module Prose

Each subsystem chapter MUST give a reader enough to navigate and modify that
code without reverse-engineering it. Include:

- **Overview** — the subsystem's responsibility and how it fits the overall
flow, with a cross-reference to the module(s) it documents.
- **Per-class / per-file description** — prose for each significant class or
module: its role, the abstract contract it defines or implements (list the
methods subclasses must provide and what each returns), notable attributes,
and how instances are created and used. Describe behavior and contracts, not a
line-by-line restatement of the source.
- **Concrete subclasses / implementations** — enumerate the shipping
implementations of each abstract base and what distinguishes each.
- **Important invariants** — thread-safety and concurrency constraints, caching
and shared mutable state, ordering requirements, and units/conventions for
any quantity that is easy to get wrong. State these explicitly where they
apply.
- **API-reference pointer** — end the chapter with a link to the autodoc page(s)
for the subsystem.

## 5. Extending the System

- Provide a step-by-step recipe for each documented extension point (adding a
plugin, backend, subclass, data source, etc.): which base class to inherit,
which methods to implement and their contracts, where to put the file, and how
to register it so the package discovers it.
- Include a minimal, correct code skeleton for each recipe in a
`.. code-block:: python` directive.
- Cross-reference the relevant subsystem chapter and the base classes involved
rather than duplicating their contracts.

## 6. API Reference

- Generate the API reference from docstrings with `autodoc`; do not hand-write
API descriptions that will drift from the code.
- Provide an API-reference landing page with a `toctree`, plus one page per
top-level package/subpackage. On each page use `automodule` directives with
`:members:`, `:undoc-members:`, and `:show-inheritance:` so the full public
surface (including as-yet-undocumented members) is visible.
- Cover the entire importable public API: when a new public module is added,
add a corresponding API-reference entry in the same change, or it will be
silently absent from the rendered surface.
- The quality of these pages is bounded by docstring quality (`doc_python`
Section 4); thin docstrings produce a thin API reference.

## 7. Build Discipline

The developer guide is the heaviest user of cross-references, autodoc, and
diagrams, so it is the most prone to silent breakage. It MUST build clean under
both `sphinx-build -W` (warnings as errors) and `sphinx-build -n` (nitpicky)
per `doc_python` Section 6 before delivering — every cross-reference resolving,
every `automodule` importing (mock heavy optional imports in `conf.py` rather
than dropping modules from the reference), and every diagram rendering.
95 changes: 95 additions & 0 deletions .claude/rules/doc_how_to.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
description: Format and completeness rules for task-focused how-to articles that walk a user through a single workflow with prerequisites, steps, and troubleshooting.
paths:
- "docs/**/*.rst"
- "docs/**/*.md"
---

# How-To Articles

A how-to article walks a reader through ONE concrete task from start to finish.
It complements the reference material in `doc_user_guide`: the user guide
documents every option exhaustively, while a how-to picks one goal and shows the
shortest correct path to it. Build on `doc_python` (prose conventions, build
discipline). Where a how-to and the user guide describe the same workflow, keep
them consistent and link between them rather than duplicating detail.

## 1. Audience and Tone

- Write for someone fluent in `pip` and the command line but unfamiliar with the
package internals.
- Use clear, direct, action-oriented language; define domain-specific terms on
first use.
- Focus on what the reader must do and what they should observe.

## 2. Required Elements

1. **Action-oriented title** — name the task as an action (e.g. "How To Export a
Report", not "Report Export Overview").
2. **Brief introduction** — 1-3 sentences on the purpose and value of the task.
3. **Prerequisites** — supported Python version, install command, and any
required data, environment variables, or prior configuration.
4. **Numbered steps** — one action per step in logical order, each with the
exact API snippet or command-line invocation and a note of what the reader
should see after it.
5. **Expected results** — a summary of the successful end state (output, files
created, side effects). Keep this consistent with the per-step observations.
6. **Troubleshooting** — the common failure modes (import errors, missing data,
version or environment mismatches) and their fixes.
7. **Related material** — next steps and links to the relevant user-guide
chapters or other how-to articles.

## 3. Structure

```markdown
# How To [Action]

[1-3 sentence introduction explaining purpose and value.]

## Prerequisites

- Python >= <version>
- `pip install <dist-name>`
- [Any required data, environment variables, or configuration]

## Steps

1. Import the module:
```python
from package import SomeClass
```
2. [Action]. You should see [result].
3. [Action].

## Expected Results

[Summary of the successful end state — output, files created, etc.]

## Troubleshooting

- **[Problem]**: [Solution].

## Additional Information

[Tips, performance notes, or links to related guides.]
```

## 4. Converting Technical Content

When turning docstrings, test scripts, or internal notes into a how-to:

1. Identify the user-facing feature or workflow.
2. Determine the target audience (API user, command-line user, contributor).
3. Extract the user actions from the technical steps.
4. Translate internal terminology into user-facing language.
5. Add runnable examples, expected output, and troubleshooting.

## 5. Diagrams and Figures

- **When to use**: multi-step workflows, data pipelines, or architecture that is
clearer as a visual.
- **Placement**: inline, immediately after the relevant step or section.
- **Format**: prefer text-based diagrams (e.g. Mermaid, rendered by Sphinx) for
process flows; use PNG/SVG for screenshots or data visualizations.
- **Naming**: descriptive filenames (e.g. `export-pipeline.svg`), with alt text
for accessibility.
Loading