Skip to content

Commit

Permalink
Hash is now stable across python runtimes
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-kidger committed Aug 17, 2023
1 parent 13e6870 commit e347c48
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion jaxtyping/_import_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@

import ast
import functools as ft
import hashlib
import sys
from collections.abc import Sequence
from importlib.abc import MetaPathFinder
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit e347c48

Please sign in to comment.