PyScript.com的命令行界面
项目描述
PyScript.com CLI
这是一个为pyscript cli
提供的插件,提供了与pyscript.com交互的子命令。
用户指南
PyScript流程
命令行工具是培养PyScript开发“流程”的基本方式。这是此类流程的早期草案,我们欢迎反馈、想法和建设性的意见,因为我们朝着正式发布而努力。由于这是alpha软件,任何东西(很可能)都可能(并将)改变,感谢您的反馈。在这个阶段,我们希望将“流程”和命令巩固为可以更公开分享的beta版本。
它所调用的Python模块和远程API也将随着我们为PyScript社区提供Anaconda的解决方案并帮助工具作者将其功能集成到他们的代码中(如代码编辑器、CI集成等)而发展。
安装
要开始,您可以通过pip安装pyscript-dot-com-cli
软件包
$ pip install pyscript-dot-com-cli
$ pscript
$ pyscript
Usage: pyscript [OPTIONS] COMMAND [ARGS]...
Command Line Interface for PyScript. Run `pyscript setup` to setup the CLI interactively.
╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --version Show project version and exit. │
│ --help Show this message and exit. │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ config Display your settings. │
│ copy Copy the project. Project can be either be identified using the project ID or the combination of username and project slug. │
│ create Create a new pyscript project with the passed in name, creating a new directory in the current directory. Alternatively, use │
│ `--wrap` so as to embed a python file instead. │
│ delete Delete the current project if inside a project folder. Can also delete a project by its ID or slug. Can also delete all projects via │
│ `--all`. │
│ download Download the project. Project can be either be identified using the project ID or the combination of username and project slug in │
│ the following format: @USERNAME/SLUG, eg: @fpliger/location-api │
│ info Show information of the current project. │
│ list List projects associated with a particular user or matching a certain criteria. The output is sorted by project slug. │
│ login Login to pyscript.com, use `--api_key` to login via API key. By default it will open a browser window to login via the web │
│ interface. │
│ logout Logout of pyscript.com. │
│ ping Ping the API to ensure settings / authentication. │
│ run Creates a local server to run the app on the path and port specified. │
│ setup Get started with the pyscript.com CLI by running a walkthrough setup. │
│ upload Upload the current project. │
│ version Manage project versions. │
│ view View the current project in a browser. │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
这也会为您安装基础的 pyscript cli
软件包。
设置 CLI
一旦安装了 CLI,请登录到 pyscript.com。为此,您可以运行命令 pyscript setup
并完成设置过程,系统将提示您输入各种详细信息,以便您开始使用。
$ pyscript setup
...
Let's get your CLI setup with Pyscript.com, do you already have an account? [y/N]:
创建新的 PyScript 项目
$ pyscript create demo-project
App description: This is a human-readable description of the project.
Author name: Nicholas H.Tollervey
Author email: ntollervey@anaconda.com
$ cd demo-project
$ ls
index.html main.py pyscript.toml
新项目包含三个文件
index.html
(包含“Hello World!”的基本框架代码),main.py
(一个简单的 Python 脚本,打印“Hello World!”),pyscript.toml
(包含项目元数据)。
编辑 index.html
或 main.py
以开始使用。
在本地查看您的作品
$ pyscript run
Serving from ~/demo-project at port 8000. To stop, press Ctrl+C.
将项目上传到 pyscript.com
在修改项目后,您可以运行以下命令
$ pyscript upload
Contacting the mother ship...
Uploading project files...
Found 3 new files present locally, but not on pyscript.com:
- main.py
- pyscript.toml
- index.html
Found 0 files locally that differ in content from what is present on pyscript.com:
Uploading new as well as modified files present locally.
OK.
To see your changes online type: pyscript view
在 pyscript.com 上查看您的项目
现在我们可以通过运行以下命令在线查看项目
$ pyscript view
Opening url: https://fabiorosado.pyscriptapps.com/demo-project/
OK.
注意,命令 pyscript view
将带您访问默认版本,在本例中为 latest
发布您项目的新版本
现在让我们创建您项目的版本,这在您想与他人分享项目特定时间点时非常有用。
$ pyscript version create
OK. Version v1 created.
URL: https://fabiorosado.pyscriptapps.com/demo-project/v1/
您现在可以与他人共享此 URL,也可以将版本传递给 pyscript view
命令以查看此特定版本
$ pyscript view v1
Opening url: https://fabiorosado.pyscriptapps.com/demo-project/v1/
OK.
其他有用命令
ping API 确保连接
$ pyscript ping
OK. Pong.
列出所有 pyscript.com 上的项目
$ pyscript list
demo-project (id: c58b3a34-6ad3-413f-b569-93bce7194e16)
OK. 1 projects found.
从 pyscript.com 删除项目
$ pyscript delete c58b3a34-6ad3-413f-b569-93bce7194e16
Are you sure you want to delete this project? [y/N]: y
OK.
从 pyscript.com 登出(本地)
$ pyscript logout
OK. See you soon!
项目详情
下载文件
下载您平台上的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。
源分布
pyscript_dot_com_cli-0.1.0.tar.gz (38.9 kB 查看散列)