kosh 3.4__tar.gz → 3.6__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 (135) hide show
  1. {kosh-3.4/kosh.egg-info → kosh-3.6}/PKG-INFO +7 -1
  2. {kosh-3.4 → kosh-3.6}/README.md +3 -0
  3. kosh-3.6/kosh/current_version.py +1 -0
  4. {kosh-3.4 → kosh-3.6}/kosh/dataset.py +44 -1
  5. {kosh-3.4 → kosh-3.6}/kosh/ensemble.py +44 -1
  6. kosh-3.6/kosh/mada_extension.py +33 -0
  7. kosh-3.6/kosh/mcp_server/__init__.py +0 -0
  8. kosh-3.6/kosh/mcp_server/operations.py +1474 -0
  9. kosh-3.6/kosh/mcp_server/serializers.py +730 -0
  10. kosh-3.6/kosh/mcp_server/server.py +589 -0
  11. kosh-3.6/kosh/mcp_server/skills.md +407 -0
  12. kosh-3.6/kosh/mcp_server/store.py +833 -0
  13. kosh-3.6/kosh/mcp_server/transforms.py +266 -0
  14. kosh-3.6/kosh/mcp_server/utils.py +353 -0
  15. {kosh-3.4 → kosh-3.6}/kosh/store.py +60 -2
  16. {kosh-3.4 → kosh-3.6}/kosh/utils.py +3 -3
  17. {kosh-3.4 → kosh-3.6/kosh.egg-info}/PKG-INFO +7 -1
  18. {kosh-3.4 → kosh-3.6}/kosh.egg-info/SOURCES.txt +10 -0
  19. kosh-3.6/kosh.egg-info/entry_points.txt +7 -0
  20. {kosh-3.4 → kosh-3.6}/kosh.egg-info/requires.txt +4 -0
  21. {kosh-3.4 → kosh-3.6}/kosh.egg-info/top_level.txt +1 -4
  22. {kosh-3.4 → kosh-3.6}/pyproject.toml +11 -1
  23. {kosh-3.4 → kosh-3.6}/tests/test_kosh_context_manager.py +11 -0
  24. kosh-3.6/tests/test_kosh_mcp_operations.py +1579 -0
  25. kosh-3.4/kosh/current_version.py +0 -1
  26. kosh-3.4/kosh.egg-info/entry_points.txt +0 -3
  27. {kosh-3.4 → kosh-3.6}/LICENSE +0 -0
  28. {kosh-3.4 → kosh-3.6}/NOTICE +0 -0
  29. {kosh-3.4 → kosh-3.6}/docs/gen_api_docs.py +0 -0
  30. {kosh-3.4 → kosh-3.6}/docs/source/conf.py +0 -0
  31. {kosh-3.4 → kosh-3.6}/examples/cluster.py +0 -0
  32. {kosh-3.4 → kosh-3.6}/examples/some_user_io_functions.py +0 -0
  33. {kosh-3.4 → kosh-3.6}/kosh/__init__.py +0 -0
  34. {kosh-3.4 → kosh-3.6}/kosh/_version.py +0 -0
  35. {kosh-3.4 → kosh-3.6}/kosh/cli.py +0 -0
  36. {kosh-3.4 → kosh-3.6}/kosh/core_sina.py +0 -0
  37. {kosh-3.4 → kosh-3.6}/kosh/exec_graphs/__init__.py +0 -0
  38. {kosh-3.4 → kosh-3.6}/kosh/exec_graphs/core.py +0 -0
  39. {kosh-3.4 → kosh-3.6}/kosh/kosh_command.py +0 -0
  40. {kosh-3.4 → kosh-3.6}/kosh/loaders/UltraLoader.py +0 -0
  41. {kosh-3.4 → kosh-3.6}/kosh/loaders/__init__.py +0 -0
  42. {kosh-3.4 → kosh-3.6}/kosh/loaders/core.py +0 -0
  43. {kosh-3.4 → kosh-3.6}/kosh/loaders/hdf5.py +0 -0
  44. {kosh-3.4 → kosh-3.6}/kosh/loaders/jsons.py +0 -0
  45. {kosh-3.4 → kosh-3.6}/kosh/loaders/npy.py +0 -0
  46. {kosh-3.4 → kosh-3.6}/kosh/loaders/pandas_loader.py +0 -0
  47. {kosh-3.4 → kosh-3.6}/kosh/loaders/pgm.py +0 -0
  48. {kosh-3.4 → kosh-3.6}/kosh/loaders/pil.py +0 -0
  49. {kosh-3.4 → kosh-3.6}/kosh/loaders/sidre.py +0 -0
  50. {kosh-3.4 → kosh-3.6}/kosh/lock_strategies.py +0 -0
  51. {kosh-3.4 → kosh-3.6}/kosh/operators/__init__.py +0 -0
  52. {kosh-3.4 → kosh-3.6}/kosh/operators/core.py +0 -0
  53. {kosh-3.4 → kosh-3.6}/kosh/operators/koshClustering.py +0 -0
  54. {kosh-3.4 → kosh-3.6}/kosh/operators/koshMaths.py +0 -0
  55. {kosh-3.4 → kosh-3.6}/kosh/parameter_store.py +0 -0
  56. {kosh-3.4 → kosh-3.6}/kosh/sampling_methods/__init__.py +0 -0
  57. {kosh-3.4 → kosh-3.6}/kosh/sampling_methods/cluster_sampling/Clustering.py +0 -0
  58. {kosh-3.4 → kosh-3.6}/kosh/sampling_methods/cluster_sampling/__init__.py +0 -0
  59. {kosh-3.4 → kosh-3.6}/kosh/schema.py +0 -0
  60. {kosh-3.4 → kosh-3.6}/kosh/skills/kosh/SKILL.md +0 -0
  61. {kosh-3.4 → kosh-3.6}/kosh/skills/kosh/agents/openai.yaml +0 -0
  62. {kosh-3.4 → kosh-3.6}/kosh/threadsafe.py +0 -0
  63. {kosh-3.4 → kosh-3.6}/kosh/threadsafe_decorators.py +0 -0
  64. {kosh-3.4 → kosh-3.6}/kosh/transformers/__init__.py +0 -0
  65. {kosh-3.4 → kosh-3.6}/kosh/transformers/core.py +0 -0
  66. {kosh-3.4 → kosh-3.6}/kosh/transformers/npy.py +0 -0
  67. {kosh-3.4 → kosh-3.6}/kosh/transformers/sidre.py +0 -0
  68. {kosh-3.4 → kosh-3.6}/kosh/transformers/skl.py +0 -0
  69. {kosh-3.4 → kosh-3.6}/kosh/transformers/utils.py +0 -0
  70. {kosh-3.4 → kosh-3.6}/kosh/workflow.py +0 -0
  71. {kosh-3.4 → kosh-3.6}/kosh/wrapper.py +0 -0
  72. {kosh-3.4 → kosh-3.6}/kosh.egg-info/dependency_links.txt +0 -0
  73. {kosh-3.4 → kosh-3.6}/scripts/render_logos.py +0 -0
  74. {kosh-3.4 → kosh-3.6}/scripts/sbang +0 -0
  75. {kosh-3.4 → kosh-3.6}/setup.cfg +0 -0
  76. {kosh-3.4 → kosh-3.6}/setup.py +0 -0
  77. {kosh-3.4 → kosh-3.6}/tests/baselines/npy/gen.py +0 -0
  78. {kosh-3.4 → kosh-3.6}/tests/baselines/scripts/dummy.py +0 -0
  79. {kosh-3.4 → kosh-3.6}/tests/conftest.py +0 -0
  80. {kosh-3.4 → kosh-3.6}/tests/kosh_scaling.py +0 -0
  81. {kosh-3.4 → kosh-3.6}/tests/koshbase.py +0 -0
  82. {kosh-3.4 → kosh-3.6}/tests/non_parallel/test_kosh_cp.py +0 -0
  83. {kosh-3.4 → kosh-3.6}/tests/parallel/kosh_scaling.py +0 -0
  84. {kosh-3.4 → kosh-3.6}/tests/parallel/kosh_scaling_pgen.py +0 -0
  85. {kosh-3.4 → kosh-3.6}/tests/parallel/test_kosh_clustering.py +0 -0
  86. {kosh-3.4 → kosh-3.6}/tests/parallel/test_kosh_clustering_raw.py +0 -0
  87. {kosh-3.4 → kosh-3.6}/tests/parallel/test_kosh_mariadb_mpi.py +0 -0
  88. {kosh-3.4 → kosh-3.6}/tests/parallel/test_kosh_scaling_parallel.py +0 -0
  89. {kosh-3.4 → kosh-3.6}/tests/test_kosh_aliases.py +0 -0
  90. {kosh-3.4 → kosh-3.6}/tests/test_kosh_broken_loader.py +0 -0
  91. {kosh-3.4 → kosh-3.6}/tests/test_kosh_command_line.py +0 -0
  92. {kosh-3.4 → kosh-3.6}/tests/test_kosh_curves.py +0 -0
  93. {kosh-3.4 → kosh-3.6}/tests/test_kosh_datasets.py +0 -0
  94. {kosh-3.4 → kosh-3.6}/tests/test_kosh_describe_feature.py +0 -0
  95. {kosh-3.4 → kosh-3.6}/tests/test_kosh_ensembles.py +0 -0
  96. {kosh-3.4 → kosh-3.6}/tests/test_kosh_ensembles_cp.py +0 -0
  97. {kosh-3.4 → kosh-3.6}/tests/test_kosh_fast_load.py +0 -0
  98. {kosh-3.4 → kosh-3.6}/tests/test_kosh_fix_fastsha.py +0 -0
  99. {kosh-3.4 → kosh-3.6}/tests/test_kosh_flake8.py +0 -0
  100. {kosh-3.4 → kosh-3.6}/tests/test_kosh_getitem_back_propagate.py +0 -0
  101. {kosh-3.4 → kosh-3.6}/tests/test_kosh_import_export_datasets.py +0 -0
  102. {kosh-3.4 → kosh-3.6}/tests/test_kosh_list_features.py +0 -0
  103. {kosh-3.4 → kosh-3.6}/tests/test_kosh_load_sina.py +0 -0
  104. {kosh-3.4 → kosh-3.6}/tests/test_kosh_loaders.py +0 -0
  105. {kosh-3.4 → kosh-3.6}/tests/test_kosh_loaders_multiple_features_name.py +0 -0
  106. {kosh-3.4 → kosh-3.6}/tests/test_kosh_lot_big_curves.py +0 -0
  107. {kosh-3.4 → kosh-3.6}/tests/test_kosh_mv.py +0 -0
  108. {kosh-3.4 → kosh-3.6}/tests/test_kosh_operators.py +0 -0
  109. {kosh-3.4 → kosh-3.6}/tests/test_kosh_operators_chain_preprocess.py +0 -0
  110. {kosh-3.4 → kosh-3.6}/tests/test_kosh_operators_decorators.py +0 -0
  111. {kosh-3.4 → kosh-3.6}/tests/test_kosh_parameter_store.py +0 -0
  112. {kosh-3.4 → kosh-3.6}/tests/test_kosh_protected_attributes.py +0 -0
  113. {kosh-3.4 → kosh-3.6}/tests/test_kosh_reassociate.py +0 -0
  114. {kosh-3.4 → kosh-3.6}/tests/test_kosh_rm.py +0 -0
  115. {kosh-3.4 → kosh-3.6}/tests/test_kosh_scaling.py +0 -0
  116. {kosh-3.4 → kosh-3.6}/tests/test_kosh_schema.py +0 -0
  117. {kosh-3.4 → kosh-3.6}/tests/test_kosh_script_wrapper.py +0 -0
  118. {kosh-3.4 → kosh-3.6}/tests/test_kosh_search.py +0 -0
  119. {kosh-3.4 → kosh-3.6}/tests/test_kosh_search_speed.py +0 -0
  120. {kosh-3.4 → kosh-3.6}/tests/test_kosh_sina_curves_as_associated.py +0 -0
  121. {kosh-3.4 → kosh-3.6}/tests/test_kosh_sina_files_section_as_associated.py +0 -0
  122. {kosh-3.4 → kosh-3.6}/tests/test_kosh_sina_section_for_kosh.py +0 -0
  123. {kosh-3.4 → kosh-3.6}/tests/test_kosh_skill.py +0 -0
  124. {kosh-3.4 → kosh-3.6}/tests/test_kosh_skill_codex_smoke.py +0 -0
  125. {kosh-3.4 → kosh-3.6}/tests/test_kosh_special_sina_types.py +0 -0
  126. {kosh-3.4 → kosh-3.6}/tests/test_kosh_store.py +0 -0
  127. {kosh-3.4 → kosh-3.6}/tests/test_kosh_store_custom_loaders.py +0 -0
  128. {kosh-3.4 → kosh-3.6}/tests/test_kosh_store_mv_cp_tar.py +0 -0
  129. {kosh-3.4 → kosh-3.6}/tests/test_kosh_sync.py +0 -0
  130. {kosh-3.4 → kosh-3.6}/tests/test_kosh_transformers.py +0 -0
  131. {kosh-3.4 → kosh-3.6}/tests/test_kosh_transformers_decorators.py +0 -0
  132. {kosh-3.4 → kosh-3.6}/tests/test_kosh_transformers_parent.py +0 -0
  133. {kosh-3.4 → kosh-3.6}/tests/test_kosh_users_and_groups.py +0 -0
  134. {kosh-3.4 → kosh-3.6}/tests/test_kosh_verbose_list_features.py +0 -0
  135. {kosh-3.4 → kosh-3.6}/tests/test_kosh_workflow_cli.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kosh
