Skip to content

Add the Array API development skill - #989

Open
Alexboiboi wants to merge 1 commit into
feat/skills-foundationfrom
feat/skill-array-api
Open

Alexboiboi wants to merge 1 commit into
feat/skills-foundationfrom
feat/skill-array-api

Conversation

@Alexboiboi

@Alexboiboi Alexboiboi commented Aug 29, 2026 •

Copy link
Copy Markdown
Member

Split out of #984. Just the Array API skill now — magpylib-development and primary-source-research moved down to #993, where everything else can reference them too.

A 192-line SKILL.md and two references: current official guidance (108 lines) and an inventory of prior Magpylib Array API work (89 lines). Both carry their own recheck procedure, because version claims and PR status go stale fast.

The skill covers three things.

The five decisions to settle before parallel kernel ports start: standard version, dependency delivery, rollout gate, mixed-input semantics, CI-backed capability matrix. All five are posed as questions with a recommended default. Merging this shouldn't ratify a maintainer decision by merge instead of by discussion — the answers belong in the implementing issue.

The port procedure: resolve the namespace once at one boundary, explicit dtype and device, standard promotion, what breaks under JIT and lazy backends, and where compiled NumPy/SciPy calls have to be fenced off.

Evidence per capability. Backend execution, GPU, JAX JIT, lazy, autodiff, precision and NumPy performance are separate claims, and none of them implies another.

The repo-specific parts come from #981: xpx.at for the 389 indexed assignments in _src/fields/, special_el3.py being the hard file rather than field_BH_cylinder_segment.py, the xp/any_ seam already sitting in special_cel.py, and the 6–16× lazy penalty on the elliptic kernels.

Why this one first: it's the prerequisite for reorganising #792. Its own rule — don't start parallel kernel ports while the contract is unresolved — is what the twelve open Array API PRs should be triaged against, so it needs a merged home to point at.

Before merge

@Alexboiboi Alexboiboi added AI AI assistant tooling and integrations array-api Array API standard support (non-NumPy backends) labels Aug 29, 2026
@Alexboiboi
Alexboiboi force-pushed the feat/skill-array-api branch from c3cec05 to abf976d Compare August 29, 2026 22:42
@Alexboiboi Alexboiboi self-assigned this Aug 30, 2026
@Alexboiboi
Alexboiboi force-pushed the feat/skill-array-api branch from 93f8907 to 1b50aa1 Compare August 31, 2026 20:08
@Alexboiboi
Alexboiboi changed the base branch from main to feat/skills-foundation August 31, 2026 20:10
A repository skill for implementing and reviewing Magpylib's Array API work:
namespace dispatch at a stable boundary, kernel ports, per-capability claims
with the tests that back them, and two bundled references -- the current
official guidance, and an inventory of prior Magpylib Array API work.

All five contract decisions -- target version, compatibility delivery, rollout
gate, mixed inputs, capability matrix -- are posed as open questions with a
recommended default, so merging the skill does not ratify a maintainer
decision by merge rather than by discussion.

Version facts come from changelogs and the installed `__array_api_version__`,
not from project landing pages: `array-api-compat` has targeted 2025.12 since
1.14.0 (2026-02-26) while its landing page still says 2024.12. An older target
is pinned through `set_array_api_strict_flags` when chosen deliberately.

Tests use `array_api_extra.testing` rather than `numpy.testing`, which forces
every comparison onto NumPy and defeats the point of a converted kernel
(raised by @lucascolley on #792). Those assertions check namespace, dtype,
shape and device, so a NumPy reference must be converted into the namespace
under test first; lazy functions are tagged with `lazy_xp_function` plus
`patch_lazy_xp_functions`.

The repository-specific guidance comes from #981: `xpx.at` for the 389 indexed
assignments in `_src/fields/`, `special_el3.py` rather than
`field_BH_cylinder_segment.py` as the hard file, the existing `xp`/`any_` seam
in `special_cel.py`, the lazy cost of the data-dependent `cel` loop, and
today's silent coercion of foreign arrays to host. The CI rule is reconciled
with CPU-only runners.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Alexboiboi
Alexboiboi force-pushed the feat/skill-array-api branch from 1b50aa1 to 9c89b03 Compare August 31, 2026 20:22

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI AI assistant tooling and integrations array-api Array API standard support (non-NumPy backends)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant