briefcase icon indicating copy to clipboard operation
briefcase copied to clipboard

Generating a command-line executable without the GUI features

Open kakyoism opened this issue 4 years ago • 37 comments

Is your feature request related to a problem? Please describe.

The Beeware tutorials only mention how to build and distribute a GUI app. It's unclear how to generate a command-line program.

Describe the solution you'd like

I wonder if I could opt out of the GUI requirements and build a standalone CLI executable that includes all the implicit Python dependencies, i.e., a single-file executable. Then with the package command this executable can be included in an installer.

kakyoism avatar Jan 17 '21 04:01 kakyoism

Thanks for the suggestion!

Supporting command line apps is definitely something we'd like to do; and conceptually, there's nothing about Briefcase that is inherently "GUI" about what it generates. The sticking point is working out how to wrap the Python app so that it can be accessed as a command line app.

Briefcase specifically doesn't use the "Single file executable" model, because of problems I've historically seen with that approach. A lot of Python code in the wild includes implicit assumptions about how it is deployed - that's why, for example, the egg format includes the 'zip-safe' flag.

If you're particularly enthused about the single file executable model, there are tools (like pyinstaller) that can support that. You could probably even write a Briefcase platform backend that would serve as a wrapper of that tool using Briefcase's plugin system. However, we're unlikely to merge a single-file executable model into Briefcase itself.

freakboy3742 avatar Jan 17 '21 22:01 freakboy3742