cjolowicz / hypermodern-python

Hypermodern Python
https://medium.com/@cjolowicz/hypermodern-python-d44485d9d769
MIT License
615 stars 91 forks source link

information about binary wheel builds #66

Open IaroslavR opened 4 years ago

IaroslavR commented 4 years ago

As I understand you plan to update your series, may be it will be good if you'll mention about the auditwheel project. Many interesting details can be found here

cjolowicz commented 4 years ago

Thank you, this looks great! Don't know why I missed it the first time round.

wanderrful commented 4 years ago

Piggybacking on this, do you have any guidance for distribution of releases of our Poetry project? Particularly, for distribution as an executable or app file?

You did a great job covering CD for distribution via PyPI, but not all consumers of our app will have Python installed or understand how to use pip install myapp without guidance.

Poetry seems to want us to call scripts via poetry run, but all distribution tools I've seen like py2exe , cx_freeze, or pyinstaller want us to provide a script beforehand. Should we create an entry point layer of indirection to act as a substitute for not being able to directly call our scripts via poetry so that consumers of our Click CLI app can still run certain commands (e.g. myapp run console -l pl)?

I'd imagine that since we are able to export our compiled wheel binaries with Poetry that it shouldn't be that annoying of a process to convert this binary into an executable?

cjolowicz commented 4 years ago

@wanderrful Don't hesitate to open your own issue :)

I'll just give you some pointers to interesting projects for distributing Python applications:

At the risk of oversimplifying, this list is ordered roughly from developer-friendly to end-user-friendly. pipx is amazing if your users are developers who don't mind installing Python and then using the command-line to get an application from PyPI. shiv bundles your package with all its dependencies, as a sort of zipapp on steroids, and pyoxidizer produces binaries that include the Python interpreter itself. briefcase can produce native binaries for a number of desktop and mobile environments.

Please note that poetry run is not intended for end users at all, because it requires a Poetry environment installed from a source tree to work. Poetry allows you to build a wheel and upload it to PyPI, and that's where its job ends. (Although Poetry 1.1 will have a bundle command with additional deployment options.)

When deploying services into a production environment, Docker is a great option. Check out Itamar Turner Trauring's series on Production-ready Docker packaging. As for Poetry and Docker, my SO answer may be useful.