Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ jobs:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v8
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: uv sync --group docs --no-dev
- run: uv run mkdocs build --clean
- run: uv run zensical build --clean
- uses: actions/upload-pages-artifact@v4
with:
path: site
Expand Down
11 changes: 5 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Bearshape Agents
# bearshape agents

Bearshape is the new project name for the library currently still named
`bearshape` in parts of the tree. The package is moving from `bearshape` /
`bearshape` to `bearshape`, with the goal of a production-ready release under the
beartype organization.
bearshape is a runtime shape and dtype checking library moving toward a
production-ready release under the beartype organization. The package, docs,
examples, and site use the lowercase public identity `bearshape` everywhere.

This file is for Codex and Claude agents. Keep it short, directive, and free of
AI slop. Humans should learn the project from `README.md` and `docs/`; agents
Expand Down Expand Up @@ -80,7 +79,7 @@ user clearly asks for a narrow edit and the risk is low.

## Product Contract

Bearshape provides runtime shape and dtype checking powered by beartype.
bearshape provides runtime shape and dtype checking powered by beartype.
Annotations such as named dimensions, anonymous dimensions, fixed integer
dimensions, arithmetic dimensions, broadcastable dimensions, `Scalar`,
`Value(...)`, backend array aliases, `Like[...]`, scalar-like aliases, and
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ and this project follows
### Changed

- Renamed the distribution, import package, documentation, examples, tests, and
release metadata to Bearshape.
release metadata to bearshape.
- Normalized product-facing branding to lowercase `bearshape`.
- Switched the documentation build from direct MkDocs usage to Zensical while
preserving the existing Material-style site proportions and theme.
- Hardened nearest-wrapper memo and scope resolution for plain `@beartype` usage
in decorated call stacks.
- Hardened standalone `is_bearable()` memo identity against recycled checker
frame objects.
- Array and tree runtime hints now report readable validation failures through
custom beartype diagnostics instead of boolean-only validator output.
- Backend `Like[...]` diagnostics now identify JAX, PyTorch, and CuPy hints with
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Bearshape
# bearshape

