• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

beartype / plum / 30304175023 / 7
99%
master: 99%

Build:
DEFAULT BRANCH: master
Ran 27 Jul 2026 08:49PM UTC
Files 16
Run time 0s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

27 Jul 2026 08:48PM UTC coverage: 99.458% (+0.004%) from 99.454%
30304175023.7

push

github

web-flow
build(mypyc): compile `_type` via a guarded `mypyc_attr` shim (#287)

* build(mypyc): compile `_signature` for faster parametric dispatch

Adds `src/plum/_signature.py` to the `mypyc` compilation allowlist. This
compiles the `Signature` type and its comparison machinery to native code,
giving a ~18% speedup on parametric dispatch (`tests/benchmark.py`: 3.82 ->
3.12 us median) with no change to the simple-call paths, which live in the
still-interpreted `_function`.

Compiling `_signature` makes `Signature` a native extension type. As a result
the already-compiled `_dispatcher.multi` now type-checks its
`Signature | tuple[...]` vararg at the C boundary, so a bad argument (e.g.
`dispatch.multi(1)`) raises `TypeError` instead of reaching the method body.
To keep behaviour identical across the pure-Python and compiled builds, the
method's own validation now raises `TypeError` (was `ValueError`) for a
non-tuple/non-Signature argument, and its test is updated to match. The
informative `Signature | tuple[...]` annotation is kept.

* build(mypyc): compile `_type` via a guarded `mypyc_attr` shim

Adds `src/plum/_type.py` to the `mypyc` compilation allowlist. Its three
`type`-subclassing classes (`ResolvableType`, `PromisedType`, `ModuleType`)
cannot be native extension classes, so each is marked
`@mypyc_attr(native_class=False)`.

`mypyc_attr` lives in `mypy_extensions`, which is present when building the
compiled wheel but is not a runtime dependency. It is therefore imported once,
behind a `try/except`, from a new single-purpose `plum._mypyc` module that
falls back to a no-op decorator in a pure-Python install. `mypyc` still
recognises the decorator through this shared re-export, so classes across the
package can opt out of native compilation from one place.

`PromisedType.__new__` used `super().__new__(...)`, which `mypyc` cannot
generate for a non-extension class (`object.__new__()` unsupported). It now
calls `ResolvableType.__new__(...)` explicitly, matchi... (continued)

918 of 923 relevant lines covered (99.46%)

0.99 hits per line

Source Files on job run-3.14-pre-beartype - 30304175023.7
  • Tree
  • List 16
  • Changed 2
  • Source Changed 2
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 30304175023
  • 6840ebbd on github
  • Prev Job for on master (#30299177442.7)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc