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

Off-load pyinstaller config to its hook #328

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change log

### v0.15.3
* Adds a `distribution` extra to install PyInstaller automatically.
* Updates the main Eel script to build using PyInstaller's Eel hook (https://github.com/pyinstaller/pyinstaller-hooks-contrib/pull/6).

### v0.15.2
* Adds `register_eel_routes` to handle applying Eel routes to non-Bottle custom app instances.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ while True:
If you want to package your app into a program that can be run on a computer without a Python interpreter installed, you should use **PyInstaller**.

1. Configure a virtualenv with desired Python version and minimum necessary Python packages
2. Install PyInstaller `pip install PyInstaller`
2. Install Eel with extra packages to simplify distribution `pip install eel[distribution]`. Eel currently uses [PyInstaller](https://www.pyinstaller.org/) to do the hard work.
3. In your app's folder, run `python -m eel [your_main_script] [your_web_folder]` (for example, you might run `python -m eel hello.py web`)
4. This will create a new folder `dist/`
5. Valid PyInstaller flags can be passed through, such as excluding modules with the flag: `--exclude module_name`. For example, you might run `python -m eel file_access.py web --exclude win32com --exclude numpy --exclude cryptography`
Expand Down
6 changes: 1 addition & 5 deletions eel/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import pkg_resources as pkg
import PyInstaller.__main__ as pyi
import os
from argparse import ArgumentParser
Expand All @@ -24,12 +23,9 @@
print("Building executable with main script '%s' and web folder '%s'...\n" %
(main_script, web_folder))

eel_js_file = pkg.resource_filename('eel', 'eel.js')
js_file_arg = '%s%seel' % (eel_js_file, os.pathsep)
web_folder_arg = '%s%s%s' % (web_folder, os.pathsep, web_folder)

needed_args = ['--hidden-import', 'bottle_websocket',
'--add-data', js_file_arg, '--add-data', web_folder_arg]
needed_args = ['--add-data', web_folder_arg]
full_args = [main_script] + needed_args + unknown_args
print('Running:\npyinstaller', ' '.join(full_args), '\n')

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name='Eel',
version='0.15.2',
version='0.15.3',
author='Python Eel Organisation',
author_email='[email protected]',
url='https://github.com/python-eel/Eel',
Expand All @@ -16,6 +16,7 @@
},
install_requires=['bottle', 'bottle-websocket', 'future', 'pyparsing', 'whichcraft'],
extras_require={
"distribution": ['pyinstaller>=4.0.0,<6.0.0'],
"jinja2": ['jinja2>=2.10']
},
python_requires='>=3.6',
Expand Down