ivoryos 0.1.6__tar.gz → 0.1.7__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 ivoryos might be problematic. Click here for more details.

Files changed (52) hide show
  1. {ivoryos-0.1.6/ivoryos.egg-info → ivoryos-0.1.7}/PKG-INFO +1 -1
  2. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/__init__.py +12 -7
  3. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/static/js/socket_handler.js +10 -1
  4. ivoryos-0.1.7/ivoryos/static/logo.webp +0 -0
  5. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/templates/base.html +4 -1
  6. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/utils/form.py +1 -1
  7. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/utils/llm_agent.py +1 -1
  8. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/utils/script_runner.py +9 -3
  9. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/utils/utils.py +30 -31
  10. {ivoryos-0.1.6 → ivoryos-0.1.7/ivoryos.egg-info}/PKG-INFO +1 -1
  11. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos.egg-info/SOURCES.txt +1 -1
  12. {ivoryos-0.1.6 → ivoryos-0.1.7}/setup.py +1 -1
  13. ivoryos-0.1.6/ivoryos/static/logo.png +0 -0
  14. {ivoryos-0.1.6 → ivoryos-0.1.7}/LICENSE +0 -0
  15. {ivoryos-0.1.6 → ivoryos-0.1.7}/MANIFEST.in +0 -0
  16. {ivoryos-0.1.6 → ivoryos-0.1.7}/README.md +0 -0
  17. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/config.py +0 -0
  18. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/routes/__init__.py +0 -0
  19. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/routes/auth/__init__.py +0 -0
  20. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/routes/auth/auth.py +0 -0
  21. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/routes/auth/templates/auth/login.html +0 -0
  22. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/routes/auth/templates/auth/signup.html +0 -0
  23. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/routes/control/__init__.py +0 -0
  24. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/routes/control/control.py +0 -0
  25. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/routes/control/templates/control/controllers.html +0 -0
  26. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/routes/control/templates/control/controllers_home.html +0 -0
  27. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/routes/control/templates/control/controllers_new.html +0 -0
  28. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/routes/database/__init__.py +0 -0
  29. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/routes/database/database.py +0 -0
  30. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/routes/database/templates/database/experiment_database.html +0 -0
  31. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/routes/design/__init__.py +0 -0
  32. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/routes/design/design.py +0 -0
  33. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/routes/design/templates/design/experiment_builder.html +0 -0
  34. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/routes/design/templates/design/experiment_run.html +0 -0
  35. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/routes/main/__init__.py +0 -0
  36. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/routes/main/main.py +0 -0
  37. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/routes/main/templates/main/help.html +0 -0
  38. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/routes/main/templates/main/home.html +0 -0
  39. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/static/favicon.ico +0 -0
  40. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/static/gui_annotation/Slide1.png +0 -0
  41. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/static/gui_annotation/Slide2.PNG +0 -0
  42. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/static/js/overlay.js +0 -0
  43. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/static/js/sortable_card.js +0 -0
  44. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/static/js/sortable_design.js +0 -0
  45. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/static/style.css +0 -0
  46. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/utils/__init__.py +0 -0
  47. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/utils/db_models.py +0 -0
  48. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos/utils/global_config.py +0 -0
  49. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos.egg-info/dependency_links.txt +0 -0
  50. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos.egg-info/requires.txt +0 -0
  51. {ivoryos-0.1.6 → ivoryos-0.1.7}/ivoryos.egg-info/top_level.txt +0 -0
  52. {ivoryos-0.1.6 → ivoryos-0.1.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ivoryos
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
4
  Summary: an open-source Python package enabling Self-Driving Labs (SDLs) interoperability
5
5
  Home-page: https://gitlab.com/heingroup/ivoryos
6
6
  Author: Ivory Zhang
@@ -2,7 +2,7 @@ import os
2
2
  import sys
3
3
  from typing import Union
4
4
 
5
- from flask import Flask
5
+ from flask import Flask, redirect, url_for
6
6
 
7
7
  from ivoryos.config import Config, get_config
8
8
  from ivoryos.routes.auth.auth import auth, login_manager
@@ -19,7 +19,8 @@ global_config = GlobalConfig()
19
19
 
20
20
 
21
21
  def create_app(config_class=None):
22
- app = Flask(__name__)
22
+ url_prefix = os.getenv('URL_PREFIX', None)
23
+ app = Flask(__name__, static_url_path=f'{url_prefix}/static', static_folder='static')
23
24
  app.config.from_object(config_class or 'config.get_config()')
24
25
 
25
26
  # Initialize extensions
@@ -45,11 +46,15 @@ def create_app(config_class=None):
45
46
  g.logger = logger
46
47
  g.socketio = socketio
47
48
 
48
- app.register_blueprint(main)
49
- app.register_blueprint(auth)
50
- app.register_blueprint(design)
51
- app.register_blueprint(database)
52
- app.register_blueprint(control)
49
+ app.register_blueprint(main, url_prefix=url_prefix)
50
+ app.register_blueprint(auth, url_prefix=url_prefix)
51
+ app.register_blueprint(design, url_prefix=url_prefix)
52
+ app.register_blueprint(database, url_prefix=url_prefix)
53
+ app.register_blueprint(control, url_prefix=url_prefix)
54
+
55
+ @app.route('/')
56
+ def redirect_to_prefix():
57
+ return redirect(url_for('main.index')) # Assuming 'index' is a route in your blueprint
53
58
 
54
59
  return app
55
60
 
@@ -6,7 +6,16 @@ document.addEventListener("DOMContentLoaded", function() {
6
6
  socket.on('progress', function(data) {
7
7
  var progress = data.progress;
8
8
  console.log(progress);
9
- $('#progress-bar-inner').css('width', progress + '%')
9
+ // Update the progress bar's width and appearance
10
+ var progressBar = document.getElementById('progress-bar-inner');
11
+ progressBar.style.width = progress + '%';
12
+ progressBar.setAttribute('aria-valuenow', progress);
13
+
14
+ if (progress === 100) {
15
+ // Remove animation and set green color when 100% is reached
16
+ progressBar.classList.remove('progress-bar-animated');
17
+ progressBar.classList.add('bg-success'); // Bootstrap class for green color
18
+ }
10
19
  });
11
20
  socket.on('log', function(data) {
12
21
  var logMessage = data.message;
Binary file
@@ -25,7 +25,7 @@
25
25
  <div class= "container">
26
26
 
27
27
  <a class="navbar-brand" href="{{ url_for('main.index') }}">
28
- <img src="{{url_for('static', filename='logo.png')}}" alt="Logo" height="60" class="d-inline-block align-text-bottom">
28
+ <img src="{{url_for('static', filename='logo.webp')}}" alt="Logo" height="60" class="d-inline-block align-text-bottom">
29
29
  </a>
30
30
  <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
31
31
  <span class="navbar-toggler-icon"></span>
@@ -33,6 +33,9 @@
33
33
 
34
34
  <div class="collapse navbar-collapse" id="navbarSupportedContent">
35
35
  <ul class="navbar-nav mr-auto">
36
+ <li class="nav-item">
37
+ <a class="nav-link" href="{{ url_for('main.index') }}" aria-current="page">Home</a>
38
+ </li>
36
39
  <li class="nav-item">
37
40
  <a class="nav-link" href="{{ url_for('database.load_from_database') }}" aria-current="page">Library</a>
38
41
  </li>
@@ -255,7 +255,7 @@ def create_form_from_module(sdl_module, autofill: bool, script=None, design=True
255
255
  attr = getattr(sdl_module, attr_name)
256
256
  if inspect.ismethod(attr) and not attr_name.startswith('_'):
257
257
  form_class = create_add_form(attr, attr_name, autofill, script, design)
258
- method_forms[attr_name] = form_class()
258
+ method_forms[format_name(attr_name)] = form_class()
259
259
  return method_forms
260
260
 
261
261
 
@@ -3,7 +3,7 @@ import json
3
3
  import os
4
4
  import re
5
5
 
6
- from openai import OpenAI, BaseModel
6
+ from openai import OpenAI
7
7
 
8
8
 
9
9
  # from dotenv import load_dotenv
@@ -53,6 +53,7 @@ class ScriptRunner:
53
53
  def _run_with_stop_check(self, script: Script, repeat_count, run_name, logger, socketio, config, bo_args,
54
54
  output_path):
55
55
  time.sleep(1)
56
+ self._emit_progress(socketio, 1)
56
57
  try:
57
58
  # Run "prep" section once
58
59
  script_dict = script.script_dict
@@ -75,6 +76,7 @@ class ScriptRunner:
75
76
  finally:
76
77
  with self.lock:
77
78
  self.is_running = False # Reset the running flag when done
79
+ self._emit_progress(socketio, 100)
78
80
 
79
81
  def _run_actions(self, actions, section_name="", run_name=None, logger=None):
80
82
  logger.info(f'Executing {section_name} steps') if actions else logger.info(f'No {section_name} steps')
@@ -104,7 +106,7 @@ class ScriptRunner:
104
106
  break
105
107
  logger.info(f'Executing {i + 1} of {len(config)} with kwargs = {kwargs}')
106
108
  progress = (i + 1) * 100 / len(config)
107
- socketio.emit('progress', {'progress': progress})
109
+ self._emit_progress(socketio, progress)
108
110
  fname = f"{run_name}_script"
109
111
  function = self.globals_dict[fname]
110
112
  output = function(**kwargs)
@@ -121,8 +123,8 @@ class ScriptRunner:
121
123
  logger.info(f'Stopping execution during {run_name}: {i + 1}/{int(repeat_count)}')
122
124
  break
123
125
  logger.info(f'Executing {run_name} experiment: {i + 1}/{int(repeat_count)}')
124
- progress = (i + 1) * 100 / int(repeat_count)
125
- socketio.emit('progress', {'progress': progress})
126
+ progress = (i + 1) * 100 / int(repeat_count) - 0.1
127
+ self._emit_progress(socketio, progress)
126
128
  if bo_args:
127
129
  try:
128
130
  parameters, trial_index = ax_client.get_next_trial()
@@ -156,3 +158,7 @@ class ScriptRunner:
156
158
  writer.writeheader()
157
159
  writer.writerows(output_list)
158
160
  logger.info(f'Results saved to {file_path}')
161
+
162
+ @staticmethod
163
+ def _emit_progress(socketio, progress):
164
+ socketio.emit('progress', {'progress': progress})
@@ -1,3 +1,4 @@
1
+ import ast
1
2
  import importlib
2
3
  import inspect
3
4
  import logging
@@ -124,23 +125,22 @@ def _get_type_from_parameters(arg, parameters):
124
125
  """get argument types from inspection"""
125
126
  arg_type = ''
126
127
  if type(parameters) is inspect.Signature:
127
- p = parameters.parameters
128
+ annotation = parameters.parameters[arg].annotation
129
+ elif type(parameters) is dict:
130
+ annotation = parameters[arg]
131
+ if annotation is not inspect._empty:
128
132
  # print(p[arg].annotation)
129
- if p[arg].annotation is not inspect._empty:
130
- # print(p[arg].annotation)
131
- if p[arg].annotation.__module__ == 'typing':
133
+ if annotation.__module__ == 'typing':
134
+ if hasattr(annotation, '_name') and annotation._name in ["Optional", "Union"]:
132
135
  # print(p[arg].annotation.__args__)
133
- arg_type = [i.__name__ for i in p[arg].annotation.__args__]
134
- else:
135
- arg_type = p[arg].annotation.__name__
136
- # print(arg_type)
137
- elif type(parameters) is dict:
138
- if parameters[arg]:
139
-
140
- if parameters[arg].__module__ == 'typing':
141
- arg_type = [i.__name__ for i in parameters[arg].__args__]
136
+ arg_type = [i.__name__ for i in annotation.__args__]
137
+ elif hasattr(annotation, '__origin__'):
138
+ arg_type = annotation.__origin__.__name__
142
139
  else:
143
- arg_type = parameters[arg].__name__
140
+ # TODO
141
+ pass
142
+ else:
143
+ arg_type = annotation.__name__
144
144
  return arg_type
145
145
 
146
146
 
@@ -168,17 +168,12 @@ def _convert_by_str(args, arg_types):
168
168
  if type(arg_types) is not list:
169
169
  arg_types = [arg_types]
170
170
  for arg_type in arg_types:
171
- if arg_type == "any":
171
+ if not arg_type == "any":
172
172
  try:
173
- args = eval(args)
173
+ args = eval(f'{arg_type}("{args}")') if type(args) is str else eval(f'{arg_type}({args})')
174
+ return args
174
175
  except Exception:
175
- pass
176
- return args
177
- try:
178
- args = eval(f'{arg_type}("{args}")')
179
- return args
180
- except Exception:
181
- raise TypeError(f"Input type error: cannot convert '{args}' to {arg_type}.")
176
+ raise TypeError(f"Input type error: cannot convert '{args}' to {arg_type}.")
182
177
 
183
178
 
184
179
  def _convert_by_class(args, arg_types):
@@ -214,16 +209,20 @@ def convert_config_type(args, arg_types, is_class: bool = False):
214
209
  raise ValueError("config file format not supported.")
215
210
  if args[arg] == '' or args[arg] == "None":
216
211
  args[arg] = None
217
- elif args[arg] == "True" or args[arg] == "False":
218
- args[arg] = bool_dict[args[arg]]
212
+ # elif args[arg] == "True" or args[arg] == "False":
213
+ # args[arg] = bool_dict[args[arg]]
219
214
  else:
220
215
  arg_type = arg_types[arg]
221
-
222
- if is_class:
223
- # if arg_type.__module__ == 'builtins':
224
- args[arg] = _convert_by_class(args[arg], arg_type)
225
- else:
226
- args[arg] = _convert_by_str(args[arg], arg_type)
216
+ try:
217
+ args[arg] = ast.literal_eval(args[arg])
218
+ except ValueError:
219
+ pass
220
+ if type(args[arg]) is not arg_type and not type(args[arg]).__name__ == arg_type:
221
+ if is_class:
222
+ # if arg_type.__module__ == 'builtins':
223
+ args[arg] = _convert_by_class(args[arg], arg_type)
224
+ else:
225
+ args[arg] = _convert_by_str(args[arg], arg_type)
227
226
  return args
228
227
 
229
228
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ivoryos
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
4
  Summary: an open-source Python package enabling Self-Driving Labs (SDLs) interoperability
5
5
  Home-page: https://gitlab.com/heingroup/ivoryos
6
6
  Author: Ivory Zhang
@@ -31,7 +31,7 @@ ivoryos/routes/main/main.py
31
31
  ivoryos/routes/main/templates/main/help.html
32
32
  ivoryos/routes/main/templates/main/home.html
33
33
  ivoryos/static/favicon.ico
34
- ivoryos/static/logo.png
34
+ ivoryos/static/logo.webp
35
35
  ivoryos/static/style.css
36
36
  ivoryos/static/gui_annotation/Slide1.png
37
37
  ivoryos/static/gui_annotation/Slide2.PNG
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='ivoryos',
5
- version='0.1.6',
5
+ version='0.1.7',
6
6
  packages=find_packages(exclude=['example', 'example.*', 'docs', 'docs.*']),
7
7
  include_package_data=True,
8
8
  description='an open-source Python package enabling Self-Driving Labs (SDLs) interoperability',
Binary file
File without changes
File without changes
File without changes
File without changes
File without changes