corio 2.2.3__tar.gz → 2.2.5__tar.gz

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.
Files changed (175) hide show
  1. {corio-2.2.3 → corio-2.2.5}/PKG-INFO +6 -1
  2. {corio-2.2.3 → corio-2.2.5}/corio/ai/agentic.py +0 -40
  3. {corio-2.2.3 → corio-2.2.5}/corio/ai/infer.py +0 -5
  4. {corio-2.2.3 → corio-2.2.5}/corio/api.py +0 -5
  5. {corio-2.2.3 → corio-2.2.5}/corio/caching.py +0 -31
  6. {corio-2.2.3 → corio-2.2.5}/corio/debug.py +0 -10
  7. {corio-2.2.3 → corio-2.2.5}/corio/entrypoint.py +13 -0
  8. {corio-2.2.3 → corio-2.2.5}/corio/https.py +0 -6
  9. {corio-2.2.3 → corio-2.2.5}/corio/infra/api.py +0 -4
  10. {corio-2.2.3 → corio-2.2.5}/corio/infra/incrementor_pyproject.py +89 -0
  11. {corio-2.2.3 → corio-2.2.5}/corio/infra/releaser.py +11 -78
  12. {corio-2.2.3 → corio-2.2.5}/corio/interface/interface.py +0 -3
  13. {corio-2.2.3 → corio-2.2.5}/corio/logs.py +0 -6
  14. {corio-2.2.3 → corio-2.2.5}/corio/openai.py +0 -5
  15. {corio-2.2.3 → corio-2.2.5}/corio/path/path.py +0 -4
  16. {corio-2.2.3 → corio-2.2.5}/corio/patterns.py +0 -4
  17. {corio-2.2.3 → corio-2.2.5}/corio/pdf.py +0 -13
  18. {corio-2.2.3 → corio-2.2.5}/corio/pyproject.package.toml +177 -74
  19. {corio-2.2.3 → corio-2.2.5}/corio/sec.py +0 -4
  20. corio-2.2.5/corio/tests/test_caching.py +75 -0
  21. corio-2.2.5/corio/tests/test_dns.py +89 -0
  22. corio-2.2.5/corio/tests/test_dt.py +10 -0
  23. {corio-2.2.3 → corio-2.2.5}/corio/tests/test_env.py +10 -0
  24. corio-2.2.5/corio/tests/test_hash.py +18 -0
  25. corio-2.2.5/corio/tests/test_hook.py +28 -0
  26. {corio-2.2.3 → corio-2.2.5}/corio/tests/test_infra.py +149 -1
  27. corio-2.2.5/corio/tests/test_iterator.py +48 -0
  28. corio-2.2.5/corio/tests/test_jsn.py +24 -0
  29. corio-2.2.5/corio/tests/test_name.py +20 -0
  30. corio-2.2.5/corio/tests/test_path.py +158 -0
  31. corio-2.2.5/corio/tests/test_patterns.py +71 -0
  32. corio-2.2.5/corio/tests/test_rand.py +46 -0
  33. corio-2.2.5/corio/tests/test_strings.py +54 -0
  34. corio-2.2.5/corio/tests/test_toml.py +37 -0
  35. corio-2.2.5/corio/tests/test_tools.py +14 -0
  36. corio-2.2.5/corio/tests/test_yaml.py +26 -0
  37. {corio-2.2.3 → corio-2.2.5}/corio/webhook.py +0 -5
  38. {corio-2.2.3 → corio-2.2.5}/corio/yml.py +0 -6
  39. {corio-2.2.3 → corio-2.2.5}/corio.egg-info/PKG-INFO +6 -1
  40. {corio-2.2.3 → corio-2.2.5}/corio.egg-info/SOURCES.txt +12 -0
  41. {corio-2.2.3 → corio-2.2.5}/corio.egg-info/requires.txt +7 -0
  42. {corio-2.2.3 → corio-2.2.5}/pyproject.toml +177 -74
  43. corio-2.2.5/scripts/run-tests +7 -0
  44. corio-2.2.3/corio/tests/test_caching.py +0 -39
  45. corio-2.2.3/corio/tests/test_jsn.py +0 -13
  46. corio-2.2.3/corio/tests/test_path.py +0 -99
  47. corio-2.2.3/corio/tests/test_yaml.py +0 -13
  48. {corio-2.2.3 → corio-2.2.5}/LICENSE +0 -0
  49. {corio-2.2.3 → corio-2.2.5}/README.md +0 -0
  50. {corio-2.2.3 → corio-2.2.5}/corio/__init__.py +0 -0
  51. {corio-2.2.3 → corio-2.2.5}/corio/ai/__init__.py +0 -0
  52. {corio-2.2.3 → corio-2.2.5}/corio/aio.py +0 -0
  53. {corio-2.2.3 → corio-2.2.5}/corio/augmentation.py +0 -0
  54. {corio-2.2.3 → corio-2.2.5}/corio/av.py +0 -0
  55. {corio-2.2.3 → corio-2.2.5}/corio/constants.py +0 -0
  56. {corio-2.2.3 → corio-2.2.5}/corio/context.py +0 -0
  57. {corio-2.2.3 → corio-2.2.5}/corio/dataclass.py +0 -0
  58. {corio-2.2.3 → corio-2.2.5}/corio/datatype.py +0 -0
  59. {corio-2.2.3 → corio-2.2.5}/corio/db/__init__.py +0 -0
  60. {corio-2.2.3 → corio-2.2.5}/corio/db/document.py +0 -0
  61. {corio-2.2.3 → corio-2.2.5}/corio/dm.py +0 -0
  62. {corio-2.2.3 → corio-2.2.5}/corio/dns/__init__.py +0 -0
  63. {corio-2.2.3 → corio-2.2.5}/corio/dns/client.py +0 -0
  64. {corio-2.2.3 → corio-2.2.5}/corio/dns/dm.py +0 -0
  65. {corio-2.2.3 → corio-2.2.5}/corio/dns/proxy.py +0 -0
  66. {corio-2.2.3 → corio-2.2.5}/corio/dns/server.py +0 -0
  67. {corio-2.2.3 → corio-2.2.5}/corio/docker/__init__.py +0 -0
  68. {corio-2.2.3 → corio-2.2.5}/corio/dt.py +0 -0
  69. {corio-2.2.3 → corio-2.2.5}/corio/encrypt.py +0 -0
  70. {corio-2.2.3 → corio-2.2.5}/corio/env.py +0 -0
  71. {corio-2.2.3 → corio-2.2.5}/corio/function.py +0 -0
  72. {corio-2.2.3 → corio-2.2.5}/corio/google_api.py +0 -0
  73. {corio-2.2.3 → corio-2.2.5}/corio/ha/__init__.py +0 -0
  74. {corio-2.2.3 → corio-2.2.5}/corio/ha/constants.py +0 -0
  75. {corio-2.2.3 → corio-2.2.5}/corio/ha/core.py +0 -0
  76. {corio-2.2.3 → corio-2.2.5}/corio/ha/supervisor.py +0 -0
  77. {corio-2.2.3 → corio-2.2.5}/corio/ha/utils.py +0 -0
  78. {corio-2.2.3 → corio-2.2.5}/corio/hash.py +0 -0
  79. {corio-2.2.3 → corio-2.2.5}/corio/hfh.py +0 -0
  80. {corio-2.2.3 → corio-2.2.5}/corio/hook.py +0 -0
  81. {corio-2.2.3 → corio-2.2.5}/corio/infra/__init__.py +0 -0
  82. {corio-2.2.3 → corio-2.2.5}/corio/infra/project.py +0 -0
  83. {corio-2.2.3 → corio-2.2.5}/corio/infra/repository.py +0 -0
  84. {corio-2.2.3 → corio-2.2.5}/corio/infra/stack.py +0 -0
  85. {corio-2.2.3 → corio-2.2.5}/corio/inherit.py +0 -0
  86. {corio-2.2.3 → corio-2.2.5}/corio/inspection.py +0 -0
  87. {corio-2.2.3 → corio-2.2.5}/corio/interface/__init__.py +0 -0
  88. {corio-2.2.3 → corio-2.2.5}/corio/interface/context.py +0 -0
  89. {corio-2.2.3 → corio-2.2.5}/corio/interface/controls.py +0 -0
  90. {corio-2.2.3 → corio-2.2.5}/corio/iterator.py +0 -0
  91. {corio-2.2.3 → corio-2.2.5}/corio/jsn.py +0 -0
  92. {corio-2.2.3 → corio-2.2.5}/corio/json_fix.py +0 -0
  93. {corio-2.2.3 → corio-2.2.5}/corio/markup.py +0 -0
  94. {corio-2.2.3 → corio-2.2.5}/corio/merging.py +0 -0
  95. {corio-2.2.3 → corio-2.2.5}/corio/metric.py +0 -0
  96. {corio-2.2.3 → corio-2.2.5}/corio/mqtt.py +0 -0
  97. {corio-2.2.3 → corio-2.2.5}/corio/name.py +0 -0
  98. {corio-2.2.3 → corio-2.2.5}/corio/net.py +0 -0
  99. {corio-2.2.3 → corio-2.2.5}/corio/netrc.py +0 -0
  100. {corio-2.2.3 → corio-2.2.5}/corio/parallel.py +0 -0
  101. {corio-2.2.3 → corio-2.2.5}/corio/path/__init__.py +0 -0
  102. {corio-2.2.3 → corio-2.2.5}/corio/path/app.py +0 -0
  103. {corio-2.2.3 → corio-2.2.5}/corio/path/type.py +0 -0
  104. {corio-2.2.3 → corio-2.2.5}/corio/paths.py +0 -0
  105. {corio-2.2.3 → corio-2.2.5}/corio/plat.py +0 -0
  106. {corio-2.2.3 → corio-2.2.5}/corio/process.py +0 -0
  107. {corio-2.2.3 → corio-2.2.5}/corio/profiling.py +0 -0
  108. {corio-2.2.3 → corio-2.2.5}/corio/rand.py +0 -0
  109. {corio-2.2.3 → corio-2.2.5}/corio/semantic.py +0 -0
  110. {corio-2.2.3 → corio-2.2.5}/corio/sets.py +0 -0
  111. {corio-2.2.3 → corio-2.2.5}/corio/setup/__init__.py +0 -0
  112. {corio-2.2.3 → corio-2.2.5}/corio/spaces.py +0 -0
  113. {corio-2.2.3 → corio-2.2.5}/corio/strings.py +0 -0
  114. {corio-2.2.3 → corio-2.2.5}/corio/tabular.py +0 -0
  115. {corio-2.2.3 → corio-2.2.5}/corio/tests/__init__.py +0 -0
  116. {corio-2.2.3 → corio-2.2.5}/corio/tests/conftest.py +0 -0
  117. {corio-2.2.3 → corio-2.2.5}/corio/tests/helpers.py +0 -0
  118. {corio-2.2.3 → corio-2.2.5}/corio/tests/test_datatype.py +0 -0
  119. {corio-2.2.3 → corio-2.2.5}/corio/tests/test_encrypt.py +0 -0
  120. {corio-2.2.3 → corio-2.2.5}/corio/tokenization.py +0 -0
  121. {corio-2.2.3 → corio-2.2.5}/corio/toml.py +0 -0
  122. {corio-2.2.3 → corio-2.2.5}/corio/tools.py +0 -0
  123. {corio-2.2.3 → corio-2.2.5}/corio/unicode.py +0 -0
  124. {corio-2.2.3 → corio-2.2.5}/corio/version/__init__.py +0 -0
  125. {corio-2.2.3 → corio-2.2.5}/corio/version/version.py +0 -0
  126. {corio-2.2.3 → corio-2.2.5}/corio/youtube.py +0 -0
  127. {corio-2.2.3 → corio-2.2.5}/corio.egg-info/dependency_links.txt +0 -0
  128. {corio-2.2.3 → corio-2.2.5}/corio.egg-info/entry_points.txt +0 -0
  129. {corio-2.2.3 → corio-2.2.5}/corio.egg-info/top_level.txt +0 -0
  130. {corio-2.2.3 → corio-2.2.5}/scripts/add-service +0 -0
  131. {corio-2.2.3 → corio-2.2.5}/scripts/add-user-path +0 -0
  132. {corio-2.2.3 → corio-2.2.5}/scripts/add-ve-shell +0 -0
  133. {corio-2.2.3 → corio-2.2.5}/scripts/apt-essentials +0 -0
  134. {corio-2.2.3 → corio-2.2.5}/scripts/apt-headless +0 -0
  135. {corio-2.2.3 → corio-2.2.5}/scripts/auth-token +0 -0
  136. {corio-2.2.3 → corio-2.2.5}/scripts/compose-update +0 -0
  137. {corio-2.2.3 → corio-2.2.5}/scripts/compress-dir +0 -0
  138. {corio-2.2.3 → corio-2.2.5}/scripts/cru +0 -0
  139. {corio-2.2.3 → corio-2.2.5}/scripts/docker-build-bases +0 -0
  140. {corio-2.2.3 → corio-2.2.5}/scripts/docker-build-bases-dev +0 -0
  141. {corio-2.2.3 → corio-2.2.5}/scripts/docker-install-deps +0 -0
  142. {corio-2.2.3 → corio-2.2.5}/scripts/docker-install-prod +0 -0
  143. {corio-2.2.3 → corio-2.2.5}/scripts/docker-prune +0 -0
  144. {corio-2.2.3 → corio-2.2.5}/scripts/docker-sandbox +0 -0
  145. {corio-2.2.3 → corio-2.2.5}/scripts/docker-sandbox-init +0 -0
  146. {corio-2.2.3 → corio-2.2.5}/scripts/docs-deploy +0 -0
  147. {corio-2.2.3 → corio-2.2.5}/scripts/download +0 -0
  148. {corio-2.2.3 → corio-2.2.5}/scripts/encrypt-secrets +0 -0
  149. {corio-2.2.3 → corio-2.2.5}/scripts/fmtr-test-script +0 -0
  150. {corio-2.2.3 → corio-2.2.5}/scripts/git-clone +0 -0
  151. {corio-2.2.3 → corio-2.2.5}/scripts/ha-addon-launch +0 -0
  152. {corio-2.2.3 → corio-2.2.5}/scripts/infra +0 -0
  153. {corio-2.2.3 → corio-2.2.5}/scripts/infra-sync +0 -0
  154. {corio-2.2.3 → corio-2.2.5}/scripts/install-browser +0 -0
  155. {corio-2.2.3 → corio-2.2.5}/scripts/install-docker +0 -0
  156. {corio-2.2.3 → corio-2.2.5}/scripts/install-ts +0 -0
  157. {corio-2.2.3 → corio-2.2.5}/scripts/install-ys +0 -0
  158. {corio-2.2.3 → corio-2.2.5}/scripts/mirror-dir +0 -0
  159. {corio-2.2.3 → corio-2.2.5}/scripts/opt-dev-init +0 -0
  160. {corio-2.2.3 → corio-2.2.5}/scripts/parse-args +0 -0
  161. {corio-2.2.3 → corio-2.2.5}/scripts/pypi-check +0 -0
  162. {corio-2.2.3 → corio-2.2.5}/scripts/pypi-reserve +0 -0
  163. {corio-2.2.3 → corio-2.2.5}/scripts/run-script +0 -0
  164. {corio-2.2.3 → corio-2.2.5}/scripts/set-password +0 -0
  165. {corio-2.2.3 → corio-2.2.5}/scripts/set-secure-path +0 -0
  166. {corio-2.2.3 → corio-2.2.5}/scripts/set-user-sudo +0 -0
  167. {corio-2.2.3 → corio-2.2.5}/scripts/snips-install +0 -0
  168. {corio-2.2.3 → corio-2.2.5}/scripts/ssh-auth +0 -0
  169. {corio-2.2.3 → corio-2.2.5}/scripts/ssh-serve +0 -0
  170. {corio-2.2.3 → corio-2.2.5}/scripts/tasmota-config +0 -0
  171. {corio-2.2.3 → corio-2.2.5}/scripts/tasmota-flash +0 -0
  172. {corio-2.2.3 → corio-2.2.5}/scripts/tasmota-terminal +0 -0
  173. {corio-2.2.3 → corio-2.2.5}/scripts/vlc-tn +0 -0
  174. {corio-2.2.3 → corio-2.2.5}/scripts/vm-launch +0 -0
  175. {corio-2.2.3 → corio-2.2.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: corio
3
- Version: 2.2.3
3
+ Version: 2.2.5
4
4
  Summary: Collection of high-level tools to simplify everyday development tasks, with a focus on AI/ML
5
5
  Author-email: Frontmatter AI <innovative.fowler@mask.pro.fmtr.dev>
6
6
  License-Expression: Apache-2.0
@@ -188,6 +188,8 @@ Requires-Dist: httpx; extra == "dns"
188
188
  Requires-Dist: httpx_retries; extra == "dns"
189
189
  Requires-Dist: logfire; extra == "dns"
190
190
  Requires-Dist: logfire[httpx]; extra == "dns"
191
+ Requires-Dist: diskcache; extra == "dns"
192
+ Requires-Dist: cachetools; extra == "dns"
191
193
  Provides-Extra: patterns
192
194
  Requires-Dist: regex; extra == "patterns"
193
195
  Provides-Extra: http
@@ -214,6 +216,9 @@ Requires-Dist: av; extra == "av"
214
216
  Provides-Extra: env
215
217
  Provides-Extra: env-io
216
218
  Requires-Dist: dotenv; extra == "env-io"
219
+ Provides-Extra: toml
220
+ Provides-Extra: toml-write
221
+ Requires-Dist: tomlkit; extra == "toml-write"
217
222
  Provides-Extra: ha
218
223
  Requires-Dist: dotenv; extra == "ha"
219
224
  Provides-Extra: ha-api
@@ -177,43 +177,3 @@ def default_prompt_none_specified(text):
177
177
 
178
178
 
179
179
  StringDefaultNoneSpecified = Annotated[Optional[str], PlainValidator(default_prompt_none_specified)]
180
-
181
-
182
- if __name__ == '__main__':
183
- import asyncio
184
- from corio import dm
185
-
186
-
187
- class TestOutput(dm.Base):
188
- text: str
189
-
190
-
191
- class TestDeps(dm.Base):
192
- lang: str
193
- subject: str
194
-
195
-
196
- class TaskTest(Task):
197
- PROVIDER = Task.PROVIDER_FMTR
198
- MODEL_ID = Task.MODEL_ID_FMTR
199
- TypeOutput = TestOutput
200
- SYSTEM_PROMPT_STATIC = 'Tell the user jokes.'
201
-
202
- @property
203
- def tool_output(self) -> OutputSpec[TestOutput]:
204
- return NativeOutput(self.TypeOutput)
205
-
206
- def add_system_prompt(self, ctx: RunContext[TestDeps]) -> str:
207
- return f'The jokes must be in the {ctx.deps.lang} language.'
208
-
209
- def get_prompt(self, deps: Optional[TestDeps]) -> str:
210
- return f'Tell me one about {deps.subject}.'
211
-
212
- task = TaskTest()
213
- deps = TestDeps(lang='English', subject='eggs')
214
- result1 = task.sync_runner(task.run(deps=deps))
215
- result1
216
-
217
- deps = TestDeps(lang='German', subject='sausages')
218
- result2 = task.sync_runner(task.run(deps=deps))
219
- result2
@@ -410,8 +410,3 @@ def tst_tool():
410
410
  objs = ToolsCall.from_json(text).apply(BulkInferenceManagerTools.TOOLS)
411
411
  obj = objs[0]
412
412
  print(obj)
413
-
414
-
415
- if __name__ == '__main__':
416
- texts = tst()
417
- texts
@@ -178,8 +178,3 @@ class Base:
178
178
  """
179
179
  import asyncio
180
180
  return asyncio.run(cls.launch_async(*args, **kwargs))
181
-
182
-
183
-
184
- if __name__ == '__main__':
185
- Base.launch()
@@ -178,34 +178,3 @@ class TLRU(cachetools.TLRUCache):
178
178
 
179
179
  """
180
180
  return self.dump()
181
-
182
-
183
-
184
- if __name__ == '__main__':
185
- sec10 = timedelta(seconds=10)
186
- c = TLRU(ttu_static=sec10, maxsize=2, desc='Test Data')
187
- c['test'] = 'val'
188
- c['test2'] = 'val2'
189
- c['test3'] = 'val3'
190
- c
191
-
192
-
193
-
194
-
195
-
196
-
197
- path_tmp_cache = Path.cwd().parent.parent / 'data' / 'cache'
198
- tc = Disk(path_tmp_cache)
199
-
200
- tc.setdefault('c', Disk).setdefault('c1', Disk)['subkey'] = 0000.1
201
- # tc['c']=Disk.Create
202
- tc['c']['test'] = False
203
- tc['val'] = 123
204
- tc.setdefault('b', Disk)
205
- tc.setdefault('a', Disk)
206
- tc['a']['value2'] = 456
207
- tc['a']['value4'] = dict(mykey='myvalue')
208
-
209
- tc['b']['value3'] = [789, True]
210
- tc.dump()
211
- {}.items()
@@ -78,13 +78,3 @@ def debug_shell():
78
78
  data = ShellDebug.from_path(path_str)
79
79
  trace(is_debug=True)
80
80
  data
81
-
82
-
83
- if __name__ == "__main__":
84
- import sys
85
-
86
- sys.argv = [
87
- 'test.py',
88
- './fmtr-debug/34e8d492-2f15-419a-8fcb-fe4fa0fa02bb',
89
- ]
90
- debug_shell()
@@ -3,6 +3,7 @@ from pydantic_settings import CliSubCommand
3
3
  from corio import dm
4
4
  from corio import sec
5
5
  from corio import sets
6
+ from corio.path import Path
6
7
 
7
8
 
8
9
  class DocServe(dm.Base):
@@ -42,6 +43,17 @@ class EpTest(dm.Base):
42
43
  print("Ran test entrypoint.")
43
44
 
44
45
 
46
+ class Test(dm.Base):
47
+ name: str = Path.cwd().name
48
+
49
+ def run(self):
50
+ from corio.infra.project import Project
51
+
52
+ project = Project(self.name)
53
+ is_passed = project.releaser.tester.run()
54
+ return int(not is_passed)
55
+
56
+
45
57
  class ShellDebug(dm.Base):
46
58
  def run(self):
47
59
  from corio import debug
@@ -81,6 +93,7 @@ class Cli(sets.Base, cli_parse_args=True):
81
93
  secrets: CliSubCommand[sec.Cli]
82
94
  docs: CliSubCommand[Docs]
83
95
  pyproject: CliSubCommand[Pyproject]
96
+ test: CliSubCommand[Test]
84
97
  ep_test: CliSubCommand[EpTest]
85
98
  shell_debug: CliSubCommand[ShellDebug]
86
99
  cache_hfh: CliSubCommand[CacheHfh]
@@ -44,9 +44,3 @@ class Client(httpx.Client):
44
44
 
45
45
 
46
46
  client = Client()
47
-
48
- if __name__ == '__main__':
49
- resp = client.get('https://postman-echo.com/delay/5')
50
- resp.raise_for_status()
51
- print(resp.json())
52
- resp
@@ -47,7 +47,3 @@ class Api(api.Base):
47
47
  project = Project(name, pinned=pinned)
48
48
 
49
49
  project.releaser.run(increment=increment, build=build, release=release, cache=cache)
50
-
51
-
52
- if __name__ == '__main__':
53
- Api.launch()
@@ -19,6 +19,9 @@ class IncrementorPyproject(Incrementor):
19
19
  ENTRYPOINT_FUNCTION_SEP = "_"
20
20
  ENTRYPOINT_FUNC_NAME = "main"
21
21
  DEPENDENCIES_SECTION_PATH = ("tool", "corio", "dependencies")
22
+ TEST_FILENAME_PREFIX = "test_"
23
+ TEST_FILENAME_SUFFIX = ".py"
24
+ TOX_REQUIRES = ["tox>=4.22", "tox-uv>=1"]
22
25
 
23
26
  @cached_property
24
27
  def path(self) -> Path:
@@ -274,4 +277,90 @@ class IncrementorPyproject(Incrementor):
274
277
  elif "script-files" in setuptools:
275
278
  del setuptools["script-files"]
276
279
 
280
+ dependencies = project.get("optional-dependencies", {})
281
+ envs = self._tox_envs(dependencies=dependencies)
282
+ tox = ensure_table(data, ("tool", "tox"))
283
+ tox["requires"] = list(self.TOX_REQUIRES)
284
+ tox["env_list"] = list(envs.keys())
285
+ tox["env"] = envs
286
+
277
287
  return data
288
+
289
+ @cached_property
290
+ def _tests_modules(self) -> list[str]:
291
+ if not self.paths.tests.exists():
292
+ return []
293
+
294
+ modules = []
295
+ for path in sorted(self.paths.tests.glob(f"{self.TEST_FILENAME_PREFIX}*{self.TEST_FILENAME_SUFFIX}")):
296
+ module = path.stem.removeprefix(self.TEST_FILENAME_PREFIX)
297
+ if module:
298
+ modules.append(module)
299
+ return modules
300
+
301
+ def _tox_get_extras_module(self, module: str, dependencies: dict[str, list[str]]) -> list[str]:
302
+ extras = ["test"]
303
+ extras_available = set(dependencies.keys())
304
+ module_canonical = canonicalize_name(module)
305
+
306
+ extras_exact = [extra for extra in extras_available if canonicalize_name(extra) == module_canonical]
307
+ if extras_exact:
308
+ extras = sorted(extras_exact) + extras
309
+
310
+ extras_children = sorted(
311
+ extra
312
+ for extra in extras_available
313
+ if canonicalize_name(extra).startswith(f"{module_canonical}-")
314
+ )
315
+ return extras_children + extras
316
+
317
+ def _tox_get_deps_extras(self, extras: list[str], dependencies: dict[str, list[str]]) -> list[str]:
318
+ deps = []
319
+ for extra in extras:
320
+ deps += dependencies.get(extra, [])
321
+ deps = dedupe(deps)
322
+ return deps
323
+
324
+ def _tox_get_env(
325
+ self,
326
+ *,
327
+ name: str,
328
+ path_tests: Path,
329
+ extras: list[str],
330
+ dependencies: dict[str, list[str]],
331
+ ) -> dict:
332
+ if path_tests.is_relative_to(self.paths.repo):
333
+ path_tests = path_tests.relative_to(self.paths.repo)
334
+ deps = self._tox_get_deps_extras(extras=extras, dependencies=dependencies)
335
+ env = {
336
+ "description": f"Run {name} tests.",
337
+ "deps": deps,
338
+ "commands": [["python", "-m", "pytest", "-q", str(path_tests)]],
339
+ }
340
+ return env
341
+
342
+ def _tox_envs(self, dependencies: dict[str, list[str]]) -> dict[str, dict]:
343
+ if not self.paths.metadata.test_envs:
344
+ if not self._tests_modules:
345
+ return {}
346
+ return {
347
+ self.paths.name_ns: self._tox_get_env(
348
+ name=self.paths.name_ns,
349
+ path_tests=self.paths.tests,
350
+ extras=["test"],
351
+ dependencies=dependencies,
352
+ )
353
+ }
354
+
355
+ envs = {}
356
+ for module in self._tests_modules:
357
+ extras = self._tox_get_extras_module(module=module, dependencies=dependencies)
358
+ path_test = self.paths.tests / f"{self.TEST_FILENAME_PREFIX}{module}{self.TEST_FILENAME_SUFFIX}"
359
+ name = module
360
+ envs[name] = self._tox_get_env(
361
+ name=name,
362
+ path_tests=path_test,
363
+ extras=extras,
364
+ dependencies=dependencies,
365
+ )
366
+ return envs
@@ -1,7 +1,6 @@
1
- import shutil
2
1
  import subprocess
3
2
  from functools import cached_property
4
-
3
+ import shutil
5
4
  import build
6
5
  import pygit2 as vcs
7
6
  import twine.settings
@@ -571,26 +570,6 @@ class ReleaseDocumentation(Release):
571
570
  class Tester(Inherit[Releaser]):
572
571
  TEST_FILENAME_PREFIX = "test_"
573
572
  TEST_FILENAME_SUFFIX = ".py"
574
- TOX_REQUIRES = ["tox>=4.22", "tox-uv>=1"]
575
-
576
- @cached_property
577
- def path_config_dir(self) -> Path:
578
- return Path.temp() / f"{self.name}-tox"
579
-
580
- @cached_property
581
- def path_config(self) -> Path:
582
- return self.path_config_dir / "tox.toml"
583
-
584
- @cached_property
585
- def dependencies(self) -> dict[str, list[str]]:
586
- data = self.paths.pyproject_repo.read_toml()
587
- table = data.get("tool", {}).get("corio", {}).get("dependencies", {})
588
- dependencies = {
589
- str(key): [str(value) for value in values]
590
- for key, values in table.items()
591
- if isinstance(values, list)
592
- }
593
- return dependencies
594
573
 
595
574
  @cached_property
596
575
  def modules(self) -> list[str]:
@@ -604,54 +583,10 @@ class Tester(Inherit[Releaser]):
604
583
  modules.append(module)
605
584
  return modules
606
585
 
607
-
608
- def get_env(self, name: str, path_tests: Path, extras: list[str]) -> dict:
609
- if path_tests.is_relative_to(self.paths.repo):
610
- path_tests = path_tests.relative_to(self.paths.repo)
611
- env = {
612
- "description": f"Run {name} tests.",
613
- "extras": extras,
614
- "commands": [["python", "-m", "pytest", "-q", str(path_tests)]],
615
- }
616
- return env
617
-
618
586
  @cached_property
619
- def env(self) -> dict:
620
- return self.get_env(name=self.paths.name_ns, path_tests=self.paths.tests, extras=["test"])
621
-
622
- @cached_property
623
- def envs(self) -> dict[str, dict]:
624
- if not self.paths.metadata.test_envs:
625
- if not self.modules:
626
- return {}
627
- return {self.paths.name_ns: self.env}
628
-
629
- envs = {}
630
- extras_available = set(self.dependencies.keys())
631
-
632
- for module in self.modules:
633
- extras = ["test"]
634
- if module in extras_available:
635
- extras.insert(0, module)
636
-
637
- path_test = self.paths.tests / f"{self.TEST_FILENAME_PREFIX}{module}{self.TEST_FILENAME_SUFFIX}"
638
- name = f"{self.paths.name_ns}.{module}"
639
- envs[name] = self.get_env(name=name, path_tests=path_test, extras=extras)
640
-
641
- return envs
642
-
643
- @cached_property
644
- def data(self) -> dict:
645
- data = {
646
- "requires": self.TOX_REQUIRES,
647
- "env_list": list(self.envs.keys()),
648
- "env": self.envs,
649
- }
650
- return data
651
-
652
- def write_config(self):
653
- self.path_config_dir.mkdir(parents=True, exist_ok=True)
654
- self.path_config.write_toml(self.data)
587
+ def env_list(self) -> list[str]:
588
+ data = self.paths.pyproject_repo.read_toml()
589
+ return list(data.get("tool", {}).get("tox", {}).get("env_list", []))
655
590
 
656
591
  def run_subprocess(self) -> int:
657
592
  command = [
@@ -660,7 +595,7 @@ class Tester(Inherit[Releaser]):
660
595
  "tox-uv",
661
596
  "tox",
662
597
  "-c",
663
- str(self.path_config),
598
+ str(self.paths.pyproject_repo),
664
599
  "--root",
665
600
  str(self.paths.repo),
666
601
  "--workdir",
@@ -686,17 +621,15 @@ class Tester(Inherit[Releaser]):
686
621
 
687
622
  @logger.instrument('Running test suite for "{self.paths.name_ns}"...')
688
623
  def run(self) -> bool:
689
- if not self.envs:
624
+ if not self.modules:
690
625
  logger.warning(f'No tests found under "{self.paths.tests}". Skipping.')
691
626
  return True
692
627
 
693
- logger.info(f'Generating temporary tox config: "{self.path_config}"')
694
- self.write_config()
695
- try:
696
- code = self.run_subprocess()
697
- finally:
698
- self.path_config.unlink(missing_ok=True)
699
- shutil.rmtree(self.path_config_dir, ignore_errors=True)
628
+ if not self.env_list:
629
+ logger.warning(f'No tox envs found in "{self.paths.pyproject_repo}". Skipping.')
630
+ return True
631
+
632
+ code = self.run_subprocess()
700
633
 
701
634
  if code == 0:
702
635
  logger.info("All test environments passed.")
@@ -183,6 +183,3 @@ class Test(Base[Context]):
183
183
  def __init__(self):
184
184
  controls = [ft.Text(self.TITLE)]
185
185
  super().__init__(controls=controls)
186
-
187
- if __name__ == "__main__":
188
- Test.launch()
@@ -148,9 +148,3 @@ def get_native_level_from_otel(otel_name: str) -> int:
148
148
 
149
149
 
150
150
  logger = get_logger(name=Constants.LIBRARY_NAME)
151
-
152
- if __name__ == '__main__':
153
- logger.info('Hello World')
154
- logger.warning('test warning')
155
- logger.debug('Hello World')
156
- logger
@@ -33,8 +33,3 @@ def get_text(prompt, model='gpt-4o'):
33
33
  )
34
34
  text = completion.choices[0].message.content
35
35
  return text
36
-
37
-
38
- if __name__ == '__main__':
39
- text = get_text('hi')
40
- text
@@ -909,7 +909,3 @@ class PathsSearchData:
909
909
  org = None
910
910
  name = next(iter(parts))
911
911
  return org, name
912
-
913
- if __name__ == "__main__":
914
- paths = PackagePaths()
915
- paths
@@ -272,7 +272,3 @@ class Transformer:
272
272
  logger.debug(f'Finished transforming: {history_str}')
273
273
 
274
274
  return previous
275
-
276
-
277
- if __name__ == '__main__':
278
- ...
@@ -216,16 +216,3 @@ class Document(pm.Document):
216
216
  documents.append(document)
217
217
 
218
218
  return documents
219
-
220
- if __name__ == '__main__':
221
- from corio.path import Path
222
-
223
- PATH_DATA = Path.data()
224
- # PATH_PDF=PATH_DATA/'chib.pdf'
225
- PATH_PDF = PATH_DATA / 'kvm.pdf'
226
- assert PATH_PDF.exists()
227
-
228
- doc = Document(PATH_PDF)
229
- data = doc.data
230
- md = doc.to_markdown()
231
- md