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

Statically compiled binary #291

Closed
YahiaJr opened this issue Jun 18, 2023 · 2 comments
Closed

Statically compiled binary #291

YahiaJr opened this issue Jun 18, 2023 · 2 comments

Comments

@YahiaJr
Copy link

YahiaJr commented Jun 18, 2023

I have a portable shell environment that contains lots of statically compiled binaries, and I bring it to multiple machines/servers that I mange regularly. I can encounter a system that doesn't necessarily has python installed nor have internet connection/admin privileges to install it.

Is there a way to build shell_gpt into a single binary file that I can run on different machines without dependency issues?

I know that I won't be able to use it without internet anyways, but it would be helpful to have it nonetheless if its possible.

So, if you don't have the time to add it in next release, could you point me how to build it myself.

Thank you

@TheR1D
Copy link
Owner

TheR1D commented Jun 18, 2023

You can build sgpt into a single binary file using pyinstaller. It will include all dependencies along with the Python interpreter, dynamically linked libraries, and the app into a single package.

git clone https://github.com/TheR1D/shell_gpt.git
cd shell_gpt
python3 -m venv venv
source venv/bin/activate
pip install pyinstaller
pip install -e .
cd sgpt
pyinstaller --onefile app.py

This process generates a "dist" directory containing the binary file "app" that you can execute with ./app --help.

Please note:

  • The binary will be compatible with the operating system and architecture you compile it on. For example, if you compile your Python script into a binary on a Linux machine, the resulting binary will only be compatible with Linux.
  • This method may lead to significant performance degradation.

@YahiaJr
Copy link
Author

YahiaJr commented Jun 18, 2023

THANK YOU... 🙏

@YahiaJr YahiaJr closed this as completed Jun 18, 2023
@TheR1D TheR1D changed the title statically compiled binary Statically compiled binary Jun 19, 2023
Repository owner locked as resolved and limited conversation to collaborators Jun 19, 2023
@TheR1D TheR1D pinned this issue Jun 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants