Coverage for sdks / stigmem-py / src / stigmem / __init__.py: 82%

11 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-05-25 01:49 +0000

1"""stigmem-py — Python client SDK for Stigmem. 

2 

3Compatible with the canonical Stigmem spec at v0.9.0a1 and onward. 

4See https://github.com/eidetic-labs/stigmem for the protocol spec, 

5threat model, and adopter documentation. 

6""" 

7 

8from importlib.metadata import PackageNotFoundError as _PackageNotFoundError 

9from importlib.metadata import version as _pkg_version 

10 

11from .client import AsyncStigmemClient, StigmemClient 

12from .exceptions import ( 

13 StigmemAuthError, 

14 StigmemConflictError, 

15 StigmemError, 

16 StigmemHTTPError, 

17 StigmemNotFoundError, 

18) 

19from .models import ( 

20 AssertRequest, 

21 BooleanValue, 

22 Conflict, 

23 ConflictPage, 

24 ConflictResolution, 

25 DatetimeValue, 

26 Fact, 

27 FactChainCheckpointProof, 

28 FactChainProof, 

29 FactPage, 

30 FactScope, 

31 FactValue, 

32 MemoryCard, 

33 NodeInfo, 

34 NullValue, 

35 NumberValue, 

36 Peer, 

37 PeerPage, 

38 RecallRequest, 

39 RecallResponse, 

40 RecallWeights, 

41 RefValue, 

42 ResolveRequest, 

43 ScoreBreakdown, 

44 ScoredFact, 

45 StringValue, 

46 TextValue, 

47 boolean_value, 

48 datetime_value, 

49 null_value, 

50 number_value, 

51 ref_value, 

52 string_value, 

53 text_value, 

54) 

55from .verification import ( 

56 StigmemVerificationError, 

57 compute_fact_cid, 

58 verify_fact_chain_proof, 

59 verify_fact_cid, 

60) 

61 

62__all__ = [ 

63 # clients 

64 "StigmemClient", 

65 "AsyncStigmemClient", 

66 # exceptions 

67 "StigmemError", 

68 "StigmemHTTPError", 

69 "StigmemAuthError", 

70 "StigmemNotFoundError", 

71 "StigmemConflictError", 

72 # models 

73 "Fact", 

74 "FactChainCheckpointProof", 

75 "FactChainProof", 

76 "FactPage", 

77 "FactValue", 

78 "FactScope", 

79 "StringValue", 

80 "TextValue", 

81 "NumberValue", 

82 "BooleanValue", 

83 "DatetimeValue", 

84 "RefValue", 

85 "NullValue", 

86 "NodeInfo", 

87 "Peer", 

88 "PeerPage", 

89 "Conflict", 

90 "ConflictPage", 

91 "ConflictResolution", 

92 "AssertRequest", 

93 "ResolveRequest", 

94 # recall + cards (Phase 9) 

95 "RecallRequest", 

96 "RecallResponse", 

97 "RecallWeights", 

98 "ScoreBreakdown", 

99 "ScoredFact", 

100 "MemoryCard", 

101 # value constructors 

102 "string_value", 

103 "text_value", 

104 "number_value", 

105 "boolean_value", 

106 "datetime_value", 

107 "ref_value", 

108 "null_value", 

109 # verification 

110 "StigmemVerificationError", 

111 "compute_fact_cid", 

112 "verify_fact_cid", 

113 "verify_fact_chain_proof", 

114] 

115 

116# Read version from installed package metadata so __version__ stays in 

117# lockstep with whatever pip installed. Falls back to "0.0.0+unknown" only 

118# when the package is run from a non-installed source tree (e.g. uv sync 

119# in a workspace context that hasn't built the wheel yet); CI's package 

120# build path always populates the metadata. 

121try: 

122 __version__ = _pkg_version("stigmem-py") 

123except _PackageNotFoundError: 

124 __version__ = "0.0.0+unknown"