Skip to content

Commit

Permalink
python: don't generate empty __all__ thingies
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Oct 13, 2023
1 parent e6f8dea commit 6cc01d7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 11 additions & 7 deletions crates/re_types_builder/src/codegen/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,15 +411,17 @@ impl PythonCodeGenerator {
code.push_text(&clause, 1, 0);
}

code.push_unindented_text(
format!(
"
if !manifest.is_empty() {
code.push_unindented_text(
format!(
"
__all__ = [{manifest}]
",
),
0,
);
),
0,
);
}

let obj_code = if obj.is_struct() {
code_for_struct(reporter, arrow_registry, &ext_class, objects, obj)
Expand Down Expand Up @@ -508,7 +510,9 @@ fn write_init_file(
let names = names.join(", ");
code.push_text(&format!("from .{module} import {names}"), 1, 0);
}
code.push_unindented_text(format!("\n__all__ = [{manifest}]"), 0);
if !manifest.is_empty() {
code.push_unindented_text(format!("\n__all__ = [{manifest}]"), 0);
}
files_to_write.insert(path, code);
}

Expand Down
2 changes: 0 additions & 2 deletions rerun_py/tests/test_types/blueprint/__init__.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6cc01d7

Please sign in to comment.