# Global constant dictionaries

**URL:** <https://numba.discourse.group/t/global-constant-dictionaries/3071>\
**Category:** Support: How do I do ...?\
**Created:** [October 14, 2025, 3:11pm UTC](https://numba.discourse.group/t/global-constant-dictionaries/3071 "2025-10-14T15:11:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![adrian-valente](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/adrian-valente/32/1251_2.png) [@adrian-valente](https://numba.discourse.group/u/adrian-valente)\
**Post date:** [October 14, 2025, 3:11pm UTC](https://numba.discourse.group/t/global-constant-dictionaries/3071/1 "2025-10-14T15:11:59Z")

</div>

Hello,

What is the best way to use global constant dictionaries in numba? I know that using a numba typed Dict doesn’t work, because it cannot be made constant, and thus its values cannot be known at the time of computing function closure during compilation.

Similarly, I have seen the existence of LiteralStrKeyDict but it is not obvious if they can be explicitly defined.

It is trivial of course to wrap all constants in a structure and pass it as argument to numba code, but certain projects make heavy use of dictionaries (for example certain properties given a cell type, or simply to store the genetic code) and it is more readable to have those as simply constants.

Many thanks!

---

<div class="post-metadata">

**Author:** ![milton](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@milton](https://numba.discourse.group/u/milton)\
**Post date:** [October 14, 2025, 5:25pm UTC](https://numba.discourse.group/t/global-constant-dictionaries/3071/2 "2025-10-14T17:25:46Z")

</div>

You can try following the example [here](https://goykhman.github.io/numbox/numbox.core.work.html#graph-manager) that uses a global dictionary variable `_work_registry`. It follows, in turn, the approach developed by Daniel Weitekamp [here](https://github.com/DannyWeitekamp/Cognitive-Rule-Engine/blob/d08dff727f7e9a1308c2e233f09ba82fa9d780f4/cre/utils.py#L1403).
