Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try cx_freeze for packaging CLI program #45

Closed
sgillies opened this issue Jan 7, 2016 · 5 comments
Closed

Try cx_freeze for packaging CLI program #45

sgillies opened this issue Jan 7, 2016 · 5 comments

Comments

@sgillies
Copy link
Contributor

sgillies commented Jan 7, 2016

I'm not sure if this is the way to go, but I've been curious about cx_freeze.

See also #18.

@sgillies
Copy link
Contributor Author

sgillies commented Jan 7, 2016

It appears that our use of setuptools' pkg_resources is incompatible with cx_freeze. We'd need to change the program design to use cx_freeze.

@perrygeo
Copy link
Contributor

There's also pyinstaller and bbfreeze (unmaintained) both of which can theoretically create cross-platform binaries.

There are some other options out there but they all seem to be platform specific:

There's also the perhaps insane idea of supporting Jython or zippy and packaging it as a jar file to run on the JVM. 😵

@perrygeo
Copy link
Contributor

pyinstaller looks active and promising but it looks like it doesn't support console_scripts in setup.py

EDIT: It theoretically does using this workaround

@perrygeo
Copy link
Contributor

Update on pyinstaller: It works, sorta. Instead of using click_plugins.with_plugins to dynamically pull the subcommands from the entry points, you can explictly define subcommand as part of a group

+from .cli  import main_group

-@click.command(short_help="Geocode an address or coordinates.")
+@main_group.command(short_help="Geocode an address or coordinates.")

write the main cli.py as a wrapper script to do explicit imports

from mapboxcli.scripts.geocoding import geocoding

if __name__ == "__main__":
    main_group()

then run pyinstaller on the wrapper script to produce an executable

$ file dist/mapbox/mapbox
mapbox: Mach-O 64-bit executable x86_64

and geocoding works as expected.

Implications of this approach? Compiled script means no dynamic plugins at runtime, lose the ability to do user plugins.

@sgillies
Copy link
Contributor Author

Too old. I don't think we're going to go this route.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants