algomancy-quickstart 0.7.0__py3-none-any.whl

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 (42) hide show
  1. algomancy_quickstart/__init__.py +2 -0
  2. algomancy_quickstart/asset_manager.py +202 -0
  3. algomancy_quickstart/data_inference.py +517 -0
  4. algomancy_quickstart/main.py +62 -0
  5. algomancy_quickstart/quickstart.py +683 -0
  6. algomancy_quickstart/styling_wizard.py +347 -0
  7. algomancy_quickstart/templates/__init__.py +0 -0
  8. algomancy_quickstart/templates/algorithm.py.jinja +104 -0
  9. algomancy_quickstart/templates/assets/CQM-logo-white.png +0 -0
  10. algomancy_quickstart/templates/assets/cqm-button-white.png +0 -0
  11. algomancy_quickstart/templates/assets/cqm-button.png +0 -0
  12. algomancy_quickstart/templates/assets/cqm-logo.png +0 -0
  13. algomancy_quickstart/templates/assets/css/button_colors.css +285 -0
  14. algomancy_quickstart/templates/assets/css/cqm_loader.css +47 -0
  15. algomancy_quickstart/templates/assets/css/sidebar_layout.css +189 -0
  16. algomancy_quickstart/templates/assets/css/theme_colors.css +90 -0
  17. algomancy_quickstart/templates/assets/letter-c.svg +4 -0
  18. algomancy_quickstart/templates/assets/letter-m.svg +4 -0
  19. algomancy_quickstart/templates/assets/letter-q.svg +4 -0
  20. algomancy_quickstart/templates/assets/letters/letter-c.png +0 -0
  21. algomancy_quickstart/templates/assets/letters/letter-m.png +0 -0
  22. algomancy_quickstart/templates/assets/letters/letter-q.png +0 -0
  23. algomancy_quickstart/templates/assets/pepsi_girl.jpeg +0 -0
  24. algomancy_quickstart/templates/assets/style.css +421 -0
  25. algomancy_quickstart/templates/compare_page.py.jinja +133 -0
  26. algomancy_quickstart/templates/data_page.py.jinja +94 -0
  27. algomancy_quickstart/templates/etl_factory.py.jinja +108 -0
  28. algomancy_quickstart/templates/etl_factory_generated.py.jinja +82 -0
  29. algomancy_quickstart/templates/generated_schemas.py.jinja +55 -0
  30. algomancy_quickstart/templates/home_page.py.jinja +65 -0
  31. algomancy_quickstart/templates/kpi.py.jinja +76 -0
  32. algomancy_quickstart/templates/main.py.jinja +42 -0
  33. algomancy_quickstart/templates/main_custom.py.jinja +55 -0
  34. algomancy_quickstart/templates/main_generated_etl.py.jinja +72 -0
  35. algomancy_quickstart/templates/main_with_styling.py.jinja +83 -0
  36. algomancy_quickstart/templates/overview_page.py.jinja +98 -0
  37. algomancy_quickstart/templates/scenario_page.py.jinja +77 -0
  38. algomancy_quickstart/templates/schema.py.jinja +58 -0
  39. algomancy_quickstart/templates/styling_config.py.jinja +53 -0
  40. algomancy_quickstart-0.7.0.dist-info/METADATA +29 -0
  41. algomancy_quickstart-0.7.0.dist-info/RECORD +42 -0
  42. algomancy_quickstart-0.7.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,347 @@
