Numba Patterns

Enforce JIT-safe numeric-only Numba functions in src/argus/analysis.

1|Updated Apr 4, 2026
One-click install
npx skills add https://github.com/lagarcess/argus --skill numba-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Numba Patterns
Source: https://github.com/lagarcess/argus/tree/main/.agent/skills/numba-patterns
Command: npx skills add https://github.com/lagarcess/argus --skill numba-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill codifies rules and best practices to ensure Numba JIT-compiled functions in src/argus/analysis are pure numeric, deterministic, and meet strict performance budgets so developers avoid hidden compilation costs and non-JIT-safe patterns that break benchmarks.

Core Features & Use Cases

  • JIT purity enforcement: Defines which operations are allowed inside @njit/@jit(nopython=True) functions and which Python objects, I/O, or libraries are forbidden.
  • Test warmup guidance: Requires calling warmup_jit() in test setup to separate compilation time from runtime benchmarks.
  • Performance targets & patterns: Specifies targets (e.g., ZigZag 1M <50ms post-warmup) and a wrapper pattern where lightweight Python wrappers convert raw JIT arrays into higher-level objects.
  • Use Case: Validate that pivot-finding and harmonic pattern scans meet microsecond/millisecond budgets in CI benchmarks without including compilation overhead.

Quick Start

Run the Numba Patterns guidance to check that all @njit functions in src/argus/analysis are pure-math, that tests call warmup_jit() before timing, and that wrapper functions convert raw arrays into Python objects.

Frequently Asked Questions about Numba Patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I ensure my Numba JIT functions are pure numeric and safe for compilation?

Numba JIT functions require strict numeric-only operations, prohibiting Python objects and I/O inside @njit or @jit(nopython=True) decorated routines to guarantee deterministic, high-performance compilation without runtime type errors.

Why does my Numba benchmark include compilation time in the test results?

Numba benchmark tests must call warmup_jit() in the test setup to separate JIT compilation overhead from actual runtime metrics, ensuring you measure true execution speed for large datasets.

What is the best way to convert raw Numba JIT arrays into Python objects?

Use a wrapper pattern where lightweight Python wrapper functions convert raw JIT arrays output from @njit functions into higher-level objects, keeping the JIT routines pure numeric while enabling object-oriented analysis.

How do I achieve sub-50ms post-warmup performance for Numba numeric routines?

Achieve sub-50ms post-warmup Numba performance by enforcing JIT-safe numeric patterns, avoiding forbidden Python libraries inside @njit functions, and validating pivot detection benchmarks after calling warmup_jit() to exclude compilation overhead.

What operations are forbidden inside Numba @njit functions to maintain JIT safety?

Forbidden operations inside Numba @njit functions include using Python objects, performing I/O operations, and importing unsupported libraries, which breaks JIT compilation and prevents deterministic high-performance numeric computation.

Can I use Python objects inside Numba JIT functions for pivot detection?

Python objects are prohibited inside Numba JIT functions to maintain JIT safety; pivot detection routines must use pure numeric math within @njit decorators to ensure deterministic execution and meet strict performance budgets.