- Notifications
You must be signed in to change notification settings - Fork25
pyscript/pyscript-cli
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A command-line interface forPyScript.
Quickly wrap Python scripts into a HTML template, pre-configured withPyScript.
❯ pyscript Usage: pyscript [OPTIONS] COMMAND [ARGS]... Command Line Interfacefor PyScript.╭─ Options ──────────────────────────────────────────────────────────────────────────────────────╮│ --version Show project version and exit. ││ --help Show this message and exit. │╰────────────────────────────────────────────────────────────────────────────────────────────────╯╭─ Commands ─────────────────────────────────────────────────────────────────────────────────────╮│ create Create a new pyscript project with the passedin name, creating a new directoryin the ││ current directory. Alternatively, use`--wrap` so as to embed a python file instead. ││ run Creates alocal server to run the app on the path and port specified. │╰────────────────────────────────────────────────────────────────────────────────────────────────╯
$ pip install pyscript
see the Developer setup section on CONTRIBUTING page
$ pyscript run<path_of_folder>
This will serve the folderpath_of_folder
atlocalhost:8000
by defaultand will open the URL in a browser window. Default is current directory ifpath_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--no-view
option.
$ pyscript run<path_of_folder> --no-view
$ pyscript create<name_of_app>
This will create a new directory namedname_of_app
under the current directory.
The interactive prompts will further ask for information such asdescription of the app
,name of the author
,email of the author
, etc. These of course can be provided viaoptions such as--author-name
etc. Usepyscript 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
$ pyscript create --wrap<filename.py>
This will generate a project i.e. a new directory namedfilename
under the current directory.
Similar to the above, interactive prompts will further ask for metadata information.
The following files will be created:
index.html
: start page for the projectpyscript.toml
: project metadata and config filemain.py
: contains code offilename.py
This can be overridden with the-o
or--output
option:
$ pyscript create --wrap<filename.py> -o<another_filename.html>
i.e. the HTML file created in the above directory will now be namedanother_filename.html
The-c
or--command
option can be used to demo very simple cases.
By default, the name of the project folder created will bepyscript-command-app
with the HTML file namedindex.html
.
-o/--output
option can be used with the-c/--command
option to configure name of the project folder as wellas the name of the resulting HTML file.
$ pyscript create --wrap -c'print("Hello World!")' -o<output_filename.html>
This will generate a project i.e. a new directory namedoutput_filename
under the current directory.
Similar to the above, interactive prompts will further ask for metadata information.
The following files will be created:
output_filename.html
: start page for the projectpyscript.toml
: project metadata and config filemain.py
: contains code of the command string passed via-c/--command
About
A CLI for PyScript
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors11
Uh oh!
There was an error while loading.Please reload this page.