3
- Version: 3.4
3
+ Version: 3.6
4
4
  Summary: Manages Data Store with External Bulk Data
5
5
  Author: Charles Doutriaux, Renee Olson
6
6
  License: MIT
@@ -20,6 +20,9 @@ Requires-Dist: pandas
20
20
  Requires-Dist: hdbscan
21
21
  Requires-Dist: matplotlib
22
22
  Requires-Dist: tqdm
23
+ Provides-Extra: mcp
24
+ Requires-Dist: mada; extra == "mcp"
25
+ Requires-Dist: mada-tools; extra == "mcp"
23
26
  Dynamic: license-file
24
27
 
25
28
  ![Kosh Logo](share/icons/png/Kosh_Logo_Blue.png)
@@ -59,6 +62,9 @@ For more details look into the [installation doc](INSTALL.md)
59
62
 
60
63
  If you want to use Kosh through Codex, see [the Codex skill install guide](docs/codex_skill.md).
61
64
 
65
+ If you want to use Kosh from a MADA agent or another MCP-compatible client,
66
+ see the [Kosh MCP server guide](docs/source/users/mcp_server.md).
67
+
62
68
  # First steps
63
69
 
64
70
  See [this file](docs/source/users/index.md)
@@ -35,6 +35,9 @@ For more details look into the [installation doc](INSTALL.md)
35
35
 
