Skip to content

pyscript/pyscript-cli

Repository files navigation

PyScript CLI

A command-line interface for PyScript.

Version Test codecov pre-commit.ci status Checked with mypy

Quickly wrap Python scripts into a HTML template, pre-configured with PyScript.

Installation

Using Pip

$ pip install pyscript

Installing the developer setup from the a repository clone

see the Developer setup section on CONTRIBUTING page

Usage

wrap

Embed a Python script into a PyScript HTML file

$ 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>

Open the script inside the browser using the --show option

$ pyscript wrap <filename.py> --show

Set a title for the browser tab

You can set the title of the browser tab with the --title option:

$ pyscript wrap <filename.py> --title "My cool app!"

Very simple command examples with --command option

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

run

Spin up a local server to run on the path and specified port

$ 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 9000

To avoid opening a browser window, use --silent option.

$ pyscript run <path_of_folder> --silent

About

A CLI for PyScript

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors