Skip to main content

A toolbox for Numba projects, currently providing mutable scalar helpers.

Project description

Numba Toolbox

Numba Toolbox is a small, growing collection of reusable helpers for Numba-based projects. The toolbox will expand as new shared needs emerge.

Installation

pip install numba-toolbox

Mutable scalars

The current feature set provides mutable scalar values for use in Numba-compiled code. They are useful when a value is stored inside an immutable container, such as a named tuple, but still needs to be updated without replacing the container or rebinding the value.

from typing import NamedTuple

from numba import jit
from numba_toolbox import MutableInt32, mutable_int32

class State(NamedTuple):
    counter: MutableInt32

state = State(counter=mutable_int32(0))

@jit
def increment(state):
    state.counter.value += 1

increment(state)
assert state.counter.value == 1

Factories are currently available for mutable booleans and signed or unsigned integers with 8-, 16-, 32-, and 64-bit storage.

Future direction

Additional utilities will be added when they solve recurring needs across our Numba-based projects.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

numba_toolbox-0.1.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

numba_toolbox-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file numba_toolbox-0.1.0.tar.gz.

File metadata

  • Download URL: numba_toolbox-0.1.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for numba_toolbox-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5f68e0080890a30efa4beff97920b22b2a7f12b97060799d4efc05ef401474e3
MD5 f92c4d2496f276b58f7c1ff41de03661
BLAKE2b-256 66ffb593b3c62f7f60e6e3760b194a6a05f9691069460bd1199929e861e40591

See more details on using hashes here.

Provenance

The following attestation bundles were made for numba_toolbox-0.1.0.tar.gz:

Publisher: release.yml on cognitive-modeling/numba-toolbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numba_toolbox-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: numba_toolbox-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for numba_toolbox-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2093c219bd270e95a6ee704e62948abe8ba98931eb4a019b9929207958fb8ddf
MD5 e6eb8456d66d1412c124bbb6e9cb19df
BLAKE2b-256 8c1708f6ff38c7e46a8d4c172d5a521fff9e43e2d7653ef893a1282e7a7ac539

See more details on using hashes here.

Provenance

The following attestation bundles were made for numba_toolbox-0.1.0-py3-none-any.whl:

Publisher: release.yml on cognitive-modeling/numba-toolbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page