parsagon 0.14.31__tar.gz → 0.14.32__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 (38) hide show
  1. {parsagon-0.14.31 → parsagon-0.14.32}/PKG-INFO +1 -1
  2. {parsagon-0.14.31 → parsagon-0.14.32}/pyproject.toml +1 -1
  3. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/edit.py +16 -5
  4. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/executor.py +8 -2
  5. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon.egg-info/PKG-INFO +1 -1
  6. {parsagon-0.14.31 → parsagon-0.14.32}/README.md +0 -0
  7. {parsagon-0.14.31 → parsagon-0.14.32}/setup.cfg +0 -0
  8. {parsagon-0.14.31 → parsagon-0.14.32}/src/__init__.py +0 -0
  9. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/__init__.py +0 -0
  10. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/api.py +0 -0
  11. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/assistant.py +0 -0
  12. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/create.py +0 -0
  13. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/custom_function.py +0 -0
  14. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/exceptions.py +0 -0
  15. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/gui/__init__.py +0 -0
  16. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/gui/controller.py +0 -0
  17. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/gui/menu.py +0 -0
  18. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/gui/window.py +0 -0
  19. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/gui_entry.py +0 -0
  20. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/highlights.js +0 -0
  21. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/main.py +0 -0
  22. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/print.py +0 -0
  23. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/runs.py +0 -0
  24. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/secrets.py +0 -0
  25. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/settings.py +0 -0
  26. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/tests/__init__.py +0 -0
  27. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/tests/api_mocks.py +0 -0
  28. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/tests/conftest.py +0 -0
  29. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/tests/test_executor.py +0 -0
  30. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/tests/test_invalid_args.py +0 -0
  31. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/tests/test_pipeline_operations.py +0 -0
  32. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/tests/test_print.py +0 -0
  33. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon/tests/test_secrets.py +0 -0
  34. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon.egg-info/SOURCES.txt +0 -0
  35. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon.egg-info/dependency_links.txt +0 -0
  36. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon.egg-info/entry_points.txt +0 -0
  37. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon.egg-info/requires.txt +0 -0
  38. {parsagon-0.14.31 → parsagon-0.14.32}/src/parsagon.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: parsagon
3
- Version: 0.14.31
3
+ Version: 0.14.32
4
4
  Summary: Allows you to create browser automations with natural language
5
5
  Author-email: Sandy Suh <sandy@parsagon.io>
6
6
  Project-URL: Homepage, https://parsagon.io
@@ -16,7 +16,7 @@ line-length = 120
16
16
 
17
17
  [project]
18
18
  name = "parsagon"
19
- version = "0.14.31"
19
+ version = "0.14.32"
20
20
  description = "Allows you to create browser automations with natural language"
21
21
  readme = "README.md"
22
22
  requires-python = ">=3.8"
@@ -1,4 +1,10 @@
1
- from parsagon.api import edit_program_sketch, get_pipeline, get_pipeline_code_parts, update_pipeline
1
+ from parsagon.api import (
2
+ edit_program_sketch,
3
+ get_pipeline,
4
+ get_pipeline_code_parts,
5
+ update_pipeline,
6
+ add_examples_to_custom_function,
7
+ )
2
8
  from parsagon.executor import Executor, custom_functions_to_descriptions
3
9
  from parsagon.print import assistant_print
4
10
  from rich.prompt import Confirm, Prompt
@@ -7,7 +13,10 @@ from rich.prompt import Confirm, Prompt
7
13
  def edit_program(task, program_name, variables={}, verbose=False):
8
14
  pipeline = get_pipeline(program_name)
9
15
  pipeline_code_parts = get_pipeline_code_parts(pipeline["id"])
10
- custom_functions = {custom_function["call_id"]: custom_function["code"] for custom_function in pipeline_code_parts["custom_functions"]}
16
+ custom_functions = {
17
+ custom_function["call_id"]: custom_function["code"]
18
+ for custom_function in pipeline_code_parts["custom_functions"]
19
+ }
11
20
  program_sketches = edit_program_sketch(pipeline_code_parts["program_sketch"], task)
12
21
  full_program = program_sketches["full"]
13
22
  abridged_program = program_sketches["abridged"]
@@ -28,7 +37,7 @@ def edit_program(task, program_name, variables={}, verbose=False):
28
37
 
29
38
  program_name_input = Prompt.ask(
30
39
  f'Type "{program_name}" to update this program, or press enter without typing a name to CANCEL',
31
- choices=[program_name, ""]
40
+ choices=[program_name, ""],
32
41
  )
33
42
  if not program_name_input:
34
43
  assistant_print("Discarded edits.")
@@ -45,10 +54,12 @@ def edit_program(task, program_name, variables={}, verbose=False):
45
54
  assistant_print(f" Saving function{description}...")
46
55
  add_examples_to_custom_function(pipeline_id, call_id, custom_function, True)
47
56
  assistant_print(f"Finalizing program...")
48
- update_pipeline(pipeline_id, {"program_sketch": full_program, "abridged_sketch": abridged_program, "pseudocode": pseudocode})
57
+ update_pipeline(
58
+ pipeline_id, {"program_sketch": full_program, "abridged_sketch": abridged_program, "pseudocode": pseudocode}
59
+ )
49
60
  assistant_print(f"Saved.")
50
61
  except Exception as e:
51
- error_message = "An error occurred while saving the program. The program was not updated."
62
+ error_message = f"An error occurred while saving the program. The program was not updated. {repr(e)}"
52
63
  assistant_print(error_message)
53
64
  return {"success": False, "outcome": error_message}
54
65
 
@@ -168,8 +168,14 @@ class Executor:
168
168
  code = self.function_bank[call_id]
169
169
  args_dict["call_id"] = call_id
170
170
  args_str = ", ".join(f"{k}={repr(v)}" for k, v in args_dict.items())
171
- code = f"{code}\noutput = {name}{call_id}({args_str})"
172
- context = {"driver": self.driver, "PARSAGON_API_KEY": settings.get_api_key()}
171
+ code = f"import time\nimport lxml.html\nfrom urllib.parse import urljoin\nfrom selenium.webdriver.common.by import By\n{code}\noutput = {name}{call_id}({args_str})"
172
+ context = {
173
+ "driver": self.driver,
174
+ "PARSAGON_API_KEY": settings.get_api_key(),
175
+ "parsagon_elem_data": {"idx": self.max_elem_ids[self.driver.current_window_handle]},
176
+ "parsagon_log": [],
177
+ "parsagon_warnings": [],
178
+ }
173
179
  exec(code, context, context)
174
180
  return context["output"]
175
181
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: parsagon
3
- Version: 0.14.31
3
+ Version: 0.14.32
4
4
  Summary: Allows you to create browser automations with natural language
5
5
  Author-email: Sandy Suh <sandy@parsagon.io>
6
6
  Project-URL: Homepage, https://parsagon.io
File without changes
File without changes
File without changes