36
36
  If you want to use Kosh through Codex, see [the Codex skill install guide](docs/codex_skill.md).
37
37
 
38
+ If you want to use Kosh from a MADA agent or another MCP-compatible client,
39
+ see the [Kosh MCP server guide](docs/source/users/mcp_server.md).
40
+
38
41
  # First steps
39
42
 
40
43
  See [this file](docs/source/users/index.md)
@@ -0,0 +1 @@
1
+ current_version = "3.6"
@@ -1463,7 +1463,7 @@ class KoshDataset(KoshSinaObject):
1463
1463
  return attributes
1464
1464
 
1465
1465
  @lock_strategies.lock_method
1466
- def to_dataframe(self, data_columns=[], *atts, **keys):
1466
+ def to_dataframe(self, data_columns=[], typed_columns=None, *atts, **keys):
1467
1467
  """Return the find object as a Pandas DataFrame.
1468
1468
 
1469
1469
  Pass in the same arguments and keyword arguments as the find method.
@@ -1482,6 +1482,39 @@ class KoshDataset(KoshSinaObject):
1482
1482
  :param data_columns: Columns to extract. By default this will include ['id', 'mime_type', 'uri', 'associated'].
1483
1483
  If nothing is passed, will return all data.
1484
1484
  :type data_columns: Union(str, list), optional
1485
+ :param typed_columns: Dictionary of column types and replacement values.
1486
+ If omitted, MySQL defaults are returned.
1487
+
1488
+ Supported types:
1489
+ [
1490
+ "Int8", "Int16", "Int32", "Int64",
1491
+ "UInt8", "UInt16", "UInt32", "UInt64",
1492
+ "float16", "float32", "float64",
1493
+ "Float32", "Float64",
1494
+ "bool", "boolean", "string", "object",
1495
+ "category", "datetime64[ns]", "timedelta64[ns]",
1496
+ ]
1497
+
1498
+ Example:
1499
+ {
1500
+ "my_int": {
1501
+ "type": "Int64",
1502
+ "replace": {None: 42},
1503
+ },
1504
+ "my_float": {
1505
+ "type": "float64",
1506
+ "replace": {None: np.nan, 999: -1},
1507
+ },
1508
+ "my_boolean": {
1509
+ "type": "boolean",
1510
+ "replace": {None: False},
1511
+ },
1512
+ "my_string": {
1513
+ "type": "string",
1514
+ "replace": {"This is empty": "Nothing Here"},
1515
+ },
1516
+ }
1517
+ :type typed_columns: dict, optional
1485
1518
  :return: Pandas DataFrame
1486
1519
  :rtype: Pandas DataFrame
1487
1520
  """
