diff --git a/src/command.rs b/src/command.rs index 51516d0..88e5524 100644 --- a/src/command.rs +++ b/src/command.rs @@ -79,7 +79,11 @@ pub enum Command { #[derive(clap::Args, Debug)] pub struct Componentize { - /// The name of a Python module containing the app to wrap + /// The name of a Python module containing the app to wrap. + /// + /// Note that this should not match (any of) the world name(s) you are targeting since `componentize-py` will + /// generate code using those name(s), and Python doesn't know how to load two top-level modules with the same + /// name. pub app_name: String, /// Specify a directory containing the app and/or its dependencies. May be specified more than once. diff --git a/src/lib.rs b/src/lib.rs index 144b27a..5c30d6b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -312,6 +312,13 @@ pub async fn componentize( .chain(main_world) .collect::>(); + if worlds + .iter() + .any(|&id| app_name == resolve.worlds[id].name.to_snake_case().escape()) + { + bail!("App name `{app_name}` conflicts with world name; please rename your application module."); + } + let summary = Summary::try_new( &resolve, &worlds,