A command-line interface for PyScript.
Quickly wrap Python scripts into a HTML template, pre-configured with PyScript.
$ pip install pyscriptsee the Developer setup section on CONTRIBUTING page
$ pyscript wrap <filename.py>This will generate a file called <filename.html> by default.
This can be overwritten with the -o or --output option:
$ pyscript wrap <filename.py> -o <another_filename.html>$ pyscript wrap <filename.py> --showYou can set the title of the browser tab with the --title option:
$ pyscript wrap <filename.py> --title "My cool app!"The -c or --command option can be used to demo very simple cases.
In this case, if the --show option is used and no --output file is used, a temporary file will be generated.
$ pyscript wrap -c 'print("Hello World!")' --show$ pyscript run <path_of_folder>This will serve the folder path_of_folder at localhost:8000 by default
and will open the URL in a browser window. Default is current directory if
path_of_folder is not supplied.
To use a different port, use --port option.
$ pyscript run <path_of_folder> --port 9000To avoid opening a browser window, use --silent option.
$ pyscript run <path_of_folder> --silent$ pyscript create <name_of_app>This will create a new directory named name_of_app under the current directory.
The interactive prompts will further ask for information such as description of the app,
name of the author, email of the author, etc. These of course can be provided via
options such as --author-name etc. Use pyscript create --help for more information.
The following files will be created:
index.html: start page for the projectpyscript.toml: project metadata and config filemain.py: a "Hello world" python starter module
