diff --git a/jaxtyping/_import_hook.py b/jaxtyping/_import_hook.py index 21cca35..0aec718 100644 --- a/jaxtyping/_import_hook.py +++ b/jaxtyping/_import_hook.py @@ -51,6 +51,7 @@ import ast import functools as ft +import hashlib import sys from collections.abc import Sequence from importlib.abc import MetaPathFinder @@ -165,7 +166,9 @@ class _JaxtypingLoader(SourceFileLoader): def __init__(self, *args, typechecker, **kwargs): super().__init__(*args, **kwargs) self._typechecker = typechecker - self._typechecker_hash = str(abs(hash(self._typechecker))) + self._typechecker_hash = hashlib.md5( + self._typechecker.encode("utf-8") + ).hexdigest() def source_to_code(self, data, path, *, _optimize=-1): source = decode_source(data) diff --git a/pyproject.toml b/pyproject.toml index 168d3ae..66a316b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "jaxtyping" -version = "0.2.20" +version = "0.2.21" description = "Type annotations and runtime checking for shape and dtype of JAX arrays, and PyTrees." readme = "README.md" requires-python ="~=3.9"