# Extending Numba

This chapter describes how to extend Numba to make it recognize and support additional operations, functions or types. Numba provides two categories of APIs to this end:

- The high-level APIs provide abstracted entry points which are sufficient for simple uses. They require little knowledge of Numba’s internal compilation chain.

- The low-level APIs reflect Numba’s internal compilation chain and allow flexible interaction with its various layers, but require more effort and experience with Numba internals.

It may be helpful for readers of this chapter to also read some of the documents in the developer manual, especially the architecture document.

- High-level extension API
  - Implementing functions
  - Implementing methods
    - `overload_method()`
  - Implementing classmethods
    - `overload_classmethod()`
  - Implementing attributes
  - Importing Cython Functions
  - Implementing intrinsics
  - Implementing mutable structures
    - Defining a StructRef
    - Defining a method on StructRef
    - `numba.experimental.structref` API Reference
      - `StructRefProxy`
      - `define_attributes()`
      - `define_boxing()`
      - `define_constructor()`
      - `define_proxy()`
      - `register()`
      - `structref_is()`
  - Determining if a function is already wrapped by a `jit` family decorator
    - `extending.is_jitted()`
- Low-level extension API
  - Typing
    - `typeof_impl.register()`
    - `type_callable()`
    - `as_numba_type.register()`
  - Lowering
    - Native operations
      - `lower_builtin()`
      - `lower_getattr()`
      - `lower_getattr_generic()`
      - `lower_cast()`
    - Constants
      - `lower_constant()`
    - Boxing and unboxing
      - `box()`
      - `unbox()`
- Example: An Interval Type
  - Extending the typing layer
    - Creating a new Numba type
    - Type inference for Python values
    - Type inference for Python types
    - Type inference for operations
  - Extending the lowering layer
    - Defining the data model for native intervals
    - Exposing data model attributes
    - Exposing a property
    - Implementing the constructor
    - Boxing and unboxing
  - Using it
  - Conclusion
- A guide to using `@overload`
  - Concrete Example
  - Implementing `@overload` for NumPy functions
- Registering Extensions with Entry Points
  - Adding Support for the “Init” Entry Point
  - Testing your Entry Point