-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: make baml_py work with playwright/inspect #1214
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Changes requested. Reviewed everything up to ade3902 in 1 minute and 36 seconds
More details
- Looked at
329
lines of code in11
files - Skipped
0
files when reviewing. - Skipped posting
3
drafted comments based on config settings.
1. .github/workflows/primary.yml:109
- Draft comment:
The version for 'actions/checkout' should be 'v3', not 'v4'. - Reason this comment was not posted:
Comment did not seem useful.
2. engine/baml-runtime/src/tracing/mod.rs:202
- Draft comment:
Remove commented-out code to keep the codebase clean and maintainable. This applies to other instances of commented-out code in this file as well. - Reason this comment was not posted:
Confidence changes required:50%
The PR includes commented-out code in multiple places. While it's common to leave comments for future reference, it's generally a best practice to remove commented-out code to keep the codebase clean and maintainable.
3. integ-tests/python/tests/test_pydantic.py:99
- Draft comment:
Consider adding assertions to verify the expected behavior of the inspect module, such as checking that the stack is not empty or contains expected values. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The test_inspect function is a regression test for a specific bug related to inspect.stack(). The current test checks for unexpected exceptions, which is a valid test for the described bug. Adding assertions about the stack's contents may not be necessary for this specific regression test.
The comment might be suggesting a more thorough test, but it could be unnecessary for the specific bug being tested. The current test seems sufficient for its purpose.
The test is focused on ensuring no exceptions are raised, which aligns with the described bug. Additional assertions might not add value for this specific case.
The comment is not necessary as the current test is sufficient for the regression bug it addresses. The comment should be deleted.
Workflow ID: wflow_q8AsMeWpJd0cRFdW
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
fn test_inspect() { | ||
assert_eq!( | ||
crate::MODULE_NAME, | ||
format!("baml_py.{}", stringify!(baml_asdfpy)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The module name in the assertion should be consistent with the actual module name used in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Changes requested. Incremental review on 951d1e7 in 51 seconds
More details
- Looked at
217
lines of code in7
files - Skipped
0
files when reviewing. - Skipped posting
4
drafted comments based on config settings.
1. engine/language_client_python/src/lib.rs:54
- Draft comment:
TheLoremIpsum
class and its methods have been removed. Ensure that no other parts of the codebase depend on this class, as its removal might cause runtime errors if referenced elsewhere. - Reason this comment was not posted:
Comment did not seem useful.
2. engine/language_client_python/src/lib.rs:76
- Draft comment:
Thetest_inspect
function is commented out. If this test is no longer needed, consider removing it to keep the code clean. If it is needed, uncomment and ensure it passes. - Reason this comment was not posted:
Confidence changes required:50%
The test functiontest_inspect
is commented out. If it's not needed, it should be removed to keep the code clean.
3. engine/language_client_python/src/types/audio.rs:57
- Draft comment:
Ensure thatbaml_deserialize
correctly handles thedata
parameter and that it is safe from any potential deserialization vulnerabilities. - Reason this comment was not posted:
Comment did not seem useful.
4. engine/language_client_python/src/types/image.rs:56
- Draft comment:
Ensure thatbaml_deserialize
correctly handles thedata
parameter and that it is safe from any potential deserialization vulnerabilities. - Reason this comment was not posted:
Marked as duplicate.
Workflow ID: wflow_jsX6dRvJxyshsHlE
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on 1026360 in 11 seconds
More details
- Looked at
20
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. .github/workflows/primary.yml:120
- Draft comment:
Ensure thatpoetry install
is necessary by verifying thatpoetry
is used in the project. The addition in the workflow aligns with the.mise.toml
configuration. - Reason this comment was not posted:
Confidence changes required:50%
The addition ofpoetry install
in the workflow is necessary due to the addition of poetry in the.mise.toml
file. This ensures that the Python dependencies are installed before running the tests.
Workflow ID: wflow_340eSfgUR5AV3QQN
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on bb55aa2 in 12 seconds
More details
- Looked at
25
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. .github/workflows/primary.yml:16
- Draft comment:
Ensure the cron schedule0 10 * * *
is intended to run daily at 2am PST (10am UTC). - Reason this comment was not posted:
Confidence changes required:33%
The cron schedule is set to run daily at 2am PST, which is 10am UTC. This is correctly set up for a daily schedule, but it's important to ensure that this is the intended frequency and time.
Workflow ID: wflow_G7p9iJE1nh5Yabvb
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
When using
baml_py.Image
in a Pydantic model with playwright-python (the headless browser stack), the playwright library freezes up (see user report). Specifically this code suffices to repro the issue:The reason turns out to be that when the playwright context manager is entered, deep in the callstack, the playwright connection grabs the stack context using
inspect.stack()
. Because of how__get_pydantic_core_schema__
was implemented forbaml_py.Image
andbaml_py.Audio
, declaring a pydantic model that relied on either of these types would causeinspect.stack()
to crash:The fix turns out to be very simple: when we evaluate Python code in
__get_pydantic_core_schema__
, we just need to actually synthesize a file and module name for the evaluated code, instead of passing in an empty string (which is what we do today).(Also, since we added pickle support for image/audio during the investigation, keep it.)
Important
Fixes
inspect.stack()
crash and adds pickle support forbaml_py.Image
andbaml_py.Audio
, with updated tests and CI workflow.inspect.stack()
crash by providing file and module name in__get_pydantic_core_schema__
forbaml_py.Image
andbaml_py.Audio
.baml_py.Image
andbaml_py.Audio
withpy_new
and__getnewargs__
methods.test_inspect
andtest_pickle
intest_python.py
to verify compatibility and pickle functionality.run_tests.sh
for running Python integration tests.primary.yml
to include a scheduled job and integration tests job.poetry
version to.mise.toml
.This description was created by for bb55aa2. It will automatically update as commits are pushed.