@@ -1522,4 +1555,14 @@ class KoshDataset(KoshSinaObject):
1522
1555
  attr_dict[column][i] = source['data'].get(column, {}).get('value', pd.NA)
1523
1556
 
1524
1557
  df = pd.DataFrame(attr_dict)
1558
+
1559
+ if isinstance(typed_columns, dict):
1560
+ for key, config in typed_columns.items():
1561
+ series = df[key]
1562
+
1563
+ if "replace" in config:
1564
+ series = series.replace(config["replace"]).infer_objects(copy=False)
1565
+
1566
+ df[key] = series.astype(config["type"])
1567
+
1525
1568
  return df
@@ -337,7 +337,7 @@ These datasets will inherit attributes and associated sources from the ensemble.
337
337
 
338
338
  @lock_strategies.lock_method
339
339
  def to_dataframe(self, data_columns=[], include_ensemble_attributes=True, include_ensemble_tags=True,
340
- *atts, **keys):
340
+ typed_columns=None, *atts, **keys):
341
341
  """Return the find_datasets object as a Pandas DataFrame.
342
342
 
343
343
  Pass in the same arguments and keyword arguments as the find method.
@@ -362,6 +362,39 @@ These datasets will inherit attributes and associated sources from the ensemble.
362
362
  :type include_ensemble_attributes: bool, optional
363
363
  :param include_ensemble_tags: Include ensemble tags in DataFrame.
364
364
  :type include_ensemble_tags: bool, optional
365
+ :param typed_columns: Dictionary of column types and replacement values.
366
+ If omitted, MySQL defaults are returned.
367
+
368
+ Supported types:
369
+ [
370
+ "Int8", "Int16", "Int32", "Int64",
371
+ "UInt8", "UInt16", "UInt32", "UInt64",
372
+ "float16", "float32", "float64",
373
+ "Float32", "Float64",
374
+ "bool", "boolean", "string", "object",
375
+ "category", "datetime64[ns]", "timedelta64[ns]",
376
+ ]
377
+
378
+ Example:
379
+ {
380
+ "my_int": {
381
+ "type": "Int64",
382
+ "replace": {None: 42},
383
+ },
384
+ "my_float": {
385
+ "type": "float64",
386
+ "replace": {None: np.nan, 999: -1},
387
+ },
388
+ "my_boolean": {
389
+ "type": "boolean",
390
+ "replace": {None: False},
391
+ },
392
+ "my_string": {
393
+ "type": "string",
394
+ "replace": {"This is empty": "Nothing Here"},
395
+ },
396
+ }
397
+ :type typed_columns: dict, optional
365
398
  :return: Pandas DataFrame
366
399
  :rtype: Pandas DataFrame
367
400
  """
