stata-code 0.3.0__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.
stata_code/__init__.py ADDED
@@ -0,0 +1,100 @@
1
+ """stata_code — agent-native Stata bridge.
2
+
3
+ Public API::
4
+
5
+ from stata_code import run, RunResult, get_log, get_graph, list_sessions
6
+
7
+ r = run("regress mpg weight")
8
+ if r.ok:
9
+ print(r.results.e.scalars["r2"])
10
+ for g in r.graphs:
11
+ print(g.ref)
12
+ else:
13
+ print(r.error.kind, r.error.message)
14
+ for s in r.error.suggestions:
15
+ print("hint:", s.action)
16
+
17
+ The result envelope, multi-session model, error taxonomy, and token-economy
18
+ defaults are all defined in ``SCHEMA.md`` (the normative contract).
19
+ """
20
+
21
+ from __future__ import annotations
22
+
23
+ from stata_code.core._runtime import PystataNotAvailable, is_available
24
+ from stata_code.core.errors import classify_rc, suggestions_for
25
+ from stata_code.core.runner import (
26
+ cancel,
27
+ clear_cancel,
28
+ execute,
29
+ get_graph,
30
+ get_log,
31
+ get_matrix,
32
+ is_cancel_pending,
33
+ list_sessions,
34
+ reset_session,
35
+ )
36
+ from stata_code.core.schema import (
37
+ Backend,
38
+ DatasetInfo,
39
+ ErrorContext,
40
+ ErrorInfo,
41
+ ErrorKind,
42
+ GraphFormat,
43
+ GraphInfo,
44
+ IncludeGraphs,
45
+ LogInfo,
46
+ Matrix,
47
+ ResultsInfo,
48
+ RunResult,
49
+ StataEdition,
50
+ StataInfo,
51
+ StataReturns,
52
+ StataWarning,
53
+ Suggestion,
54
+ VariableInfo,
55
+ )
56
+
57
+ # Convenience alias: `run(...)` == `execute(...)`.
58
+ run = execute
59
+
60
+ __version__ = "0.3.0"
61
+
62
+ __all__ = [
63
+ # Primary entry points
64
+ "run",
65
+ "execute",
66
+ "RunResult",
67
+ # Auxiliary tools
68
+ "get_log",
69
+ "get_graph",
70
+ "get_matrix",
71
+ "list_sessions",
72
+ "reset_session",
73
+ "cancel",
74
+ "clear_cancel",
75
+ "is_cancel_pending",
76
+ # Availability check
77
+ "is_available",
78
+ "PystataNotAvailable",
79
+ # Schema enums and component types
80
+ "Backend",
81
+ "DatasetInfo",
82
+ "ErrorContext",
83
+ "ErrorInfo",
84
+ "ErrorKind",
85
+ "GraphFormat",
86
+ "GraphInfo",
87
+ "IncludeGraphs",
88
+ "LogInfo",
89
+ "Matrix",
90
+ "ResultsInfo",
91
+ "StataEdition",
92
+ "StataInfo",
93
+ "StataReturns",
94
+ "StataWarning",
95
+ "Suggestion",
96
+ "VariableInfo",
97
+ # Error helpers
98
+ "classify_rc",
99
+ "suggestions_for",
100
+ ]
@@ -0,0 +1,73 @@
1
+ """stata_code core — schema, errors, runner.
2
+
3
+ Most consumers import from ``stata_code`` directly. This module exposes the
4
+ internals for advanced use (e.g., type-only imports, custom adapters).
5
+ """
6
+
7
+ from stata_code.core._runtime import (
8
+ PystataNotAvailable,
9
+ PystataRuntime,
10
+ get_runtime,
11
+ is_available,
12
+ )
13
+ from stata_code.core.errors import RC_TO_KIND, classify_rc, suggestions_for
14
+ from stata_code.core.runner import (
15
+ execute,
16
+ get_graph,
17
+ get_log,
18
+ list_sessions,
19
+ reset_session,
20
+ )
21
+ from stata_code.core.schema import (
22
+ Backend,
23
+ DatasetInfo,
24
+ ErrorContext,
25
+ ErrorInfo,
26
+ ErrorKind,
27
+ GraphFormat,
28
+ GraphInfo,
29
+ IncludeGraphs,
30
+ LogInfo,
31
+ Matrix,
32
+ ResultsInfo,
33
+ RunResult,
34
+ StataEdition,
35
+ StataInfo,
36
+ StataReturns,
37
+ StataWarning,
38
+ Suggestion,
39
+ VariableInfo,
40
+ )
41
+
42
+ __all__ = [
43
+ "execute",
44
+ "get_graph",
45
+ "get_log",
46
+ "list_sessions",
47
+ "reset_session",
48
+ "PystataRuntime",
49
+ "PystataNotAvailable",
50
+ "is_available",
51
+ "get_runtime",
52
+ "RC_TO_KIND",
53
+ "classify_rc",
54
+ "suggestions_for",
55
+ "RunResult",
56
+ "ErrorKind",
57
+ "ErrorInfo",
58
+ "ErrorContext",
59
+ "Suggestion",
60
+ "LogInfo",
61
+ "ResultsInfo",
62
+ "StataReturns",
63
+ "Matrix",
64
+ "DatasetInfo",
65
+ "VariableInfo",
66
+ "GraphInfo",
67
+ "GraphFormat",
68
+ "IncludeGraphs",
69
+ "StataInfo",
70
+ "StataEdition",
71
+ "Backend",
72
+ "StataWarning",
73
+ ]