![Build Status](https://github.com/pythonanywhere/helper_scripts/actions/workflows/tests.yaml/badge.svg)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![PyPI](https://img.shields.io/pypi/v/pythonanywhere)](https://pypi.org/project/pythonanywhere/)
[![Downloads](https://pepy.tech/badge/pythonanywhere)](https://pepy.tech/project/pythonanywhere)
# PythonAnywhere cli tool
`pa` is a single command to manage PythonAnywhere services.
It is designed to be run from PythonAnywhere consoles, but many subcommands can be executed directly
from your own machine (see [usage](#Usage) below).
## Installing
### On PythonAnywhere
In a PythonAnywhere Bash console, run:
pip3.10 install --user pythonanywhere
If there is no `python3.10` on your PythonAnywhere account,
you should upgrade your account to the newest system image.
See [here](https://help.pythonanywhere.com/pages/ChangingSystemImage) how to do that.
`pa` works with python 3.8, 3.9, and 3.10 but we recommend using the latest system image.
### On your own machine
Install the `pythonanywhere` package from [PyPI](https://pypi.org/project/pythonanywhere/).
We recommend using `pipx` if you want to use it only as a cli tool, or a virtual environment
if you want to use a programmatic interface in your own code.
## Usage
There are two ways to use the package. You can just run the scripts or use the underlying api wrappers directly in your scripts.
### Command line interface
### Running `pa` on your local machine
`pa` expects the presence of some environment variables that are provided when you run your code in a PythonAnywere console.
You need to provide them if you run `pa` on your local machine.
`API_TOKEN` -- you need to set this to allow `pa` to connect to the [PythonAnywere API](https://help.pythonanywhere.com/pages/API).
To get an API token, log into PythonAnywhere and go to the "Account" page using the link at the top right.
Click on the "API token" tab, and click the "Create a new API token" button to get your token.
`PYTHONANYWHERE_SITE` is used to connect to PythonAnywhere API and defaults to `www.pythonanywhere.com`,
but you may need to set it to `eu.pythonanywhere.com` if you use our EU site.
If your username on PythonAnywhere is different from the username on your local machine,
you may need to set `USER` for the environment you run `pa` in.
### Programmatic usage in your code
Take a look at the [`pythonanywhere.task`](https://github.com/pythonanywhere/helper_scripts/blob/master/pythonanywhere/task.py)
module and docstrings of `pythonanywhere.task.Task` class and its methods.
### Legacy scripts
Some legacy [scripts](https://github.com/pythonanywhere/helper_scripts/blob/master/legacy.md) (separate for each action) are still available.
## Contributing
Pull requests are welcome! You'll find tests in the [tests](https://github.com/pythonanywhere/helper_scripts/blob/master/tests) folder...
# prep your dev environment
mkvirtualenv --python=python3.10 helper_scripts
pip install -r requirements.txt
pip install -e .
# running the tests:
pytest
# make sure that the code that you have written is well tested:
pytest --cov=pythonanywhere --cov=scripts
# to just run the fast tests:
pytest -m 'not slowtest' -v
Raw data
{
"_id": null,
"home_page": "https://github.com/pythonanywhere/helper_scripts/",
"name": "pythonanywhere",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "pythonanywhere api cloud web hosting",
"author": "PythonAnywhere LLP",
"author_email": "developers@pythonanywhere.com",
"download_url": "https://files.pythonhosted.org/packages/00/0b/9d0d6bf6d2bfde59c5d4335e925964c6322f2f81c01905fd4daa82202a44/pythonanywhere-0.15.5.tar.gz",
"platform": null,
"description": "![Build Status](https://github.com/pythonanywhere/helper_scripts/actions/workflows/tests.yaml/badge.svg)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![PyPI](https://img.shields.io/pypi/v/pythonanywhere)](https://pypi.org/project/pythonanywhere/)\n[![Downloads](https://pepy.tech/badge/pythonanywhere)](https://pepy.tech/project/pythonanywhere)\n\n# PythonAnywhere cli tool\n\n`pa` is a single command to manage PythonAnywhere services. \n\nIt is designed to be run from PythonAnywhere consoles, but many subcommands can be executed directly \nfrom your own machine (see [usage](#Usage) below). \n\n## Installing\n### On PythonAnywhere\nIn a PythonAnywhere Bash console, run: \n\n pip3.10 install --user pythonanywhere\n\nIf there is no `python3.10` on your PythonAnywhere account, \nyou should upgrade your account to the newest system image.\nSee [here](https://help.pythonanywhere.com/pages/ChangingSystemImage) how to do that.\n`pa` works with python 3.8, 3.9, and 3.10 but we recommend using the latest system image.\n\n### On your own machine\nInstall the `pythonanywhere` package from [PyPI](https://pypi.org/project/pythonanywhere/). \nWe recommend using `pipx` if you want to use it only as a cli tool, or a virtual environment \nif you want to use a programmatic interface in your own code.\n\n## Usage\n\nThere are two ways to use the package. You can just run the scripts or use the underlying api wrappers directly in your scripts.\n\n### Command line interface\n\n### Running `pa` on your local machine\n\n`pa` expects the presence of some environment variables that are provided when you run your code in a PythonAnywere console.\nYou need to provide them if you run `pa` on your local machine.\n\n`API_TOKEN` -- you need to set this to allow `pa` to connect to the [PythonAnywere API](https://help.pythonanywhere.com/pages/API). \nTo get an API token, log into PythonAnywhere and go to the \"Account\" page using the link at the top right. \nClick on the \"API token\" tab, and click the \"Create a new API token\" button to get your token.\n\n`PYTHONANYWHERE_SITE` is used to connect to PythonAnywhere API and defaults to `www.pythonanywhere.com`, \nbut you may need to set it to `eu.pythonanywhere.com` if you use our EU site. \n\nIf your username on PythonAnywhere is different from the username on your local machine, \nyou may need to set `USER` for the environment you run `pa` in. \n\n### Programmatic usage in your code\n\nTake a look at the [`pythonanywhere.task`](https://github.com/pythonanywhere/helper_scripts/blob/master/pythonanywhere/task.py) \nmodule and docstrings of `pythonanywhere.task.Task` class and its methods. \n\n### Legacy scripts\n\nSome legacy [scripts](https://github.com/pythonanywhere/helper_scripts/blob/master/legacy.md) (separate for each action) are still available.\n\n## Contributing\n\nPull requests are welcome! You'll find tests in the [tests](https://github.com/pythonanywhere/helper_scripts/blob/master/tests) folder...\n\n # prep your dev environment\n mkvirtualenv --python=python3.10 helper_scripts\n pip install -r requirements.txt\n pip install -e .\n\n # running the tests:\n pytest\n\n # make sure that the code that you have written is well tested:\n pytest --cov=pythonanywhere --cov=scripts\n\n # to just run the fast tests:\n pytest -m 'not slowtest' -v\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "PythonAnywhere helper tools for users",
"version": "0.15.5",
"project_urls": {
"Homepage": "https://github.com/pythonanywhere/helper_scripts/"
},
"split_keywords": [
"pythonanywhere",
"api",
"cloud",
"web",
"hosting"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b50746ca5a3bbefec9a1008015a557f836d01b043508e2c93df550fcb773edd1",
"md5": "7c78d39786d332364a1b0c3e49c74fff",
"sha256": "aae0931150b9df7bbcf7d38555351f5f78d024a75f83e8d9a07a9fafc66fca7e"
},
"downloads": -1,
"filename": "pythonanywhere-0.15.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7c78d39786d332364a1b0c3e49c74fff",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 44093,
"upload_time": "2024-11-28T18:08:47",
"upload_time_iso_8601": "2024-11-28T18:08:47.330029Z",
"url": "https://files.pythonhosted.org/packages/b5/07/46ca5a3bbefec9a1008015a557f836d01b043508e2c93df550fcb773edd1/pythonanywhere-0.15.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "000b9d0d6bf6d2bfde59c5d4335e925964c6322f2f81c01905fd4daa82202a44",
"md5": "5989ef4eb26317fe1b07e5807cad8630",
"sha256": "6abab25d405111a2a0ab94f05d06dc0e2958bc53af082224dd3012f86b1840d9"
},
"downloads": -1,
"filename": "pythonanywhere-0.15.5.tar.gz",
"has_sig": false,
"md5_digest": "5989ef4eb26317fe1b07e5807cad8630",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 53248,
"upload_time": "2024-11-28T18:08:48",
"upload_time_iso_8601": "2024-11-28T18:08:48.763325Z",
"url": "https://files.pythonhosted.org/packages/00/0b/9d0d6bf6d2bfde59c5d4335e925964c6322f2f81c01905fd4daa82202a44/pythonanywhere-0.15.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-28 18:08:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pythonanywhere",
"github_project": "helper_scripts",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "pythonanywhere"
}