Skip to content

Commit dd099e5

Browse files
feat/update-analyses-class-and-enable-regions/SDKPY-144 (#53)
* feat: enhance Analyses class with snippet methods and improved documentation Added listSnippets() and getSnippetFile() methods to fetch analysis code examples from TagoIO's public repository. Enhanced all existing methods with comprehensive docstrings following the Account class pattern, including descriptions, references, and practical examples. Updated type definitions to support new snippet functionality with SnippetRuntime, SnippetItem, and SnippetsListResponse types. Expanded test coverage with 8 new test cases and updated RST documentation with detailed method descriptions and code examples. * feat: enhance regions support and Analysis runtime with async execution Expanded regions.py with EU region support, TDeploy project integration, and runtime region caching. Refactored Analysis class to support async/await execution patterns with improved error handling and console service integration. Removed deprecated api_socket.py infrastructure and added JSONParseSafe utility for safer JSON parsing. Updated Analysis type definitions with new constructor params and function signatures. Added comprehensive region tests covering TDeploy and multi-region scenarios. * feat: enhance Analysis class initialization and region handling - Add instance attributes (params, started, _running) for better state management - Fix autostart logic to explicitly check for False instead of falsy values - Fix region configuration to safely handle missing region parameter using .get() This improves the Analysis class initialization by adding proper state tracking and preventing potential KeyError when region is not provided. * feat: update Analysis class to start automatically based on autostart parameter * feat: modify autostart parameter default to True in Analysis class * feat: refactor Analysis class initialization and improve region support Restructured Analysis class to separate initialization from execution flow using new init() method pattern. Modified TagoContext from TypedDict to class for better runtime flexibility. Updated documentation examples to reflect Python runtime instead of Deno. * feat: update Analysis class to correctly assign analysis_id and environment from environment variables
1 parent 8aab4a4 commit dd099e5

13 files changed

Lines changed: 1157 additions & 264 deletions

File tree

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"ignoretz",
99
"PYPI",
1010
"pytest",
11-
"serie_number"
11+
"serie_number",
12+
"Tago"
1213
]
1314
}

docs/source/Resources/Analysis/Analysis_Type.rst

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,68 @@ AnalysisListItem
102102
| locked_at: Optional[datetime]
103103
104104
| console: Optional[List[str]]
105+
106+
107+
.. _SnippetRuntime:
108+
109+
SnippetRuntime
110+
--------------
111+
112+
Available runtime environments for snippets.
113+
114+
**Type:**
115+
116+
| Literal["node-legacy", "python-legacy", "node-rt2025", "python-rt2025", "deno-rt2025"]
117+
118+
119+
.. _SnippetItem:
120+
121+
SnippetItem
122+
-----------
123+
124+
Individual snippet metadata.
125+
126+
**Attributes:**
127+
128+
| id: str
129+
| Unique identifier for the snippet
130+
131+
| title: str
132+
| Human-readable title
133+
134+
| description: str
135+
| Description of what the snippet does
136+
137+
| language: str
138+
| Programming language (typescript, javascript, python)
139+
140+
| tags: List[str]
141+
| Array of tags for categorization
142+
143+
| filename: str
144+
| Filename of the snippet
145+
146+
| file_path: str
147+
| Full path to the file in the runtime directory
148+
149+
150+
.. _SnippetsListResponse:
151+
152+
SnippetsListResponse
153+
--------------------
154+
155+
API response containing all snippets metadata for a runtime.
156+
157+
**Attributes:**
158+
159+
| runtime: :ref:`SnippetRuntime`
160+
| Runtime environment identifier
161+
162+
| schema_version: int
163+
| Schema version for the API response format
164+
165+
| generated_at: str
166+
| ISO timestamp when the response was generated
167+
168+
| snippets: List[:ref:`SnippetItem`]
169+
| Array of all available snippets for this runtime

0 commit comments

Comments
 (0)