sand-bob 0.1.0__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.
sand_bob-0.1.0/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ Copyright 2025 Robert Haase, ScaDS.AI, Uni Leipzig
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+
10
+ 2. Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ 3. Neither the name of the copyright holder nor the names of its contributors
15
+ may be used to endorse or promote products derived from this software without
16
+ specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
+ POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,79 @@
1
+ Metadata-Version: 2.4
2
+ Name: sand-bob
3
+ Version: 0.1.0
4
+ Summary: LLM-based code generation and docker-sandboxed execution in a loop in parallel
5
+ Author-email: Robert Haase <robert.haase@uni-leipzig.de>
6
+ License: Copyright 2025 Robert Haase, ScaDS.AI, Uni Leipzig
7
+ All rights reserved.
8
+
9
+ Redistribution and use in source and binary forms, with or without
10
+ modification, are permitted provided that the following conditions are met:
11
+
12
+ 1. Redistributions of source code must retain the above copyright notice,
13
+ this list of conditions and the following disclaimer.
14
+
15
+ 2. Redistributions in binary form must reproduce the above copyright notice,
16
+ this list of conditions and the following disclaimer in the documentation
17
+ and/or other materials provided with the distribution.
18
+
19
+ 3. Neither the name of the copyright holder nor the names of its contributors
20
+ may be used to endorse or promote products derived from this software without
21
+ specific prior written permission.
22
+
23
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33
+ POSSIBILITY OF SUCH DAMAGE.
34
+
35
+ Project-URL: Homepage, https://haesleinhuepf.github.io/sand-bob/
36
+ Project-URL: Repository, https://github.com/haesleinhuepf/sand-bob
37
+ Project-URL: Issues, https://github.com/haesleinhuepf/sand-bob/issues
38
+ Classifier: Development Status :: 3 - Alpha
39
+ Classifier: Intended Audience :: Developers
40
+ Classifier: Operating System :: OS Independent
41
+ Classifier: Programming Language :: Python :: 3
42
+ Classifier: Programming Language :: Python :: 3.8
43
+ Classifier: Programming Language :: Python :: 3.9
44
+ Classifier: Programming Language :: Python :: 3.10
45
+ Classifier: Programming Language :: Python :: 3.11
46
+ Classifier: Programming Language :: Python :: 3.12
47
+ Requires-Python: >=3.8
48
+ Description-Content-Type: text/markdown
49
+ License-File: LICENSE
50
+ Requires-Dist: docker>=6.0.0
51
+ Requires-Dist: ipywidgets>=7.0.0
52
+ Requires-Dist: ipython>=7.0.0
53
+ Requires-Dist: jupytext>=1.0.0
54
+ Requires-Dist: jupyterlab>=3.0.0
55
+ Requires-Dist: matplotlib>=3.0.0
56
+ Requires-Dist: numpy>=1.0.0
57
+ Requires-Dist: openai>=1.0.0
58
+ Requires-Dist: pandas>=1.0.0
59
+ Requires-Dist: Pillow>=9.0.0
60
+ Requires-Dist: scikit-image>=0.19.0
61
+ Requires-Dist: wordcloud>=1.9.0
62
+ Provides-Extra: dev
63
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
64
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
65
+ Requires-Dist: black>=22.0.0; extra == "dev"
66
+ Requires-Dist: flake8>=5.0.0; extra == "dev"
67
+ Requires-Dist: requests>=2.0.0; extra == "dev"
68
+ Dynamic: license-file
69
+
70
+ # Sand-Bob
71
+
72
+ LLM-based code generation and docker-sandboxed execution in a loop in parallel
73
+
74
+ ![](docs/alice-teaser-small.gif)
75
+
76
+
77
+ ## Documentation
78
+
79
+ Check out the [documentation](https://haesleinhuepf.github.io/sand-bob/)
@@ -0,0 +1,10 @@
1
+ # Sand-Bob
2
+
3
+ LLM-based code generation and docker-sandboxed execution in a loop in parallel
4
+
5
+ ![](docs/alice-teaser-small.gif)
6
+
7
+
8
+ ## Documentation
9
+
10
+ Check out the [documentation](https://haesleinhuepf.github.io/sand-bob/)
@@ -0,0 +1,105 @@
1
+ [build-system]
2
+ requires = ["setuptools>=69", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "sand-bob"
7
+ version = "0.1.0"
8
+ description = "LLM-based code generation and docker-sandboxed execution in a loop in parallel"
9
+ readme = "README.md"
10
+ license = {file = "LICENSE"}
11
+ authors = [
12
+ {name = "Robert Haase", email = "robert.haase@uni-leipzig.de"}
13
+ ]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Developers",
17
+ "Operating System :: OS Independent",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.8",
20
+ "Programming Language :: Python :: 3.9",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ ]
25
+ requires-python = ">=3.8"
26
+ dependencies = [
27
+ "docker>=6.0.0",
28
+ "ipywidgets>=7.0.0",
29
+ "ipython>=7.0.0",
30
+ "jupytext>=1.0.0",
31
+ "jupyterlab>=3.0.0",
32
+ "matplotlib>=3.0.0",
33
+ "numpy>=1.0.0",
34
+ "openai>=1.0.0",
35
+ "pandas>=1.0.0",
36
+ "Pillow>=9.0.0",
37
+ "scikit-image>=0.19.0",
38
+ "wordcloud>=1.9.0",
39
+ ]
40
+
41
+ [project.optional-dependencies]
42
+ dev = [
43
+ "pytest>=7.0.0",
44
+ "pytest-cov>=4.0.0",
45
+ "black>=22.0.0",
46
+ "flake8>=5.0.0",
47
+ "requests>=2.0.0",
48
+ ]
49
+
50
+ [project.urls]
51
+ Homepage = "https://haesleinhuepf.github.io/sand-bob/"
52
+ Repository = "https://github.com/haesleinhuepf/sand-bob"
53
+ Issues = "https://github.com/haesleinhuepf/sand-bob/issues"
54
+
55
+ [tool.setuptools.packages.find]
56
+ include = ["sand_bob*"]
57
+
58
+ [tool.black]
59
+ line-length = 88
60
+ target-version = ['py38']
61
+ include = '\.pyi?$'
62
+ extend-exclude = '''
63
+ /(
64
+ # directories
65
+ \.eggs
66
+ | \.git
67
+ | \.hg
68
+ | \.mypy_cache
69
+ | \.tox
70
+ | \.venv
71
+ | build
72
+ | dist
73
+ )/
74
+ '''
75
+
76
+ [tool.pytest.ini_options]
77
+ testpaths = ["tests"]
78
+ python_files = ["test_*.py"]
79
+ python_classes = ["Test*"]
80
+ python_functions = ["test_*"]
81
+ addopts = [
82
+ "--strict-markers",
83
+ "--strict-config"
84
+ ]
85
+
86
+ [tool.coverage.run]
87
+ source = ["sand_bob"]
88
+ omit = [
89
+ "*/tests/*",
90
+ "*/test_*",
91
+ ]
92
+
93
+ [tool.coverage.report]
94
+ exclude_lines = [
95
+ "pragma: no cover",
96
+ "def __repr__",
97
+ "if self.debug:",
98
+ "if settings.DEBUG",
99
+ "raise AssertionError",
100
+ "raise NotImplementedError",
101
+ "if 0:",
102
+ "if __name__ == .__main__.:",
103
+ "class .*\\bProtocol\\):",
104
+ "@(abc\\.)?abstractmethod",
105
+ ]
@@ -0,0 +1,20 @@
1
+ from ._executor import ExecutionResult, execute
2
+ from ._code_gen import generate_code
3
+
4
+ # Conditionally import IPython magic functions only if IPython is available
5
+ try:
6
+ from ._alice import alice, initialize
7
+ except (ImportError, NameError):
8
+ # IPython not available or not in IPython context
9
+ alice = None
10
+ initialize = None
11
+
12
+ from ._config import config, config_openai, config_kisski, config_ollama, config_scadsai_llm, config_kiara, config_llms
13
+
14
+ __version__ = "0.1.0"
15
+ __all__ = ["ExecutionResult", "execute", "config", "generate_code", "config_openai", "config_kisski", "config_ollama", "config_scadsai_llm", "config_kiara", "config_llms"]
16
+
17
+ WHITELIST_DEPENDENCIES = ["pandas", "matplotlib", "seaborn", "scipy", "numpy",
18
+ "scikit-learn", "scikit-image", "tqdm",
19
+ "statsmodels", "stackview", "cupy"]
20
+
@@ -0,0 +1,60 @@
1
+ from IPython.core.magic import register_line_cell_magic
2
+
3
+ class Context:
4
+ input_host_path: str = None
5
+ dependencies: list = []
6
+ n_codefix_attempts: int = 1
7
+ n_feedback_iterations: int = 1
8
+ n_parallel: int = 1
9
+ n_iterative: int = 1
10
+ vary_algorithm: bool = False
11
+ final_touch: bool = False
12
+
13
+ @register_line_cell_magic
14
+ def alice(line, cell=None):
15
+ from sand_bob._code_gen import generate_code
16
+ from IPython.display import display
17
+
18
+ user_input = combine_user_input(line, cell)
19
+ res = generate_code(user_input,
20
+ dependencies=Context.dependencies,
21
+ input_host_path=Context.input_host_path,
22
+ n_codefix_attempts=Context.n_codefix_attempts,
23
+ n_feedback_iterations = Context.n_feedback_iterations,
24
+ n_parallel=Context.n_parallel,
25
+ n_iterative=Context.n_iterative,
26
+ vary_algorithm=Context.vary_algorithm,
27
+ final_touch=Context.final_touch)
28
+ #print("="*100)
29
+ display(res)
30
+
31
+
32
+ def initialize(input_host_path: str=None,
33
+ dependencies: list=["scikit-image", "numpy", "pandas", "matplotlib", "seaborn", "tqdm", "scipy"],
34
+ n_codefix_attempts: int = 3,
35
+ n_feedback_iterations: int = 0,
36
+ n_parallel: int = 1,
37
+ n_iterative: int = 1,
38
+ vary_algorithm: bool = False,
39
+ final_touch: bool = False):
40
+ Context.input_host_path = input_host_path
41
+ Context.dependencies = dependencies
42
+ Context.n_codefix_attempts = n_codefix_attempts
43
+ Context.n_feedback_iterations = n_feedback_iterations
44
+ Context.n_parallel = n_parallel
45
+ Context.n_iterative = n_iterative
46
+ Context.vary_algorithm = vary_algorithm
47
+ Context.final_touch = final_touch
48
+
49
+
50
+ def combine_user_input(line, cell):
51
+ if line and cell:
52
+ user_input = line + "\n" + cell
53
+ elif line:
54
+ user_input = line
55
+ elif cell:
56
+ user_input = cell
57
+ else:
58
+ user_input = None
59
+ return user_input
60
+