-
Notifications
You must be signed in to change notification settings - Fork 414
feat: implement bridge_python codegen #3421
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
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
96fde1b
Phase 1: Remove deprecated BamlValueChecked and BamlValueStreamingState
sxlijin e02585f
Phase 3: bridge_python sim with namespaced class round-trip
sxlijin 2fc072f
Phase 4: typed Pydantic round-trip via 09d/09e encoding
sxlijin b704aae
Phase 5: redesign cg::Name to carry (pkg, namespace_path, name)
sxlijin 6421246
Phase G0: teardown + rig wiring for codegen rewrite
sxlijin d9cbfd5
Phase G1: directory layout + whole-SDK scaffolding
sxlijin adb0458
Phase G2: emitter-internal Rust types + placeholder rendering
sxlijin eca8f6b
integ test cleanup
sxlijin 4b53301
Phase G4: real class/enum/type-alias bodies via translate_ty
sxlijin b69e4a7
Phase G5: factory bindings for free functions + companions
sxlijin 6979fa2
Phase G6: rig tests as end-to-end regression fence
sxlijin 51a54f3
phase G7: rig tests driven by baml_src/, not Rust pools
sxlijin 5c254d1
consolidate type-shape rig crates; fold llm_functions into example_09a
sxlijin 99985ac
12a: collapse FQN spaces — emit always fully qualifies, drop fqn_pref…
sxlijin 1dfa1ea
12b: static and instance method bindings
sxlijin eac9560
12d: pyi stub generation
sxlijin 5ec0952
13a: bridge_python e2e smoke demo
sxlijin 338ca5a
13b: extend e2e demo with LLM function + __build_request
sxlijin afbae41
13c: put LLM demo back in ns_lorem/, fix sys_ops client $new lookup
sxlijin f5aa69e
12f: TYPE_CHECKING-guarded relative imports for cross-leaf refs
sxlijin a4ca0f9
fix rust unit tests for user. qualification
sxlijin 0e51528
delete rig test empty
sxlijin 413f2c9
clean up stream_return_type
sxlijin a78c31d
drop dead checkedValue/streamingStateValue branches in proto.ts
sxlijin 2cf40e6
ci: install uv via mise-action for snapshot tests
sxlijin 5fe8071
codegen_python: render root __init__.py via askama template
sxlijin 9940f06
fix CI: stow Cargo.toml, sync bridge_nodejs generated files, drop obs…
sxlijin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
strip_prefixfallback silently uses absolute paths.If
sf.path(db)ever returns a path that isn't underbaml_src(e.g., a synthesized/built-in source, a symlink resolved out-of-tree, or a path that differs only in canonicalization),strip_prefix(baml_src).unwrap_or(&path)falls back to the absolute path. That absolutePathBufthen becomes a key in the inlinedFILESdict and is later joined into the output dir — effectively writing outsidebaml_sdk/baml/_inlinedbaml.py's expected layout, or producing keys the runtime'sinitialize_runtimewon't recognize.Consider failing fast (or filtering) when a source is not under
baml_src, since that almost certainly indicates a bug upstream rather than something the codegen should silently absorb.Suggested change
source_files .iter() - .map(|sf| { + .filter_map(|sf| { let path = sf.path(db); - let rel = path.strip_prefix(baml_src).unwrap_or(&path).to_path_buf(); - (rel, sf.text(db).to_string()) + let rel = path.strip_prefix(baml_src).ok()?.to_path_buf(); + Some((rel, sf.text(db).to_string())) }) .collect()📝 Committable suggestion
🤖 Prompt for AI Agents