Skip to content
This repository was archived by the owner on Jun 22, 2025. It is now read-only.

Commit 61b98e8

Browse files
Merge branch 'master' into master
2 parents 8c50db0 + 90125fb commit 61b98e8

File tree

23 files changed

+5399
-4293
lines changed

23 files changed

+5399
-4293
lines changed

.github/FUNDING.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
github: samuelhwilliams
2+
patreon: # Replace with a single Patreon username
3+
open_collective: # Replace with a single Open Collective username
4+
ko_fi: # Replace with a single Ko-fi username
5+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
6+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
7+
liberapay: # Replace with a single Liberapay username
8+
issuehunt: # Replace with a single IssueHunt username
9+
otechie: # Replace with a single Otechie username
10+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.github/ISSUE_TEMPLATE/help-me.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ assignees: ''
1111
A clear and concise description of what you're trying to accomplish, and where you're having difficulty.
1212

1313
**Code snippet(s)**
14+
Here is some code that can be easily used to reproduce the problem or understand what I need help with.
15+
16+
- [ ] I know that if I don't provide sample code that allows someone to quickly step into my shoes, I may not get the help I want or my issue may be closed.
1417

1518
```python
1619
import eel

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Change log
22

3+
### v0.13.0
4+
* Drop support for Python versions below 3.6
5+
* Add `jinja2` as an extra for pip installation, e.g. `pip install eel[jinja2]`.
6+
* Bump dependencies in examples to dismiss github security notices. We probably want to set up a policy to ignore example dependencies as they shouldn't be considered a source of vulnerabilities.
7+
* Disable edge on non-Windows platforms until we implement proper support.
8+
9+
### v0.12.4
10+
* Return greenlet task from `spawn()` ([#300](https://github.com/samuelhwilliams/Eel/pull/300))
11+
* Set JS mimetype to reduce errors on Windows platform ([#289](https://github.com/samuelhwilliams/Eel/pull/289))
12+
313
### v0.12.3
414
* Search for Chromium on macOS.
515

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Eel
22

3+
[![PyPI version](https://img.shields.io/pypi/v/Eel?style=for-the-badge)](https://pypi.org/project/Eel/)
4+
![PyPi Downloads](https://img.shields.io/pypi/dm/Eel?style=for-the-badge)
5+
![Python](https://img.shields.io/pypi/pyversions/Eel?style=for-the-badge)
6+
[![License](https://img.shields.io/pypi/l/Eel.svg?style=for-the-badge)](https://pypi.org/project/Eel/)
7+
8+
9+
[![Total alerts](https://img.shields.io/lgtm/alerts/g/samuelhwilliams/Eel.svg?logo=lgtm&style=for-the-badge)](https://lgtm.com/projects/g/samuelhwilliams/Eel/alerts/)
10+
[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/samuelhwilliams/Eel.svg?logo=lgtm&style=for-the-badge)](https://lgtm.com/projects/g/samuelhwilliams/Eel/context:javascript)
11+
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/samuelhwilliams/Eel.svg?logo=lgtm&style=for-the-badge)](https://lgtm.com/projects/g/samuelhwilliams/Eel/context:python)
12+
13+
314
Eel is a little Python library for making simple Electron-like offline HTML/JS GUI apps, with full access to Python capabilities and libraries.
415

516
> **Eel hosts a local webserver, then lets you annotate functions in Python so that they can be called from Javascript, and vice versa.**
@@ -47,6 +58,12 @@ Install from pypi with `pip`:
4758
pip install eel
4859
```
4960

61+
To include support for HTML templating, currently using [Jinja2](https://pypi.org/project/Jinja2/#description):
62+
63+
```shell
64+
pip install eel[jinja2]
65+
```
66+
5067
## Usage
5168

5269
### Directory Structure

eel/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import print_function # Python 2 compatibility stuff
21
from builtins import range
32
import traceback
43
from io import open
@@ -14,7 +13,9 @@
1413
import sys
1514
import pkg_resources as pkg
1615
import socket
16+
import mimetypes
1717

18+
mimetypes.add_type('application/javascript', '.js')
1819
_eel_js_file = pkg.resource_filename('eel', 'eel.js')
1920
_eel_js = open(_eel_js_file, encoding='utf-8').read()
2021
_websockets = []
@@ -174,7 +175,7 @@ def sleep(seconds):
174175

175176

176177
def spawn(function, *args, **kwargs):
177-
gvt.spawn(function, *args, **kwargs)
178+
return gvt.spawn(function, *args, **kwargs)
178179

179180
# Bottle Routes
180181

eel/__main__.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1-
from __future__ import print_function
2-
import sys
31
import pkg_resources as pkg
42
import PyInstaller.__main__ as pyi
53
import os
4+
from argparse import ArgumentParser
65

7-
args = sys.argv[1:]
8-
main_script = args.pop(0)
9-
web_folder = args.pop(0)
6+
parser = ArgumentParser(description="""
7+
Eel is a little Python library for making simple Electron-like offline HTML/JS GUI apps,
8+
with full access to Python capabilities and libraries.
9+
""")
10+
parser.add_argument(
11+
"main_script",
12+
type=str,
13+
help="Main python file to run app from"
14+
)
15+
parser.add_argument(
16+
"web_folder",
17+
type=str,
18+
help="Folder including all web files including file as html, css, ico, etc."
19+
)
20+
args, unknown_args = parser.parse_known_args()
21+
main_script = args.main_script
22+
web_folder = args.web_folder
1023

1124
print("Building executable with main script '%s' and web folder '%s'...\n" %
1225
(main_script, web_folder))
@@ -17,8 +30,7 @@
1730

1831
needed_args = ['--hidden-import', 'bottle_websocket',
1932
'--add-data', js_file_arg, '--add-data', web_folder_arg]
20-
full_args = [main_script] + needed_args + args
21-
33+
full_args = [main_script] + needed_args + unknown_args
2234
print('Running:\npyinstaller', ' '.join(full_args), '\n')
2335

2436
pyi.run(full_args)

eel/edge.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import platform
12
import subprocess as sps
23
import sys
34

@@ -10,5 +11,7 @@ def run(_path, options, start_urls):
1011

1112

1213
def find_path():
13-
# Path isn't necessary. Edge is launched with a CLI argument
14-
return True
14+
if platform.system() == 'Windows':
15+
return True
16+
17+
return False

examples/01 - hello_world/hello.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import print_function # For Py2/3 compatibility
21
import eel
32

43
# Set web files folder

examples/02 - callbacks/callbacks.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import print_function # For Py2/3 compatibility
21
import eel
32
import random
43

examples/03 - sync_callbacks/sync_callbacks.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import print_function # For Py2/3 compatibility
21
import eel, random
32

43
eel.init('web')
@@ -18,4 +17,4 @@ def py_random():
1817
print('Got this from Javascript:', n)
1918

2019
while True:
21-
eel.sleep(1.0)
20+
eel.sleep(1.0)

0 commit comments

Comments
 (0)