parsagon 0.14.31__py3-none-any.whl → 0.14.32__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.
- parsagon/edit.py +16 -5
- parsagon/executor.py +8 -2
- {parsagon-0.14.31.dist-info → parsagon-0.14.32.dist-info}/METADATA +17 -17
- {parsagon-0.14.31.dist-info → parsagon-0.14.32.dist-info}/RECORD +7 -7
- {parsagon-0.14.31.dist-info → parsagon-0.14.32.dist-info}/WHEEL +1 -1
- {parsagon-0.14.31.dist-info → parsagon-0.14.32.dist-info}/entry_points.txt +0 -0
- {parsagon-0.14.31.dist-info → parsagon-0.14.32.dist-info}/top_level.txt +0 -0
parsagon/edit.py
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
from parsagon.api import
|
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 = {
|
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(
|
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
|
|
parsagon/executor.py
CHANGED
@@ -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 = {
|
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.
|
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
|
@@ -8,23 +8,23 @@ Classifier: Programming Language :: Python :: 3
|
|
8
8
|
Classifier: Operating System :: OS Independent
|
9
9
|
Requires-Python: >=3.8
|
10
10
|
Description-Content-Type: text/markdown
|
11
|
-
Requires-Dist: selenium
|
12
|
-
Requires-Dist: lxml
|
13
|
-
Requires-Dist: httpx
|
14
|
-
Requires-Dist: psutil
|
15
|
-
Requires-Dist: rich
|
16
|
-
Requires-Dist: PyVirtualDisplay
|
17
|
-
Requires-Dist: selenium-wire
|
18
|
-
Requires-Dist: cssselect
|
19
|
-
Requires-Dist: undetected-chromedriver
|
20
|
-
Requires-Dist: webdriver-manager
|
21
|
-
Requires-Dist: jsonpath-ng
|
22
|
-
Requires-Dist: simplejson
|
23
|
-
Requires-Dist: pypdf
|
11
|
+
Requires-Dist: selenium==4.9.1
|
12
|
+
Requires-Dist: lxml==4.9.2
|
13
|
+
Requires-Dist: httpx==0.27.0
|
14
|
+
Requires-Dist: psutil==5.9.6
|
15
|
+
Requires-Dist: rich==13.6.0
|
16
|
+
Requires-Dist: PyVirtualDisplay==3.0
|
17
|
+
Requires-Dist: selenium-wire==5.1.0
|
18
|
+
Requires-Dist: cssselect==1.2.0
|
19
|
+
Requires-Dist: undetected-chromedriver==3.5.5
|
20
|
+
Requires-Dist: webdriver-manager==4.0.1
|
21
|
+
Requires-Dist: jsonpath-ng==1.5.3
|
22
|
+
Requires-Dist: simplejson==3.19.1
|
23
|
+
Requires-Dist: pypdf==4.2.0
|
24
24
|
Provides-Extra: dev
|
25
|
-
Requires-Dist: pytest
|
26
|
-
Requires-Dist: pytest-mock
|
27
|
-
Requires-Dist: pre-commit
|
25
|
+
Requires-Dist: pytest==7.3.2; extra == "dev"
|
26
|
+
Requires-Dist: pytest-mock==3.11.1; extra == "dev"
|
27
|
+
Requires-Dist: pre-commit==3.6.0; extra == "dev"
|
28
28
|
|
29
29
|
# parsagon
|
30
30
|
|
@@ -3,9 +3,9 @@ parsagon/api.py,sha256=UuHPK1HsKF0pvqUeBGlv2tDHHK5-i0PP9Di3bolcr2g,10383
|
|
3
3
|
parsagon/assistant.py,sha256=V3NL6UdDqe74W_X3wPQ1qwFuJRvHzitXtOt-XSCXvds,4065
|
4
4
|
parsagon/create.py,sha256=igrJN8jVP5p3P9-dPSabrHGOQOlG2Flx7ep4SqEDB14,4373
|
5
5
|
parsagon/custom_function.py,sha256=oEj28qItaHUnsvLIHD7kg5QL3J3aO6rW6xKKP-H-Drs,770
|
6
|
-
parsagon/edit.py,sha256=
|
6
|
+
parsagon/edit.py,sha256=5gtnx0gNB7Gvz8ET00SczE-ZS0TomN1um6uObP-OObE,3120
|
7
7
|
parsagon/exceptions.py,sha256=tG1vnpmUN1GdJ1GSpe1MaWH3zWmFLZCwtOfEGu8qPP0,910
|
8
|
-
parsagon/executor.py,sha256=
|
8
|
+
parsagon/executor.py,sha256=GoY87mkZGl7feab0qF3ja0BRIlDTvGlDktyCytb3Rj8,27786
|
9
9
|
parsagon/gui_entry.py,sha256=bqG9K0CArXWWwDGoT8aV17YLNM8MfjSf6SJ_B3QbNeA,671
|
10
10
|
parsagon/highlights.js,sha256=2UDfUApblU9xtGgTLCq4X7rHRV0wcqDSSFZPmJS6fJg,16643
|
11
11
|
parsagon/main.py,sha256=WPxrT1ZyPe6wNSFP7GnnKIGisgPM2dFieHP2TC5TGVQ,9467
|
@@ -25,8 +25,8 @@ parsagon/tests/test_invalid_args.py,sha256=TAFdHGy92lUxjljPrtODOuEGVss6rn-F5GvEK
|
|
25
25
|
parsagon/tests/test_pipeline_operations.py,sha256=aEwZNtIwOl9X7jdLDLB4YEdgMp7_x8PXCINAE7RT4NY,805
|
26
26
|
parsagon/tests/test_print.py,sha256=BG7f55YDBoL0S7k291-so_Gje_hUAQOkB-jh-bEYsJY,198
|
27
27
|
parsagon/tests/test_secrets.py,sha256=Ctsscl2tmMTZcFAy5dnyqUlgTov2UharZgLpbRCLdEg,2662
|
28
|
-
parsagon-0.14.
|
29
|
-
parsagon-0.14.
|
30
|
-
parsagon-0.14.
|
31
|
-
parsagon-0.14.
|
32
|
-
parsagon-0.14.
|
28
|
+
parsagon-0.14.32.dist-info/METADATA,sha256=bjuVJitevEmIBWOvrCptqaVhVs7QUu1mCt0aPWAKNN4,2442
|
29
|
+
parsagon-0.14.32.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
|
30
|
+
parsagon-0.14.32.dist-info/entry_points.txt,sha256=I1UlPUb4oY2k9idkI8kvdkEcrjKGRSOl5pMbA6uu6kw,48
|
31
|
+
parsagon-0.14.32.dist-info/top_level.txt,sha256=ih5uYQzW4qjhRKppys-WiHLIbXVZ99YdqDcfAtlcQwk,9
|
32
|
+
parsagon-0.14.32.dist-info/RECORD,,
|
File without changes
|
File without changes
|