@@ -425,4 +458,14 @@ These datasets will inherit attributes and associated sources from the ensemble.
425
458
  attr_dict[f"{self.id}_ENSEMBLE_ATTRIBUTE_{key}"] = [val] * total_datasets
426
459
 
427
460
  df = pd.DataFrame(attr_dict)
461
+
462
+ if isinstance(typed_columns, dict):
463
+ for key, config in typed_columns.items():
464
+ series = df[key]
465
+
466
+ if "replace" in config:
467
+ series = series.replace(config["replace"]).infer_objects(copy=False)
468
+
469
+ df[key] = series.astype(config["type"])
470
+
428
471
  return df
@@ -0,0 +1,33 @@
1
+ """MADA extension manifest for Kosh-provided MCP servers."""
2
+
3
+ from kosh.current_version import current_version
4
+
5
+
6
+ def get_extension_manifest():
7
+ """Return the MADA extension manifest for Kosh.
8
+
9
+ :returns: The Kosh extension manifest with its MCP server registration.
10
+ :raises RuntimeError: If the optional ``kosh[mcp]`` dependencies are not
11
+ installed.
12
+ """
13
+ try:
14
+ from mada_tools.extensions import ExtensionManifest, MCPServerRegistration
15
+ except ImportError as e:
16
+ raise RuntimeError(
17
+ "Kosh MADA extension discovery requires the optional 'mcp' extra. "
18
+ "Install it with: pip install 'kosh[mcp]'"
19
+ ) from e
20
+
21
+ return ExtensionManifest(
22
+ display_name="Kosh",
23
+ version=current_version,
24
+ provider_package="kosh",
25
+ mcp_servers=(
26
+ MCPServerRegistration(
27
+ name="kosh",
28
+ module_path="kosh.mcp_server.server",
29
+ package="kosh",
30
+ description="MCP server for Kosh data management.",
31
+ ),
32
+ ),
33
+ )
File without changes