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

Pyinstaller binaries #768

Closed
wants to merge 8 commits into from
Closed

Pyinstaller binaries #768

wants to merge 8 commits into from

Conversation

Fizzadar
Copy link
Member

@Fizzadar Fizzadar commented Mar 3, 2022

Sometimes it's desirable to have a single binary instead of a pip/whatever package. Unfortunately in the Python world this isn't a simple task and the resulting binary is pretty slow to execute (10s to start cold). But it works!

@Fizzadar Fizzadar self-assigned this Mar 3, 2022
@codecov
Copy link

codecov bot commented Mar 3, 2022

Codecov Report

Merging #768 (0517696) into 2.x (76c73ba) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##              2.x     #768   +/-   ##
=======================================
  Coverage   91.68%   91.68%           
=======================================
  Files         122      122           
  Lines        7605     7605           
=======================================
  Hits         6973     6973           
  Misses        632      632           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

This makes it possible to build executable and portable (within OS/arch)
`pyinfra` binaries, at the cost of being rather slow compared to the
installed Python package.
In theory this should yield a startup speed improvement.
@v3ss0n
Copy link
Contributor

v3ss0n commented Feb 8, 2023

should be doable with nuitka

@Fizzadar Fizzadar mentioned this pull request May 13, 2023
@Fizzadar
Copy link
Member Author

For now I'm killing this, I do wish to revisit probably using nuitka but the performance is still too much of a concern, although I have some ideas on dealing with this (bundle the pyinfra module into a zip to avoid all the IO operations on startup). Anyway, will revisit in 3.X where X > 0.

@Fizzadar Fizzadar closed this Oct 21, 2023
@paidhi
Copy link

paidhi commented Jun 10, 2024

If you revisit this I would recommend taking a look at what PyApp, by Ofek Lev, has to offer. Hatch (by the same author) has a simple integration with PyApp via it's Binary Builder Plugin.

I use this at work to build an internal utility that is written in Python and has mulitple 3rd-party dependencies (e.g. rich, requests, psutils). It produces a single (Linux ELF) executable that I can just copy an any machine and run.

A good usage example might be Hatch itself. One can download it as a single executable. PyApp provides the executable with a nice "self" subcommand. E.g.: hatch self update.

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

Successfully merging this pull request may close these issues.

None yet

3 participants