[![Python 3.10-3.14](docs/assets/images/python_versions_badge.svg)](https://www.python.org/)
![Coverage 91%](https://img.shields.io/badge/coverage-91%25-34D058?style=flat-square&logo=codecov&logoColor=F01F7A&labelColor=1F2937)
[![Docs](https://img.shields.io/badge/docs-live-526CFE?style=flat-square&logo=materialformkdocs&logoColor=white&labelColor=1F2937)](https://acecchini.github.io/bearshape/)
[![Docs](https://img.shields.io/badge/docs-live-526CFE?style=flat-square&logo=readthedocs&logoColor=white&labelColor=1F2937)](https://acecchini.github.io/bearshape/)

Runtime shape and dtype checking for NumPy, JAX, PyTorch, CuPy, and
tree-structured containers, powered by
Expand All @@ -19,7 +19,7 @@ def normalize(x: F32[N, C]) -> F32[N, C]:
return x / x.sum(axis=1, keepdims=True)
```

Bearshape turns annotations such as `F32[N, C]`, `F32Like[~B, C]`,
bearshape turns annotations such as `F32[N, C]`, `F32Like[~B, C]`,
`F32[Value("size")]`, and `Tree[F32[N], T]` into runtime-validated contracts.
Named dimensions are shared within a function call, so mismatched shapes fail at
the boundary instead of later in array code.
Expand All @@ -30,7 +30,7 @@ the boundary instead of later in array code.
pip install bearshape
```

Bearshape keeps the root import lightweight. Install the array backend packages
bearshape keeps the root import lightweight. Install the array backend packages
you use explicitly:

```bash
Expand Down
4 changes: 2 additions & 2 deletions docs/assets/js/tesseract.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Bearshape Visual v4 — 3D morphing bubbles (ray-marched metaballs),
* bearshape Visual v4 — 3D morphing bubbles (ray-marched metaballs),
* icosahedron logo, and 3D extruded title.
* Two-pass WebGL2: scene FBO -> composite with subtle bloom.
* Zero dependencies.
Expand Down Expand Up @@ -570,7 +570,7 @@
function initTitle() {
var el = document.getElementById('bearshape-title')
if (!el) return
var text = 'Bearshape'
var text = 'bearshape'
var html = ''
for (var i = 0; i < text.length; i++)
html += '<span class="hero__letter" style="animation-delay:' + i * 0.15 + 's">' + text[i] + '</span>'
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Copyable examples covering the main bearshape runtime and typing pa

# Examples

## Bearshape Tour Notebook
## bearshape Tour Notebook

The tour notebook is still the broadest runnable walkthrough in the repository:

Expand Down
2 changes: 1 addition & 1 deletion docs/features/decorator.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ memo by reference. For full task isolation, each task should enter its own

## `from __future__ import annotations`

Bearshape works with `from __future__ import annotations`, but every symbol used
bearshape works with `from __future__ import annotations`, but every symbol used
inside the annotation must still be imported in module scope:

```python
Expand Down
4 changes: 2 additions & 2 deletions docs/features/index.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
description: Explore Bearshape's runtime contracts, typing model, and backend-specific tools.
description: Explore bearshape's runtime contracts, typing model, and backend-specific tools.
---

# Features

Bearshape layers several pieces together:
bearshape layers several pieces together:

- a shape language built from Python objects such as `N`, `Scalar`, and
`Value("size")`
Expand Down
2 changes: 1 addition & 1 deletion docs/features/like-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Input-validation types for array-like data and range-validated scal

# Like Types

Bearshape has two broad input-contract families:
bearshape has two broad input-contract families:

- `Like` types such as `F32Like[N, C]`
- `ScalarLike` types such as `U8ScalarLike`
Expand Down
2 changes: 1 addition & 1 deletion docs/features/static-typing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: How bearshape annotations map onto pyright, mypy, and ty.

# Static Typing

Bearshape supports **pyright**, **mypy**, and **ty**. The repository runs all
bearshape supports **pyright**, **mypy**, and **ty**. The repository runs all
three against the typing fixtures in `tests/typing/` via
`tests/test_typecheck.py`.

Expand Down
4 changes: 2 additions & 2 deletions docs/getting-started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Install bearshape, pick a backend, and learn the runtime and typing

# Getting Started

Bearshape turns annotations like `F32[N, C]` into runtime-validated contracts by
bearshape turns annotations like `F32[N, C]` into runtime-validated contracts by
generating small runtime hint classes for arrays and trees. Beartype validates
those hints through `__instancecheck__()`, and bearshape provides readable
failures through `__instancecheck_str__()`.
Expand All @@ -26,7 +26,7 @@ install those dependencies.
What passes on pyright, mypy, and ty, and what still needs targeted
runtime-only workarounds.

## What Bearshape gives you
## What bearshape gives you

- Standard `@beartype` support. No custom decorator is required for normal shape
checking.
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The distribution name and import package are both `bearshape`:
import bearshape
```

Bearshape intentionally does **not** use extras such as `bearshape[numpy]`.
bearshape intentionally does **not** use extras such as `bearshape[numpy]`.
Install `bearshape` and your backend packages explicitly.

=== "NumPy"
Expand Down
136 changes: 134 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Bearshape
title: bearshape
description: Elegant runtime shape and dtype checking for NumPy, JAX, PyTorch, and CuPy arrays — powered by beartype.
hide:
- navigation
Expand Down Expand Up @@ -366,6 +366,138 @@ a.backend-logo:hover {
.hero__logo canvas { width: 140px; height: 140px; }
.backends__logos { gap: 1.5rem; }
}

@media (min-width: 1350px) and (max-width: 2200px) and (max-height: 1060px) {
.md-main__inner { margin-top: clamp(-3.9rem, -4.3vh, -2.2rem); }

.hero__logo canvas {
width: clamp(115px, 12.8vh, 190px);
height: clamp(115px, 12.8vh, 190px);
margin-bottom: clamp(-42px, -4.8vh, -20px);
}

.hero__letter { font-size: clamp(2.25rem, 3.2vh, 3.25rem); }
.hero__subtitle { font-size: 0.96rem; line-height: 1.25; }
.hero__powered .beartype-link { font-size: clamp(1.3rem, 1.85vh, 1.85rem); }

.beartype-logo-inline {
height: clamp(26px, 3.2vh, 40px) !important;
max-height: 40px !important;
}

.hero__actions {
gap: 0.75rem;
margin-bottom: 0.2rem;
}

.features-section {
padding: 0 1.5rem 0.15rem;
}

.features-grid {
gap: 0.32rem;
}

.feature-card {
padding: 0.32rem 0.78rem;
}

.feature-card h3 {
font-size: 0.9rem;
line-height: 1.3;
}

.feature-card p {
font-size: 0.77rem;
line-height: 1.55;
}

.backends {
padding: 0.28rem 1.5rem 0.8rem;
}

.backends__logos {
gap: 2.5rem;
margin-top: 0.45rem;
}

.backend-logo svg {
width: 30px;
height: 30px;
}

.backend-logo .jax-logo-img {
height: 29px;
}

.backend-logo .cupy-logo-img {
width: 31px;
height: 31px;
}

.backend-logo--optree svg {
width: 34px;
height: 34px;
}

.backend-logo span {
font-size: 1.07rem;
}
}

@media (min-width: 1350px) and (max-width: 2200px) and (max-height: 930px) {
.md-main__inner { margin-top: -3.6rem; }

.hero__actions {
gap: 0.65rem;
margin-bottom: 0.08rem;
}

.features-grid {
gap: 0.24rem;
}

.feature-card {
padding: 0.26rem 0.75rem;
}

.feature-card p {
font-size: 0.74rem;
line-height: 1.45;
}

.backends {
padding: 0.22rem 1.5rem 0.6rem;
}

.backends__logos {
gap: 2.25rem;
margin-top: 0.35rem;
}

.backend-logo svg {
width: 28px;
height: 28px;
}

.backend-logo .jax-logo-img {
height: 27px;
}

.backend-logo .cupy-logo-img {
width: 29px;
height: 29px;
}

.backend-logo--optree svg {
width: 31px;
height: 31px;
}

.backend-logo span {
font-size: 1rem;
}
}
</style>

<div id="bearshape-visual"></div>
Expand All @@ -375,7 +507,7 @@ a.backend-logo:hover {

<div class="hero__logo">
<canvas id="bearshape-logo" width="220" height="220"></canvas>
<div class="hero__title" id="bearshape-title">Bearshape</div>
<div class="hero__title" id="bearshape-title">bearshape</div>
</div>

<div class="hero__tagline">Runtime shape checking for array code</div>
Expand Down
18 changes: 18 additions & 0 deletions docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,21 @@ html {
color: white;
text-decoration: underline;
}

/* Keep Zensical's search trigger visually aligned with the previous site. */
.md-search__button kbd,
.md-search__button .md-keys,
.md-search__button [class*="key"],
.md-search__button::after {
display: none !important;
}

@media screen and (min-width: 60em) {
.md-search {
width: 11.7rem;
}

.md-search__button {
width: 100%;
}
}
6 changes: 3 additions & 3 deletions examples/bearshape_tour.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"id": "gfo1bsx8q1",
"metadata": {},
"source": [
"# Bearshape Tour\n",
"# bearshape Tour\n",
"\n",
"**Elegant runtime shape and dtype checking for NumPy, JAX, and PyTorch arrays.**\n",
"\n",
"Bearshape turns array shape annotations into Python objects that [beartype](https://github.com/beartype/beartype) validates at runtime. Dimensions like `N` and `C` are enforced for consistency across all parameters — automatically.\n",
"bearshape turns array shape annotations into Python objects that [beartype](https://github.com/beartype/beartype) validates at runtime. Dimensions like `N` and `C` are enforced for consistency across all parameters — automatically.\n",
"\n",
"This notebook walks through every major feature."
]
Expand Down Expand Up @@ -781,7 +781,7 @@
"source": [
"## 13. Multiple dtype arrays\n",
"\n",
"Bearshape supports all common dtypes and category groups. You can mix different dtypes in one function signature:"
"bearshape supports all common dtypes and category groups. You can mix different dtypes in one function signature:"
]
},
{
Expand Down
Loading
Loading