Package web apps for the terminal. Based on PyInstaller and bad intentions.
Project description
cork
Take a Flask web application and create a terminal application. "Inspired" by Electron.js.
Created during a silly/useless tech hackathon at the Recurse Center.
Installation
pip install cork
Usage
The cork
package provides a command that will produce an executable. All you have to do is point it at a valid place to import a Flask app object.
If your Flask application lived in the file example.py
, you could run this command:
cork example
PyInstaller runs under the hood to package up the dependencies and create the executable. Your executable will live in dist/<example_>app/<example_>app
.
You can distribute this directory to any computer and it will execute your web application as a terminal interface, whether Python or any of your dependencies are installed or not.
Distributing cork Apps
Right now cork apps require the Lynx console-based web browser to be installed on the host system. This requirement will be abolished in future releases. Other than that, a cork application executable should require no external dependencies (including any Python libraries, or even a Python interpreter).
Future
PyInstaller creates very crowded directories. Because a Flask app may depend on templates or other files that are stored on the disk, I have not been able to find out a way to create a "true" one-file executable. A second-best option could be packaging all the PyInstaller cruft into a deps
directory that is shipped with an app-launcher symlink that points to the executable file in deps
.
cork apps depend on Lynx being installed on the host system. Short-term, cork should bundle a Lynx executable with the rest of the application dependencies so that the user does not need to install Lynx on their system. Longer-term, the web app should be browsed to in a more "headless" interface that hides the navigation features and enhances the illusion that the user is running a native terminal desktop application. There may be a way to approximate headless-Lynx in the way that Electron approximates headless-Chromium. Or we may need to write a pure-Python terminal web browser. This would also solve the problem of needing to bundle a Lynx binary, since PyInstaller could handle it like any Python dependency.
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
File details
Details for the file cork-0.1.tar.gz
.
File metadata
- Download URL: cork-0.1.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18aaac07f44090e04aef0686f67112b2fe1ecc4be7166e41edb69dd5d609559e |
|
MD5 | b6dea3133ceafaae1feba8de7b346b7e |
|
BLAKE2b-256 | 14c896f15c0728f68983ee495f46425af01ce0ae31540f103d74b9f219ac7860 |
File details
Details for the file cork-0.1-py3-none-any.whl
.
File metadata
- Download URL: cork-0.1-py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 018544eed5d258719a18975821c9659574347c4aee6ba04e43c8fc277e7aba55 |
|
MD5 | 355ce82179c0ce529f37fe301ed0915b |
|
BLAKE2b-256 | 818b534187eea8515479174265d88558b0a69ebb9ad66ff31ecdb289dbb09d40 |