humalab 0.0.1__tar.gz → 0.0.3__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.
Potentially problematic release.
This version of humalab might be problematic. Click here for more details.
- {humalab-0.0.1/humalab.egg-info → humalab-0.0.3}/PKG-INFO +1 -1
- humalab-0.0.3/VERSION +1 -0
- humalab-0.0.3/humalab/__init__.py +9 -0
- {humalab-0.0.1 → humalab-0.0.3}/humalab/assets/resource_handler.py +1 -1
- {humalab-0.0.1 → humalab-0.0.3}/humalab/dists/bernoulli.py +1 -1
- {humalab-0.0.1 → humalab-0.0.3}/humalab/dists/categorical.py +1 -1
- {humalab-0.0.1 → humalab-0.0.3}/humalab/dists/discrete.py +1 -1
- {humalab-0.0.1 → humalab-0.0.3}/humalab/dists/gaussian.py +1 -1
- {humalab-0.0.1 → humalab-0.0.3}/humalab/dists/log_uniform.py +1 -1
- {humalab-0.0.1 → humalab-0.0.3}/humalab/dists/truncated_gaussian.py +1 -1
- {humalab-0.0.1 → humalab-0.0.3}/humalab/dists/uniform.py +1 -1
- {humalab-0.0.1 → humalab-0.0.3}/humalab/humalab.py +5 -5
- {humalab-0.0.1 → humalab-0.0.3}/humalab/humalab_test.py +42 -42
- {humalab-0.0.1 → humalab-0.0.3}/humalab/metrics/dist_metric.py +1 -1
- {humalab-0.0.1 → humalab-0.0.3}/humalab/metrics/metric.py +1 -1
- {humalab-0.0.1 → humalab-0.0.3}/humalab/metrics/summary.py +2 -2
- {humalab-0.0.1 → humalab-0.0.3}/humalab/run.py +5 -5
- {humalab-0.0.1 → humalab-0.0.3}/humalab/scenario.py +10 -10
- {humalab-0.0.1 → humalab-0.0.3}/humalab/scenario_test.py +1 -1
- {humalab-0.0.1 → humalab-0.0.3/humalab.egg-info}/PKG-INFO +1 -1
- {humalab-0.0.1 → humalab-0.0.3}/humalab.egg-info/SOURCES.txt +3 -0
- {humalab-0.0.1 → humalab-0.0.3}/pyproject.toml +5 -16
- humalab-0.0.3/requirements-dev.txt +5 -0
- humalab-0.0.3/requirements.txt +4 -0
- {humalab-0.0.1 → humalab-0.0.3}/setup.py +11 -17
- humalab-0.0.1/humalab/__init__.py +0 -9
- {humalab-0.0.1 → humalab-0.0.3}/.gitignore +0 -0
- {humalab-0.0.1 → humalab-0.0.3}/LICENSE +0 -0
- {humalab-0.0.1 → humalab-0.0.3}/README.md +0 -0
- {humalab-0.0.1 → humalab-0.0.3}/humalab/assets/__init__.py +0 -0
- {humalab-0.0.1 → humalab-0.0.3}/humalab/assets/archive.py +0 -0
- {humalab-0.0.1 → humalab-0.0.3}/humalab/assets/resource_file.py +0 -0
- {humalab-0.0.1 → humalab-0.0.3}/humalab/constants.py +0 -0
- {humalab-0.0.1 → humalab-0.0.3}/humalab/dists/__init__.py +0 -0
- {humalab-0.0.1 → humalab-0.0.3}/humalab/dists/distribution.py +0 -0
- {humalab-0.0.1 → humalab-0.0.3}/humalab/humalab_api_client.py +0 -0
- {humalab-0.0.1 → humalab-0.0.3}/humalab/humalab_config.py +0 -0
- {humalab-0.0.1 → humalab-0.0.3}/humalab/metrics/__init__.py +0 -0
- {humalab-0.0.1 → humalab-0.0.3}/humalab.egg-info/dependency_links.txt +0 -0
- {humalab-0.0.1 → humalab-0.0.3}/humalab.egg-info/entry_points.txt +0 -0
- {humalab-0.0.1 → humalab-0.0.3}/humalab.egg-info/not-zip-safe +0 -0
- {humalab-0.0.1 → humalab-0.0.3}/humalab.egg-info/requires.txt +0 -0
- {humalab-0.0.1 → humalab-0.0.3}/humalab.egg-info/top_level.txt +0 -0
- {humalab-0.0.1 → humalab-0.0.3}/setup.cfg +0 -0
humalab-0.0.3/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.0.3
|
|
@@ -8,7 +8,7 @@ from humalab_service.humalab_host import HumaLabHost
|
|
|
8
8
|
from humalab_service.services.stores.obj_store import ObjStore
|
|
9
9
|
from humalab_service.services.stores.namespace import ObjectType
|
|
10
10
|
from humalab_service.db.resource import ResourceDocument
|
|
11
|
-
from
|
|
11
|
+
from humalab.assets.archive import extract_archive
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
ASSET_TYPE_TO_EXTENSIONS = {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
from contextlib import contextmanager
|
|
2
|
-
from
|
|
3
|
-
from
|
|
4
|
-
from
|
|
5
|
-
from
|
|
2
|
+
from humalab.run import Run
|
|
3
|
+
from humalab.humalab_config import HumalabConfig
|
|
4
|
+
from humalab.humalab_api_client import HumaLabApiClient
|
|
5
|
+
from humalab.constants import EpisodeStatus
|
|
6
6
|
|
|
7
7
|
import uuid
|
|
8
8
|
import os
|
|
9
9
|
|
|
10
10
|
from collections.abc import Generator
|
|
11
11
|
|
|
12
|
-
from
|
|
12
|
+
from humalab.scenario import Scenario
|
|
13
13
|
|
|
14
14
|
_cur_run: Run | None = None
|
|
15
15
|
|
|
@@ -2,12 +2,12 @@ import unittest
|
|
|
2
2
|
from unittest.mock import patch, MagicMock, Mock
|
|
3
3
|
import uuid
|
|
4
4
|
|
|
5
|
-
from
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
10
|
-
from
|
|
5
|
+
from humalab import humalab
|
|
6
|
+
from humalab.run import Run
|
|
7
|
+
from humalab.scenario import Scenario
|
|
8
|
+
from humalab.humalab_config import HumalabConfig
|
|
9
|
+
from humalab.humalab_api_client import HumaLabApiClient
|
|
10
|
+
from humalab.constants import EpisodeStatus
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class HumalabTest(unittest.TestCase):
|
|
@@ -71,10 +71,10 @@ class HumalabTest(unittest.TestCase):
|
|
|
71
71
|
|
|
72
72
|
# Tests for init context manager
|
|
73
73
|
|
|
74
|
-
@patch('
|
|
75
|
-
@patch('
|
|
76
|
-
@patch('
|
|
77
|
-
@patch('
|
|
74
|
+
@patch('humalab.humalab.HumaLabApiClient')
|
|
75
|
+
@patch('humalab.humalab.HumalabConfig')
|
|
76
|
+
@patch('humalab.humalab.Scenario')
|
|
77
|
+
@patch('humalab.humalab.Run')
|
|
78
78
|
def test_init_should_create_run_with_provided_parameters(self, mock_run_class, mock_scenario_class, mock_config_class, mock_api_client_class):
|
|
79
79
|
"""Test that init() creates a Run with provided parameters."""
|
|
80
80
|
# Pre-condition
|
|
@@ -127,10 +127,10 @@ class HumalabTest(unittest.TestCase):
|
|
|
127
127
|
# Verify finish was called
|
|
128
128
|
mock_run_inst.finish.assert_called_once()
|
|
129
129
|
|
|
130
|
-
@patch('
|
|
131
|
-
@patch('
|
|
132
|
-
@patch('
|
|
133
|
-
@patch('
|
|
130
|
+
@patch('humalab.humalab.HumaLabApiClient')
|
|
131
|
+
@patch('humalab.humalab.HumalabConfig')
|
|
132
|
+
@patch('humalab.humalab.Scenario')
|
|
133
|
+
@patch('humalab.humalab.Run')
|
|
134
134
|
def test_init_should_use_config_defaults_when_parameters_not_provided(self, mock_run_class, mock_scenario_class, mock_config_class, mock_api_client_class):
|
|
135
135
|
"""Test that init() uses config defaults when parameters are not provided."""
|
|
136
136
|
# Pre-condition
|
|
@@ -163,10 +163,10 @@ class HumalabTest(unittest.TestCase):
|
|
|
163
163
|
|
|
164
164
|
mock_run_inst.finish.assert_called_once()
|
|
165
165
|
|
|
166
|
-
@patch('
|
|
167
|
-
@patch('
|
|
168
|
-
@patch('
|
|
169
|
-
@patch('
|
|
166
|
+
@patch('humalab.humalab.HumaLabApiClient')
|
|
167
|
+
@patch('humalab.humalab.HumalabConfig')
|
|
168
|
+
@patch('humalab.humalab.Scenario')
|
|
169
|
+
@patch('humalab.humalab.Run')
|
|
170
170
|
def test_init_should_generate_uuid_when_id_not_provided(self, mock_run_class, mock_scenario_class, mock_config_class, mock_api_client_class):
|
|
171
171
|
"""Test that init() generates a UUID when id is not provided."""
|
|
172
172
|
# Pre-condition
|
|
@@ -196,10 +196,10 @@ class HumalabTest(unittest.TestCase):
|
|
|
196
196
|
|
|
197
197
|
mock_run_inst.finish.assert_called_once()
|
|
198
198
|
|
|
199
|
-
@patch('
|
|
200
|
-
@patch('
|
|
201
|
-
@patch('
|
|
202
|
-
@patch('
|
|
199
|
+
@patch('humalab.humalab.HumaLabApiClient')
|
|
200
|
+
@patch('humalab.humalab.HumalabConfig')
|
|
201
|
+
@patch('humalab.humalab.Scenario')
|
|
202
|
+
@patch('humalab.humalab.Run')
|
|
203
203
|
def test_init_should_initialize_scenario_with_seed(self, mock_run_class, mock_scenario_class, mock_config_class, mock_api_client_class):
|
|
204
204
|
"""Test that init() initializes scenario with provided seed."""
|
|
205
205
|
# Pre-condition
|
|
@@ -232,10 +232,10 @@ class HumalabTest(unittest.TestCase):
|
|
|
232
232
|
|
|
233
233
|
mock_run_inst.finish.assert_called_once()
|
|
234
234
|
|
|
235
|
-
@patch('
|
|
236
|
-
@patch('
|
|
237
|
-
@patch('
|
|
238
|
-
@patch('
|
|
235
|
+
@patch('humalab.humalab.HumaLabApiClient')
|
|
236
|
+
@patch('humalab.humalab.HumalabConfig')
|
|
237
|
+
@patch('humalab.humalab.Scenario')
|
|
238
|
+
@patch('humalab.humalab.Run')
|
|
239
239
|
def test_init_should_pull_scenario_from_api_when_scenario_id_provided(self, mock_run_class, mock_scenario_class, mock_config_class, mock_api_client_class):
|
|
240
240
|
"""Test that init() pulls scenario from API when scenario_id is provided."""
|
|
241
241
|
# Pre-condition
|
|
@@ -269,10 +269,10 @@ class HumalabTest(unittest.TestCase):
|
|
|
269
269
|
|
|
270
270
|
mock_run_inst.finish.assert_called_once()
|
|
271
271
|
|
|
272
|
-
@patch('
|
|
273
|
-
@patch('
|
|
274
|
-
@patch('
|
|
275
|
-
@patch('
|
|
272
|
+
@patch('humalab.humalab.HumaLabApiClient')
|
|
273
|
+
@patch('humalab.humalab.HumalabConfig')
|
|
274
|
+
@patch('humalab.humalab.Scenario')
|
|
275
|
+
@patch('humalab.humalab.Run')
|
|
276
276
|
def test_init_should_set_global_cur_run(self, mock_run_class, mock_scenario_class, mock_config_class, mock_api_client_class):
|
|
277
277
|
"""Test that init() sets the global _cur_run variable."""
|
|
278
278
|
# Pre-condition
|
|
@@ -300,10 +300,10 @@ class HumalabTest(unittest.TestCase):
|
|
|
300
300
|
|
|
301
301
|
mock_run_inst.finish.assert_called_once()
|
|
302
302
|
|
|
303
|
-
@patch('
|
|
304
|
-
@patch('
|
|
305
|
-
@patch('
|
|
306
|
-
@patch('
|
|
303
|
+
@patch('humalab.humalab.HumaLabApiClient')
|
|
304
|
+
@patch('humalab.humalab.HumalabConfig')
|
|
305
|
+
@patch('humalab.humalab.Scenario')
|
|
306
|
+
@patch('humalab.humalab.Run')
|
|
307
307
|
def test_init_should_call_finish_on_exception(self, mock_run_class, mock_scenario_class, mock_config_class, mock_api_client_class):
|
|
308
308
|
"""Test that init() calls finish even when exception occurs in context."""
|
|
309
309
|
# Pre-condition
|
|
@@ -331,10 +331,10 @@ class HumalabTest(unittest.TestCase):
|
|
|
331
331
|
# Verify finish was still called
|
|
332
332
|
mock_run_inst.finish.assert_called_once()
|
|
333
333
|
|
|
334
|
-
@patch('
|
|
335
|
-
@patch('
|
|
336
|
-
@patch('
|
|
337
|
-
@patch('
|
|
334
|
+
@patch('humalab.humalab.HumaLabApiClient')
|
|
335
|
+
@patch('humalab.humalab.HumalabConfig')
|
|
336
|
+
@patch('humalab.humalab.Scenario')
|
|
337
|
+
@patch('humalab.humalab.Run')
|
|
338
338
|
def test_init_should_create_api_client_with_custom_parameters(self, mock_run_class, mock_scenario_class, mock_config_class, mock_api_client_class):
|
|
339
339
|
"""Test that init() creates API client with custom base_url, api_key, and timeout."""
|
|
340
340
|
# Pre-condition
|
|
@@ -423,7 +423,7 @@ class HumalabTest(unittest.TestCase):
|
|
|
423
423
|
|
|
424
424
|
# Tests for login function
|
|
425
425
|
|
|
426
|
-
@patch('
|
|
426
|
+
@patch('humalab.humalab.HumalabConfig')
|
|
427
427
|
def test_login_should_set_api_key_when_provided(self, mock_config_class):
|
|
428
428
|
"""Test that login() sets the api_key when provided."""
|
|
429
429
|
# Pre-condition
|
|
@@ -442,7 +442,7 @@ class HumalabTest(unittest.TestCase):
|
|
|
442
442
|
self.assertTrue(result)
|
|
443
443
|
self.assertEqual(mock_config.api_key, new_key)
|
|
444
444
|
|
|
445
|
-
@patch('
|
|
445
|
+
@patch('humalab.humalab.HumalabConfig')
|
|
446
446
|
def test_login_should_keep_existing_key_when_not_provided(self, mock_config_class):
|
|
447
447
|
"""Test that login() keeps existing api_key when key is not provided."""
|
|
448
448
|
# Pre-condition
|
|
@@ -464,7 +464,7 @@ class HumalabTest(unittest.TestCase):
|
|
|
464
464
|
self.assertEqual(mock_config.base_url, existing_url)
|
|
465
465
|
self.assertEqual(mock_config.timeout, existing_timeout)
|
|
466
466
|
|
|
467
|
-
@patch('
|
|
467
|
+
@patch('humalab.humalab.HumalabConfig')
|
|
468
468
|
def test_login_should_return_true(self, mock_config_class):
|
|
469
469
|
"""Test that login() always returns True."""
|
|
470
470
|
# Pre-condition
|
|
@@ -480,7 +480,7 @@ class HumalabTest(unittest.TestCase):
|
|
|
480
480
|
# Post-condition
|
|
481
481
|
self.assertTrue(result)
|
|
482
482
|
|
|
483
|
-
@patch('
|
|
483
|
+
@patch('humalab.humalab.HumalabConfig')
|
|
484
484
|
def test_login_should_accept_optional_parameters(self, mock_config_class):
|
|
485
485
|
"""Test that login() accepts optional parameters without errors."""
|
|
486
486
|
# Pre-condition
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
from
|
|
3
|
-
from
|
|
2
|
+
from humalab.metrics.metric import MetricGranularity, Metrics, MetricType
|
|
3
|
+
from humalab.constants import EpisodeStatus
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class Summary(Metrics):
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import uuid
|
|
2
|
-
from
|
|
3
|
-
from
|
|
4
|
-
from
|
|
2
|
+
from humalab.metrics.dist_metric import DistributionMetric
|
|
3
|
+
from humalab.metrics.metric import MetricGranularity, MetricType, Metrics
|
|
4
|
+
from humalab.constants import EpisodeStatus
|
|
5
5
|
|
|
6
|
-
from
|
|
7
|
-
from
|
|
6
|
+
from humalab.metrics.summary import Summary
|
|
7
|
+
from humalab.scenario import Scenario
|
|
8
8
|
|
|
9
9
|
class Run:
|
|
10
10
|
def __init__(self,
|
|
@@ -2,17 +2,17 @@ from typing import Any
|
|
|
2
2
|
import numpy as np
|
|
3
3
|
from omegaconf import OmegaConf, ListConfig, AnyNode, DictConfig
|
|
4
4
|
import yaml
|
|
5
|
-
from
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
10
|
-
from
|
|
11
|
-
from
|
|
5
|
+
from humalab.dists.bernoulli import Bernoulli
|
|
6
|
+
from humalab.dists.categorical import Categorical
|
|
7
|
+
from humalab.dists.uniform import Uniform
|
|
8
|
+
from humalab.dists.discrete import Discrete
|
|
9
|
+
from humalab.dists.log_uniform import LogUniform
|
|
10
|
+
from humalab.dists.gaussian import Gaussian
|
|
11
|
+
from humalab.dists.truncated_gaussian import TruncatedGaussian
|
|
12
12
|
from functools import partial
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
13
|
+
from humalab.constants import EpisodeStatus
|
|
14
|
+
from humalab.metrics.dist_metric import DistributionMetric
|
|
15
|
+
from humalab.metrics.metric import MetricGranularity
|
|
16
16
|
import copy
|
|
17
17
|
import uuid
|
|
18
18
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "humalab"
|
|
7
|
-
|
|
7
|
+
dynamic = ["version", "dependencies", "optional-dependencies"]
|
|
8
8
|
description = "Python SDK for HumaLab - A platform for adaptive AI validation."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
@@ -25,21 +25,10 @@ classifiers = [
|
|
|
25
25
|
"Programming Language :: Python :: 3.10",
|
|
26
26
|
"Programming Language :: Python :: 3.11",
|
|
27
27
|
]
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"pyyaml>=5.4.0",
|
|
33
|
-
]
|
|
34
|
-
|
|
35
|
-
[project.optional-dependencies]
|
|
36
|
-
dev = [
|
|
37
|
-
"pytest>=6.0.0",
|
|
38
|
-
"pytest-cov>=2.10.0",
|
|
39
|
-
"black>=21.0",
|
|
40
|
-
"flake8>=3.9.0",
|
|
41
|
-
"mypy>=0.910",
|
|
42
|
-
]
|
|
28
|
+
[tool.setuptools.dynamic]
|
|
29
|
+
version = {file = "VERSION"}
|
|
30
|
+
dependencies = {file = ["requirements.txt"]}
|
|
31
|
+
optional-dependencies.dev = {file = ["requirements-dev.txt"]}
|
|
43
32
|
|
|
44
33
|
[project.urls]
|
|
45
34
|
Homepage = "https://github.com/humalab/humalab_sdk"
|
|
@@ -8,15 +8,12 @@ the package to be installed via pip.
|
|
|
8
8
|
from setuptools import setup, find_packages
|
|
9
9
|
import os
|
|
10
10
|
|
|
11
|
-
# Read version from
|
|
11
|
+
# Read version from VERSION file
|
|
12
12
|
version = "0.0.1"
|
|
13
|
-
|
|
14
|
-
if os.path.exists(
|
|
15
|
-
with open(
|
|
16
|
-
|
|
17
|
-
if line.startswith("__version__"):
|
|
18
|
-
version = line.split("=")[1].strip().strip('"').strip("'")
|
|
19
|
-
break
|
|
13
|
+
version_file = os.path.join(os.path.dirname(__file__), "VERSION")
|
|
14
|
+
if os.path.exists(version_file):
|
|
15
|
+
with open(version_file, "r") as f:
|
|
16
|
+
version = f.read().strip()
|
|
20
17
|
|
|
21
18
|
# Read long description from README
|
|
22
19
|
long_description = ""
|
|
@@ -50,18 +47,15 @@ setup(
|
|
|
50
47
|
],
|
|
51
48
|
python_requires=">=3.8",
|
|
52
49
|
install_requires=[
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
"pyyaml>=5.4.0",
|
|
50
|
+
line.strip()
|
|
51
|
+
for line in open("requirements.txt")
|
|
52
|
+
if line.strip() and not line.startswith("#")
|
|
57
53
|
],
|
|
58
54
|
extras_require={
|
|
59
55
|
"dev": [
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"flake8>=3.9.0",
|
|
64
|
-
"mypy>=0.910",
|
|
56
|
+
line.strip()
|
|
57
|
+
for line in open("requirements-dev.txt")
|
|
58
|
+
if line.strip() and not line.startswith("#") and not line.startswith("-r")
|
|
65
59
|
],
|
|
66
60
|
},
|
|
67
61
|
entry_points={
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|