Compiles Python to an exe
Project description
python-compile
Compile python apps to linux executables
This project will use docker to compile your one file python app into a binary that's runnable on many linux systems. Work in progress remains for building windows apps via the docker system.
To develop software, run . ./activate.sh
Example
python-compile --os debian --input demo_http_server.py --requirements requirements.txt
demo_http_server.py
from http.server import CGIHTTPRequestHandler, SimpleHTTPRequestHandler, ThreadingHTTPServer
import socket
import argparse
import os
from http.server import test
if __name__ == '__main__':
import argparse
import contextlib
parser = argparse.ArgumentParser()
parser.add_argument('--cgi', action='store_true',
help='run as CGI server')
parser.add_argument('--bind', '-b', metavar='ADDRESS',
help='specify alternate bind address '
'(default: all interfaces)')
parser.add_argument('--directory', '-d', default=os.getcwd(),
help='specify alternate directory '
'(default: current directory)')
parser.add_argument('port', action='store', default=8000, type=int,
nargs='?',
help='specify alternate port (default: 8000)')
args = parser.parse_args()
if args.cgi:
handler_class = CGIHTTPRequestHandler
else:
handler_class = SimpleHTTPRequestHandler
# ensure dual-stack is not disabled; ref #38907
class DualStackServer(ThreadingHTTPServer):
def server_bind(self):
# suppress exception when protocol is IPv4
with contextlib.suppress(Exception):
self.socket.setsockopt(
socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)
return super().server_bind()
def finish_request(self, request, client_address):
self.RequestHandlerClass(request, client_address, self,
directory=args.directory)
test(
HandlerClass=handler_class,
ServerClass=DualStackServer,
port=args.port,
bind=args.bind,
)
Windows
This environment requires you to use git-bash.
Linting
Run ./lint.sh to find linting errors using pylint, flake8 and mypy.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python-compile-1.0.2.tar.gz.
File metadata
- Download URL: python-compile-1.0.2.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe515d62d1b20f9043155bc8b27214ea3688ce10d23e20e7b972c105f85fbcfb
|
|
| MD5 |
b6591636e7ffdc0e857a2f18e587dd66
|
|
| BLAKE2b-256 |
e21d114adf9830d1fd3b3e7d8f9ad80c6db895b07e666a5ac9fc56497188ed59
|
File details
Details for the file python_compile-1.0.2-py2.py3-none-any.whl.
File metadata
- Download URL: python_compile-1.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5572f25ad0ba4a3a4f012b35b3ab03ff26db212b41f379de1c0dc8920c4e92ea
|
|
| MD5 |
3ba2b7fba85b99bb2b877db6e3203c7e
|
|
| BLAKE2b-256 |
84c383051c91af38d5b37c929b8752d412881b4aa14a3eea44c93fe1705e7fa3
|