1
+ """
2
+ Interactive styling configuration wizard.
3
+ """
4
+
5
+ import re
6
+ from typing import Dict
7
+ import click
8
+ from rich.console import Console
9
+ from rich.table import Table
10
+ from rich.text import Text
11
+
12
+ from algomancy_gui.configuration.colorconfig import ButtonColorMode, CardHighlightMode
13
+
14
+
15
+ class StylingWizard:
16
+ """Interactive wizard for creating styling configurations."""
17
+
18
+ # Predefined color presets
19
+ PRESETS = {
20
+ "cqm": {
21
+ "name": "CQM Theme (Light Blue)",
22
+ "background": "#e3f8ff",
23
+ "primary": "#4C0265",
24
+ "secondary": "#3EBDF3",
25
+ "text": "#424242",
26
+ "text_highlight": "#EF7B13",
27
+ "text_selected": "#e3f8ff",
28
+ "card_mode": CardHighlightMode.LIGHT,
29
+ },
30
+ "blue": {
31
+ "name": "Blue Professional",
32
+ "background": "#FFFFFF",
33
+ "primary": "#3366CA",
34
+ "secondary": "#000000",
35
+ "text": "#3366CA",
36
+ "text_highlight": "#FFFFFF",
37
+ "text_selected": "#FFFFFF",
38
+ "card_mode": CardHighlightMode.SUBTLE_DARK,
39
+ },
40
+ "red": {
41
+ "name": "Red Accent",
42
+ "background": "#E4EEF1",
43
+ "primary": "#982649",
44
+ "secondary": "#FFB86F",
45
+ "text": "#131B23",
46
+ "text_highlight": "#000000",
47
+ "text_selected": "#FFFFFF",
48
+ "card_mode": CardHighlightMode.SUBTLE_DARK,
49
+ },
50
+ "dark": {
51
+ "name": "Dark Mode",
52
+ "background": "#1a1a1a",
53
+ "primary": "#2d2d2d",
54
+ "secondary": "#00d4aa",
55
+ "text": "#e0e0e0",
56
+ "text_highlight": "#00d4aa",
57
+ "text_selected": "#ffffff",
58
+ "card_mode": CardHighlightMode.SUBTLE_LIGHT,
59
+ },
60
+ "minimal": {
61
+ "name": "Minimal Grayscale",
62
+ "background": "#f5f5f5",
63
+ "primary": "#333333",
64
+ "secondary": "#666666",
65
+ "text": "#222222",
66
+ "text_highlight": "#000000",
67
+ "text_selected": "#ffffff",
68
+ "card_mode": CardHighlightMode.SUBTLE_DARK,
69
+ },
70
+ }
71
+
72
+ def __init__(self):
73
+ self.config = {}
74
+ self.console = Console()
75
+
76
+ def run(self) -> Dict:
77
+ """
78
+ Run the interactive styling wizard.
79
+
80
+ Returns:
81
+ Dictionary with styling configuration.
82
+ """
83
+ click.echo(
84
+ click.style("🎨 Step 5: Styling Configuration", fg="blue", bold=True)
85
+ )
86
+ click.echo()
87
+
88
+ # Step 1: Choose preset or custom
89
+ choice = self._choose_preset()
90
+
91
+ if choice == "custom":
92
+ self._configure_custom()
93
+ else:
94
+ self.config = self.PRESETS[choice].copy()
95
+ click.echo()
96
+ if click.confirm("Do you want to customize this preset?", default=False):
97
+ click.echo()
98
+ self._customize_colors()
99
+
100
+ # Step 2: Configure button mode
101
+ click.echo()
102
+ self._configure_button_mode()
103
+
104
+ # Step 3: Optionally configure logo/button images
105
+ click.echo()
106
+ self._configure_assets()
107
+
108
+ return self.config
109
+
110
+ def _choose_preset(self) -> str:
111
+ """
112
+ Let user choose a color preset.
113
+
114
+ Returns:
115
+ Preset key or 'custom'.
116
+ """
117
+ click.echo("Choose a color theme:")
118
+ click.echo()
119
+
120
+ preset_keys = list(self.PRESETS.keys())
121
+
122
+ for i, (key, preset) in enumerate(self.PRESETS.items(), 1):
123
+ click.echo(f" {i}. {preset['name']}")
124
+ self._show_color_preview(preset)
125
+ click.echo()
126
+
127
+ click.echo(f" {len(preset_keys) + 1}. Custom colors")
128
+ click.echo()
129
+
130
+ choice_num = click.prompt(
131
+ "Select theme", type=click.IntRange(1, len(preset_keys) + 1), default=1
132
+ )
133
+
134
+ if choice_num <= len(preset_keys):
135
+ return preset_keys[choice_num - 1]
136
+ else:
137
+ return "custom"
138
+
139
+ def _show_color_preview(self, preset: Dict):
140
+ """
141
+ Show a preview of colors using Rich.
142
+
143
+ Args:
144
+ preset: Preset configuration dictionary.
145
+ """
146
+ # Create a table with color swatches
147
+ table = Table.grid(padding=(0, 2))
148
+ table.add_column(style="dim")
149
+ table.add_column()
150
+ table.add_column()
151
+
152
+ # Add rows for each color
153
+ table.add_row(
154
+ "Background:",
155
+ self._color_swatch(preset["background"]),
156
+ preset["background"],
157
+ )
158
+ table.add_row(
159
+ "Primary:", self._color_swatch(preset["primary"]), preset["primary"]
160
+ )
161
+ table.add_row(
162
+ "Secondary:", self._color_swatch(preset["secondary"]), preset["secondary"]
163
+ )
164
+ table.add_row(
165
+ "Text:", self._color_swatch(preset["text"], use_fg=True), preset["text"]
166
+ )
167
+
168
+ # Print with proper indentation
169
+ self.console.print(" ", table)
170
+
171
+ def _color_swatch(self, hex_color: str, use_fg: bool = False) -> Text:
172
+ """
173
+ Create a colored swatch using Rich.
174
+
175
+ Args:
176
+ hex_color: Hex color code.
177
+ use_fg: If True, use as foreground color instead of background.
178
+
179
+ Returns:
180
+ Rich Text object with colored block.
181
+ """
182
+ # Create colored text block
183
+ if use_fg:
184
+ return Text("███", style=f"{hex_color}")
185
+ else:
186
+ return Text(" ", style=f"on {hex_color}")
187
+
188
+ def _configure_custom(self):
189
+ """Configure colors from scratch."""
190
+ click.echo()
191
+ click.echo("Let's set up your custom colors!")
192
+ click.echo("Enter colors in hex format (e.g., #3366CA)")
193
+ click.echo()
194
+
195
+ self.config["name"] = "Custom"
196
+ self.config["background"] = self._prompt_color(
197
+ "Background color", default="#FFFFFF"
198
+ )
199
+ self.config["primary"] = self._prompt_color(
200
+ "Primary theme color (main UI elements)", default="#3366CA"
201
+ )
202
+ self.config["secondary"] = self._prompt_color(
203
+ "Secondary theme color (accents, buttons)", default="#009688"
204
+ )
205
+ self.config["text"] = self._prompt_color("Text color", default="#333333")
206
+ self.config["text_highlight"] = self._prompt_color(
207
+ "Highlighted text color", default="#000000"
208
+ )
209
+ self.config["text_selected"] = self._prompt_color(
210
+ "Selected text color", default="#FFFFFF"
211
+ )
212
+
213
+ # Card highlight mode
214
+ click.echo()
215
+ self._configure_card_mode()
216
+
217
+ def _customize_colors(self):
218
+ """Allow customization of selected preset."""
219
+ click.echo("Customize colors (press Enter to keep current value):")
220
+ click.echo()
221
+
222
+ self.config["background"] = self._prompt_color(
223
+ "Background color", default=self.config["background"]
224
+ )
225
+ self.config["primary"] = self._prompt_color(
226
+ "Primary theme color", default=self.config["primary"]
227
+ )
228
+ self.config["secondary"] = self._prompt_color(
229
+ "Secondary theme color", default=self.config["secondary"]
230
+ )
231
+ self.config["text"] = self._prompt_color(
232
+ "Text color", default=self.config["text"]
233
+ )
234
+ self.config["text_highlight"] = self._prompt_color(
235
+ "Highlighted text color", default=self.config["text_highlight"]
236
+ )
237
+ self.config["text_selected"] = self._prompt_color(
238
+ "Selected text color", default=self.config["text_selected"]
239
+ )
240
+
241
+ def _prompt_color(self, prompt: str, default: str) -> str:
242
+ """
243
+ Prompt for a hex color with validation and preview.
244
+
245
+ Args:
246
+ prompt: Prompt message.
247
+ default: Default color value.
248
+
249
+ Returns:
250
+ Valid hex color string.
251
+ """
252
+ while True:
253
+ color = click.prompt(f" {prompt}", default=default, type=str)
254
+
255
+ if self._is_valid_hex_color(color):
256
+ # Show preview using Rich
257
+ preview = Text(" Preview: ", style="dim")
258
+ preview.append(self._color_swatch(color))
259
+ self.console.print(" ", preview)
260
+ return color
261
+ else:
262
+ click.echo(
263
+ click.style(" Invalid hex color. Use format: #RRGGBB", fg="red")
264
+ )
265
+
266
+ def _is_valid_hex_color(self, color: str) -> bool:
267
+ """
268
+ Validate hex color format.
269
+
270
+ Args:
271
+ color: Color string to validate.
272
+
273
+ Returns:
274
+ True if valid hex color.
275
+ """
276
+ pattern = r"^#[0-9A-Fa-f]{6}$"
277
+ return bool(re.match(pattern, color))
278
+
279
+ def _configure_card_mode(self):
280
+ """Configure card highlight mode."""
281
+ click.echo()
282
+ click.echo("Card highlight mode determines how cards are styled:")
283
+ click.echo(" 1. Light - Lighter than background")
284
+ click.echo(" 2. Subtle Light - Slightly lighter")
285
+ click.echo(" 3. Subtle Dark - Slightly darker")
286
+ click.echo(" 4. Dark - Darker than background")
287
+ click.echo()
288
+
289
+ modes = {
290
+ 1: CardHighlightMode.LIGHT,
291
+ 2: CardHighlightMode.SUBTLE_LIGHT,
292
+ 3: CardHighlightMode.SUBTLE_DARK,
293
+ 4: CardHighlightMode.DARK,
294
+ }
295
+
296
+ choice = click.prompt(
297
+ "Select card highlight mode", type=click.IntRange(1, 4), default=3
298
+ )
299
+
300
+ self.config["card_mode"] = modes[choice]
301
+
302
+ def _configure_button_mode(self):
303
+ """Configure button color mode."""
304
+ click.echo("Button color mode:")
305
+ click.echo(" 1. Unified - All buttons use the same color")
306
+ click.echo(" 2. Separate - Each button type has its own color (recommended)")
307
+ click.echo()
308
+
309
+ choice = click.prompt(
310
+ "Select button mode", type=click.IntRange(1, 2), default=2
311
+ )
312
+
313
+ if choice == 1:
314
+ self.config["button_mode"] = ButtonColorMode.UNIFIED
315
+ else:
316
+ self.config["button_mode"] = ButtonColorMode.SEPARATE
317
+
318
+ def _configure_assets(self):
319
+ """Configure logo and button image paths."""
320
+ if not click.confirm(
321
+ "Do you want to specify custom logo/button images?", default=False
322
+ ):
323
+ self.config["logo_path"] = None
324
+ self.config["button_path"] = None
325
+ return
326
+
327
+ click.echo()
328
+ click.echo("Enter paths relative to the assets/ folder")
329
+ click.echo("(e.g., 'my-logo.png' for assets/my-logo.png)")
330
+ click.echo()
331
+
332
+ logo = click.prompt(
333
+ " Logo path (press Enter to skip)",
334
+ default="",
335
+ type=str,
336
+ show_default=False,
337
+ )
338
+
339
+ button = click.prompt(
340
+ " Button image path (press Enter to skip)",
341
+ default="",
342
+ type=str,
343
+ show_default=False,
344
+ )
345
+
346
+ self.config["logo_path"] = logo if logo else None
347
+ self.config["button_path"] = button if button else None
File without changes
@@ -0,0 +1,104 @@
1
+ """
2
+ Algorithm implementations for {{ project_name }}.
3
+
4
+ This module defines the algorithms that process your data and generate scenarios.
5
+ """
6
+
7
+ from time import sleep
8
+
9
+ from algomancy_data import DataSource
10
+ from algomancy_scenario import BaseParameterSet, ScenarioResult, BaseAlgorithm
11
+
12
+
13
+ class {{ class_name }}Params(BaseParameterSet):
14
+ """
15
+ Parameter set for {{ class_name }} algorithm.
16
+
17
+ This class holds the configuration parameters for your algorithm.
18
+
19
+ TODO: Add your algorithm parameters as instance variables.
20
+ """
21
+
22
+ def __init__(
23
+ self,
24
+ name: str = "Default",
25
+ # TODO: Add your parameter definitions here with default values
26
+ # example_param: int = 10,
27
+ ) -> None:
28
+ super().__init__(name=name)
29
+ # TODO: Store your parameters as instance variables
30
+ # self.example_param = example_param
31
+
32
+ def validate(self):
33
+ """
34
+ Validate the parameters.
35
+
36
+ Raise exceptions if parameters are invalid.
37
+
38
+ TODO: Implement validation logic for your parameters.
39
+
40
+ Example:
41
+ if self.example_param < 0:
42
+ raise ValueError("example_param must be non-negative")
43
+ """
44
+ pass
45
+
46
+
47
+ class {{ class_name }}Algorithm(BaseAlgorithm):
48
+ """
49
+ Main algorithm implementation for {{ project_name }}.
50
+
51
+ This class implements the core logic of your algorithm.
52
+
53
+ TODO: Implement your algorithm logic in the run() method.
54
+ """
55
+
56
+ def __init__(self, params: {{ class_name }}Params):
57
+ super().__init__("{{ class_name }}", params)
58
+
59
+ @staticmethod
60
+ def initialize_parameters() -> {{ class_name }}Params:
61
+ """
62
+ Create default parameters for this algorithm.
63
+
64
+ Returns:
65
+ Default parameter set.
66
+ """
67
+ return {{ class_name }}Params()
68
+
69
+ def run(self, data: DataSource) -> ScenarioResult:
70
+ """
71
+ Execute the algorithm on the provided data.
72
+
73
+ Args:
74
+ data: The input data source to process.
75
+
76
+ Returns:
77
+ ScenarioResult containing the algorithm's output.
78
+
79
+ TODO: Implement your algorithm logic here.
80
+
81
+ Tips:
82
+ - Use self.logger.log() to log progress messages
83
+ - Use self.set_progress(percentage) to update progress (0-100)
84
+ - Access parameters via self.params
85
+ - Return a ScenarioResult with the data_id
86
+ """
87
+ self._logger.log(f"Starting {{ class_name }} algorithm...")
88
+
89
+ # TODO: Replace this with your actual algorithm logic
90
+ # Example placeholder implementation:
91
+ sleep(0.5) # Simulate processing time
92
+
93
+ # Update progress
94
+ self.set_progress(50)
95
+ self._logger.log("Processing halfway done...")
96
+
97
+ # More processing...
98
+ sleep(0.5)
99
+
100
+ # Finish
101
+ self.set_progress(100)
102
+ self._logger.success("Algorithm completed successfully!")
103
+
104
+ return ScenarioResult(data_id=data.id)