Skip to content

Commit b0e79a2

Browse files
authored
Fix python codgen use Literal directly instead of types.Literal. (#1697)
<!-- ELLIPSIS_HIDDEN --> > [!IMPORTANT] > Replace `types.Literal` with `Literal` directly in Python files, update `noqa` comments, and delete TypeScript artifacts. > > - **Python Codegen**: > - Replace `types.Literal` with `Literal` directly in `mod.rs`, `async_client.py`, `sync_client.py`, `parser.py`, and other Python files. > - Update `noqa` comments in `python_language_features.rs`, `async_client.py`, `config.py`, and other Python files to remove `F821`. > - **TypeScript Artifacts**: > - Delete `async_context_vars.d.ts`, `errors.d.ts`, `index.d.ts`, `native.d.ts`, `stream.d.ts`, `type_builder.d.ts` and their corresponding `.js` and `.map` files. > - **Miscellaneous**: > - Rename `logging` to `config` in `__init__.py.j2` and `baml_client/__init__.py`. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=BoundaryML%2Fbaml&utm_source=github&utm_medium=referral)<sup> for ce88a93. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN -->
1 parent 463ad96 commit b0e79a2

34 files changed

Lines changed: 99 additions & 1496 deletions

engine/language_client_codegen/src/python/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ impl ToTypeReferenceInClientDefinition for FieldType {
319319
Some(checks) => {
320320
let base_type_ref = base.to_type_ref(ir, _with_checked);
321321
let checks_type_ref = type_name_for_checks(&checks);
322-
format!("Checked[{base_type_ref},types.{checks_type_ref}]")
322+
format!("Checked[{base_type_ref}, {checks_type_ref}]")
323323
}
324324
None => base.to_type_ref(ir, _with_checked),
325325
},
@@ -374,7 +374,7 @@ impl ToTypeReferenceInClientDefinition for FieldType {
374374
Some(checks) => {
375375
let base_type_ref = base.to_partial_type_ref(ir, with_checked);
376376
let checks_type_ref = type_name_for_checks(&checks);
377-
format!("Checked[{base_type_ref},types.{checks_type_ref}]")
377+
format!("Checked[{base_type_ref}, {checks_type_ref}]")
378378
}
379379
None => base.to_partial_type_ref(ir, with_checked),
380380
},

engine/language_client_codegen/src/python/python_language_features.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ impl LanguageFeatures for PythonLanguageFeatures {
1717
# This file was generated by BAML: please do not edit it. Instead, edit the
1818
# BAML files and re-generate this code.
1919
#
20-
# ruff: noqa: E501,F401,F821
21-
# flake8: noqa: E501,F401,F821
20+
# ruff: noqa: E501,F401
21+
# flake8: noqa: E501,F401
2222
# pylint: disable=unused-import,line-too-long
2323
# fmt: off
2424
"#;

engine/language_client_codegen/src/python/templates/__init__.py.j2

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,4 @@ __all__ = [
3838
"types",
3939
"reset_baml_env_vars",
4040
"config",
41-
"logging",
4241
]

engine/language_client_typescript/artifacts/async_context_vars.d.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

engine/language_client_typescript/artifacts/async_context_vars.d.ts.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

engine/language_client_typescript/artifacts/async_context_vars.js

Lines changed: 0 additions & 116 deletions
This file was deleted.

engine/language_client_typescript/artifacts/errors.d.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

engine/language_client_typescript/artifacts/errors.d.ts.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

engine/language_client_typescript/artifacts/errors.js

Lines changed: 0 additions & 170 deletions
This file was deleted.

engine/language_client_typescript/artifacts/index.d.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)