# PyScript.com CLI
This is a plugin for the `pyscript cli` that provides sub-commands for interacting
with pyscript.com.
# User guide
## PyScript Flow
The command line tool is an essential way of fostering a PyScript development
"flow". **This is an early draft of what such a flow might be**, and we welcome
feedback, ideas and constructive feedback as we work towards a proper release.
Since this is alpha software, anything might (and probably will) change, thanks
to your feedback. At this stage, we want to solidify the "flow" and commands
into a beta release we can share more publicly.
The Python module and remote API to which it calls will also develop as we hone
Anaconda's offering to the PyScript community and help tool authors integrate
such functionality into their code (such as code editors, CI integrations
and so on).
### Installation
To get started, you can install the `pyscript-dot-com-cli` package via pip:
```bash
$ 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. │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
```
This will also install the base `pyscript cli` package for you.
### Setting up the CLI
Once you have the CLI installed, log in to pyscript.com. To help with this, you can run
the command `pyscript setup` and go through the setup process, which will prompt
you for various details so that you can get up and running.
```bash
$ pyscript setup
...
Let's get your CLI setup with Pyscript.com, do you already have an account? [y/N]:
```
### Create a new PyScript project
```bash
$ 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
```
The new project is instantiated with three files:
* `index.html` (containing all the basic scaffolding code for "Hello World!"),
* `main.py` (a simple Python script that prints "Hello World!"),
* `pyscript.toml` (containing project metadata).
Edit `index.html` or `main.py` to get going.
See your work locally via:
```bash
$ pyscript run
Serving from ~/demo-project at port 8000. To stop, press Ctrl+C.
```
### Upload a project to pyscript.com
After making some changes to your project, you can run the command:
```bash
$ 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
```
### View your project on pyscript.com
We can now view the project online by running:
```bash
$ pyscript view
Opening url: https://fabiorosado.pyscriptapps.com/demo-project/
OK.
```
Note that the command `pyscript view` will take you to your default version which in this
case will be `latest`
### Release a new version of your project
Let's now create a version of your project, his is useful if you want to share your
project with others at a specific point in time.
```bash
$ pyscript version create
OK. Version v1 created.
URL: https://fabiorosado.pyscriptapps.com/demo-project/v1/
```
You can now share the url with others, you can also pass the version to the `pyscript view` command to
see this specific version
```bash
$ pyscript view v1
Opening url: https://fabiorosado.pyscriptapps.com/demo-project/v1/
OK.
```
### Other helpful commands
#### Ping the API to ensure connection
```bash
$ pyscript ping
OK. Pong.
```
#### List all your pyscript.com projects
```bash
$ pyscript list
demo-project (id: c58b3a34-6ad3-413f-b569-93bce7194e16)
OK. 1 projects found.
```
### Delete a project from pyscript.com
```bash
$ pyscript delete c58b3a34-6ad3-413f-b569-93bce7194e16
Are you sure you want to delete this project? [y/N]: y
OK.
```
### Log out of pyscript.com (Locally)
```bash
$ pyscript logout
OK. See you soon!
```
Raw data
{
"_id": null,
"home_page": "https://pyscript.com",
"name": "pyscript-dot-com-cli",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "pyscript, cli, pyscript.com, pyscript-cli, pyscript-dot-com",
"author": "Fabio Pliger, Nicholas Tollervey, Fabio Rosado, Madhur Tandon",
"author_email": "fpliger@anaconda.com, ntollervey@anaconda.com, frosado@anaconda.com, mtandon@anaconda.com",
"download_url": "https://files.pythonhosted.org/packages/97/45/10973107b89da8bd542fa49afc64595f75cea51329b21f748444efae65dd/pyscript_dot_com_cli-0.1.0.tar.gz",
"platform": null,
"description": "# PyScript.com CLI\n\nThis is a plugin for the `pyscript cli` that provides sub-commands for interacting\nwith pyscript.com.\n\n# User guide\n\n## PyScript Flow\n\nThe command line tool is an essential way of fostering a PyScript development\n\"flow\". **This is an early draft of what such a flow might be**, and we welcome\nfeedback, ideas and constructive feedback as we work towards a proper release.\nSince this is alpha software, anything might (and probably will) change, thanks\nto your feedback. At this stage, we want to solidify the \"flow\" and commands\ninto a beta release we can share more publicly.\n\nThe Python module and remote API to which it calls will also develop as we hone\nAnaconda's offering to the PyScript community and help tool authors integrate\nsuch functionality into their code (such as code editors, CI integrations\nand so on).\n\n### Installation\n\nTo get started, you can install the `pyscript-dot-com-cli` package via pip:\n\n```bash\n$ pip install pyscript-dot-com-cli\n$ pscript\n$ pyscript\n\n Usage: pyscript [OPTIONS] COMMAND [ARGS]...\n\n Command Line Interface for PyScript. Run `pyscript setup` to setup the CLI interactively.\n\n\u256d\u2500 Options \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 --version Show project version and exit. \u2502\n\u2502 --help Show this message and exit. \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n\u256d\u2500 Commands \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 config Display your settings. \u2502\n\u2502 copy Copy the project. Project can be either be identified using the project ID or the combination of username and project slug. \u2502\n\u2502 create Create a new pyscript project with the passed in name, creating a new directory in the current directory. Alternatively, use \u2502\n\u2502 `--wrap` so as to embed a python file instead. \u2502\n\u2502 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 \u2502\n\u2502 `--all`. \u2502\n\u2502 download Download the project. Project can be either be identified using the project ID or the combination of username and project slug in \u2502\n\u2502 the following format: @USERNAME/SLUG, eg: @fpliger/location-api \u2502\n\u2502 info Show information of the current project. \u2502\n\u2502 list List projects associated with a particular user or matching a certain criteria. The output is sorted by project slug. \u2502\n\u2502 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 \u2502\n\u2502 interface. \u2502\n\u2502 logout Logout of pyscript.com. \u2502\n\u2502 ping Ping the API to ensure settings / authentication. \u2502\n\u2502 run Creates a local server to run the app on the path and port specified. \u2502\n\u2502 setup Get started with the pyscript.com CLI by running a walkthrough setup. \u2502\n\u2502 upload Upload the current project. \u2502\n\u2502 version Manage project versions. \u2502\n\u2502 view View the current project in a browser. \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n\n```\n\nThis will also install the base `pyscript cli` package for you.\n\n### Setting up the CLI\n\nOnce you have the CLI installed, log in to pyscript.com. To help with this, you can run\nthe command `pyscript setup` and go through the setup process, which will prompt\nyou for various details so that you can get up and running.\n\n```bash\n$ pyscript setup\n...\nLet's get your CLI setup with Pyscript.com, do you already have an account? [y/N]:\n```\n\n\n### Create a new PyScript project\n\n```bash\n$ pyscript create demo-project\nApp description: This is a human-readable description of the project.\nAuthor name: Nicholas H.Tollervey\nAuthor email: ntollervey@anaconda.com\n$ cd demo-project\n$ ls\nindex.html main.py pyscript.toml\n```\n\nThe new project is instantiated with three files:\n\n* `index.html` (containing all the basic scaffolding code for \"Hello World!\"),\n* `main.py` (a simple Python script that prints \"Hello World!\"),\n* `pyscript.toml` (containing project metadata).\n\nEdit `index.html` or `main.py` to get going.\n\nSee your work locally via:\n\n```bash\n$ pyscript run\nServing from ~/demo-project at port 8000. To stop, press Ctrl+C.\n```\n\n\n### Upload a project to pyscript.com\n\nAfter making some changes to your project, you can run the command:\n\n```bash\n$ pyscript upload\nContacting the mother ship...\nUploading project files...\nFound 3 new files present locally, but not on pyscript.com:\n - main.py\n - pyscript.toml\n - index.html\n\nFound 0 files locally that differ in content from what is present on pyscript.com:\n\nUploading new as well as modified files present locally.\nOK.\nTo see your changes online type: pyscript view\n```\n\n### View your project on pyscript.com\n\nWe can now view the project online by running:\n\n```bash\n$ pyscript view\nOpening url: https://fabiorosado.pyscriptapps.com/demo-project/\nOK.\n```\n\nNote that the command `pyscript view` will take you to your default version which in this\ncase will be `latest`\n\n\n### Release a new version of your project\n\nLet's now create a version of your project, his is useful if you want to share your\nproject with others at a specific point in time.\n\n```bash\n$ pyscript version create\nOK. Version v1 created.\nURL: https://fabiorosado.pyscriptapps.com/demo-project/v1/\n```\n\nYou can now share the url with others, you can also pass the version to the `pyscript view` command to\nsee this specific version\n\n```bash\n$ pyscript view v1\nOpening url: https://fabiorosado.pyscriptapps.com/demo-project/v1/\nOK.\n```\n\n### Other helpful commands\n\n#### Ping the API to ensure connection\n\n```bash\n$ pyscript ping\nOK. Pong.\n```\n\n\n#### List all your pyscript.com projects\n\n```bash\n$ pyscript list\ndemo-project (id: c58b3a34-6ad3-413f-b569-93bce7194e16)\nOK. 1 projects found.\n```\n\n### Delete a project from pyscript.com\n\n```bash\n$ pyscript delete c58b3a34-6ad3-413f-b569-93bce7194e16\nAre you sure you want to delete this project? [y/N]: y\nOK.\n```\n\n### Log out of pyscript.com (Locally)\n\n```bash\n$ pyscript logout\nOK. See you soon!\n```\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Command Line Interface for PyScript.com",
"version": "0.1.0",
"project_urls": {
"Documentation": "https://docs.pyscript.net",
"Examples": "https://pyscript.com/@examples",
"Homepage": "https://pyscript.com",
"Repository": "https://github.com/anaconda/pyscript-dot-com-issues"
},
"split_keywords": [
"pyscript",
" cli",
" pyscript.com",
" pyscript-cli",
" pyscript-dot-com"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "79021c32c510dc60b933c25828000d583f2b829f64be07047b934c4ab37dfbc8",
"md5": "ae21dcec6d0af996409acfedd4b1c246",
"sha256": "a66acb11716f18d035960ecbf58c537c0ca35f18c32c31445998fb884dfa54e9"
},
"downloads": -1,
"filename": "pyscript_dot_com_cli-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ae21dcec6d0af996409acfedd4b1c246",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 35845,
"upload_time": "2024-09-09T16:29:37",
"upload_time_iso_8601": "2024-09-09T16:29:37.227516Z",
"url": "https://files.pythonhosted.org/packages/79/02/1c32c510dc60b933c25828000d583f2b829f64be07047b934c4ab37dfbc8/pyscript_dot_com_cli-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "974510973107b89da8bd542fa49afc64595f75cea51329b21f748444efae65dd",
"md5": "2a3058ded60173d5c3914551e6288242",
"sha256": "e1ed400273ad977d390a4227c5cc49fcd65afa245fec50c054e514954ff3a324"
},
"downloads": -1,
"filename": "pyscript_dot_com_cli-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "2a3058ded60173d5c3914551e6288242",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 38903,
"upload_time": "2024-09-09T16:29:38",
"upload_time_iso_8601": "2024-09-09T16:29:38.477353Z",
"url": "https://files.pythonhosted.org/packages/97/45/10973107b89da8bd542fa49afc64595f75cea51329b21f748444efae65dd/pyscript_dot_com_cli-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-09 16:29:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "anaconda",
"github_project": "pyscript-dot-com-issues",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pyscript-dot-com-cli"
}