-
-
Notifications
You must be signed in to change notification settings - Fork 611
Closed
Description
Python supports two ways to start programs: by file, or by module name.
Today, only file is supported. This is a FR for -m
to also be supported. There's two main use cases for this style:
- Using a file not in the same Bazel package as main.
- Specifying a main that comes from dependencies, and referencing the actual main file directly is problematic.
Some example use cases:
- When using a macro to generate a test/binary.
- pytest: a common main is used and the tests to execute are passed as arguments or discovered at runtime. This basically a special case of the above.
This should be fairly easy to implement using bootstrap script. It just requires passing the name of the main module to the stage2 bootstrap instead of the path to the main module.
Docs for -m
: https://docs.python.org/3.10/using/cmdline.html#cmdoption-m
See also: runpy.run_module: https://docs.python.org/3.10/library/runpy.html#runpy.run_module
Metadata
Metadata
Assignees
Labels
No labels