divi 0.0.1b1__py3-none-any.whl → 0.0.1b2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
divi/__init__.py CHANGED
@@ -13,5 +13,5 @@ _auth: Optional[Auth] = None
13
13
  _datapark: Optional[DataPark] = None
14
14
  _evaluator: Optional[Evaluator] = None
15
15
 
16
- __version__ = "0.0.1b1"
16
+ __version__ = "0.0.1b2"
17
17
  __all__ = ["obs_openai", "observable"]
divi/signals/span.py CHANGED
@@ -1,3 +1,4 @@
1
+ import atexit
1
2
  import os
2
3
  import time
3
4
  from enum import Enum
@@ -62,6 +63,8 @@ class Span:
62
63
  """Start the span by recording the current time in nanoseconds."""
63
64
  self.start_time_unix_nano = time.time_ns()
64
65
  self.upsert_span()
66
+ # Register the end method to be called at exit
67
+ atexit.register(self.end)
65
68
 
66
69
  def end(self):
67
70
  """End the span by recording the end time in nanoseconds."""
@@ -69,6 +72,8 @@ class Span:
69
72
  raise ValueError("Span must be started before ending.")
70
73
  self.end_time_unix_nano = time.time_ns()
71
74
  self.upsert_span()
75
+ # Unregister the end method
76
+ atexit.unregister(self.end)
72
77
 
73
78
  def _add_node(self, trace_id: UUID4, parent_id: Optional[bytes] = None):
74
79
  """Add node for obs tree."""
divi/signals/trace.py CHANGED
@@ -1,3 +1,4 @@
1
+ import atexit
1
2
  from datetime import UTC, datetime
2
3
  from typing import Optional
3
4
  from uuid import uuid4
@@ -63,6 +64,8 @@ class Trace:
63
64
  """Start the trace by recording the current time in nanoseconds."""
64
65
  self.start_time = datetime.now(UTC).isoformat()
65
66
  self.upsert_trace()
67
+ # Register the end method to be called on exit
68
+ atexit.register(self.end)
66
69
 
67
70
  def end(self):
68
71
  """End the trace by recording the end time in nanoseconds."""
@@ -70,6 +73,8 @@ class Trace:
70
73
  raise ValueError("Span must be started before ending.")
71
74
  self.end_time = datetime.now(UTC).isoformat()
72
75
  self.upsert_trace()
76
+ # Unregister the end method to prevent multiple calls
77
+ atexit.unregister(self.end)
73
78
 
74
79
  def upsert_trace(self):
75
80
  """Upsert trace with datapark."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: divi
3
- Version: 0.0.1b1
3
+ Version: 0.0.1b2
4
4
  Summary: The Agent Platform for Observability & Evaluation
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.11
@@ -1,5 +1,5 @@
1
1
  divi/README.md,sha256=hdw10Mkebd1SGMeA3tPJtlOwbWZzuQ8J-N9YPEHGuXg,67
2
- divi/__init__.py,sha256=XTB0By729PUQY9TYgoQXrzfQ2fiNEXRsx2mrA4A-83Y,436
2
+ divi/__init__.py,sha256=FNz-nbMRHLhT-JWowhQTK7zMajy2XY0TFPD3Jjar1sw,436
3
3
  divi/utils.py,sha256=fXkjoyo_Lh8AZliKICOP460m0czUcNQjcEcceJbaOVA,1439
4
4
  divi/decorators/__init__.py,sha256=HkyWdC1ctTsVFucCWCkj57JB4NmwONus1d2S2dUbvs4,110
5
5
  divi/decorators/collect.py,sha256=5iUxAnbHYx4ISkFg64IK_4miGdrWgbOXLJxKz8lGIv8,1074
@@ -44,9 +44,9 @@ divi/session/session.py,sha256=QxtEezI447PbtKG2U6cxL1ACae55e8nFfTufAY8pEYI,811
44
44
  divi/session/setup.py,sha256=rC1QdCxpdCOaRXmcLEQs4Yuu5UC_aRzKSaqWRPJN4Og,1390
45
45
  divi/session/teardown.py,sha256=YiBz_3yCiljMFEofZ60VmRL5sb8WA5GT7EYF8nFznZ4,133
46
46
  divi/signals/__init__.py,sha256=wfSkkCwkRsFP4aLj8aGHk_k6Y50P5yN44WWlO3XyW18,43
47
- divi/signals/span.py,sha256=FQWql6ivAeXGk1HPZCsCjL5mXW6S6Nn9SmOiKH4aXik,2629
48
- divi/signals/trace.py,sha256=IoYeTfd6x_Xmxcp4HbFSEne0d48hol4ng2Mb_AO8hZw,2144
49
- divi-0.0.1b1.dist-info/METADATA,sha256=-qCsxelGi6SeeA6x3aodNtiI_Z4GWcLUagFb5LWrfNQ,493
50
- divi-0.0.1b1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
51
- divi-0.0.1b1.dist-info/licenses/LICENSE,sha256=5OJuZ4wMMEV0DgF0tofhAlS_KLkaUsZwwwDS2U_GwQ0,1063
52
- divi-0.0.1b1.dist-info/RECORD,,
47
+ divi/signals/span.py,sha256=AQ24C8EKzGceryybX0rBe9B0z43kKaULdR6eOeOCtno,2804
48
+ divi/signals/trace.py,sha256=US_M2CAYNGUhEa5pppRPJN8dfNA5owgHMFDK2AOrFXA,2345
49
+ divi-0.0.1b2.dist-info/METADATA,sha256=IS0W_tN3EECkWRlX18GiUtX2idT3lYS2sAF2Z4jmoKA,493
50
+ divi-0.0.1b2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
51
+ divi-0.0.1b2.dist-info/licenses/LICENSE,sha256=5OJuZ4wMMEV0DgF0tofhAlS_KLkaUsZwwwDS2U_GwQ0,1063
52
+ divi-0.0.1b2.dist-info/RECORD,,
File without changes