6. Extending Numba — Anaconda Enterprise 4.4 documentation

Anaconda Enterprise: Documentation

# 6. 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.

- 6.1. High-level extension API
  - 6.1.1. Implementing functions
  - 6.1.2. Implementing methods
  - 6.1.3. Implementing attributes
- 6.2. Low-level extension API
  - 6.2.1. Typing
  - 6.2.2. Lowering
    - 6.2.2.1. Native operations
    - 6.2.2.2. Constants
    - 6.2.2.3. Boxing and unboxing
- 6.3. Example: an interval type
  - 6.3.1. Extending the typing layer
    - 6.3.1.1. Creating a new Numba type
    - 6.3.1.2. Type inference for Python values
    - 6.3.1.3. Type inference for operations
  - 6.3.2. Extending the lowering layer
    - 6.3.2.1. Defining the data model for native intervals
    - 6.3.2.2. Exposing data model attributes
    - 6.3.2.3. Exposing a property
    - 6.3.2.4. Implementing the constructor
    - 6.3.2.5. Boxing and unboxing
  - 6.3.3. Using it
  - 6.3.4. Conclusion