Skip to main content

Build Status License: MIT PyPI Downloads

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

pa [OPTIONS] COMMAND [ARGS]...

Options:
  --install-completion  Install completion for the current shell.
  --show-completion     Show completion for the current shell, to copy it or
                        customize the installation.
  -h, --help            Show this message and exit.

Commands:
  django    Makes Django Girls tutorial projects deployment easy
  path      Perform some operations on files
  schedule  Manage scheduled tasks
  students  Perform some operations on students
  webapp    Everything for web apps: use this if you're not using our experimental features 
  website   EXPERIMENTAL: create and manage ASGI websites

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. 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 PYTHONANYWHERE_USERNAME for the environment you run pa in.

Programmatic usage in your code

Take a look at the pythonanywhere.task module and docstrings of pythonanywhere.task.Task class and its methods.

Legacy scripts

Some legacy scripts (separate for each action) are still available.

Contributing

Pull requests are welcome! You'll find tests in the tests folder...

Requires uv.

# prep your dev environment
uv sync --extra test

# running the tests:
uv run pytest

# make sure that the code that you have written is well tested:
uv run pytest --cov=pythonanywhere --cov=scripts

# to just run the fast tests:
uv run pytest -m 'not slowtest' -v

Release files for pythonanywhere 0.19.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pythonanywhere 0.19.1
File Size Uploaded
pythonanywhere-0.19.1.tar.gz 56.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pythonanywhere 0.19.1
File Interpreter ABI Platform
pythonanywhere-0.19.1-py3-none-any.whl Python 3 none any Details

Total release size: 103.0 kB

Release files / pythonanywhere-0.19.1.tar.gz

Download URL pythonanywhere-0.19.1.tar.gz
Size 56.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6c015cc71634f4ecb0af213fd51d408be3f7047e8cebad94fe9ad3e389659cb8
BLAKE2b-256 checksum
How to use checksums
2bb561f164743c4e8dbdd64faa7c1276a0e3a0ec38ced5f1c3781cb782ae3dbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pythonanywhere-0.19.1-py3-none-any.whl

Download URL pythonanywhere-0.19.1-py3-none-any.whl
Size 46.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b2048c24073dc9bb25017f265a3d1240c56fac013d4d86b2defb32f3900b36c
BLAKE2b-256 checksum
How to use checksums
fe6a63e3806877e253806fce5c605beccc37962711084dd3ed830ccab51a8f8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.19.1 This release

2 release files

0.19.0

2 release files

0.18.0

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.15.5

2 release files

0.15.4

2 release files

0.15.3

1 release file

0.15.2

1 release file

0.15.1

1 release file

0.15.0

1 release file

0.14.1

1 release file

0.14.0

1 release file

0.13.0

1 release file

0.12.2

1 release file

0.12.1

1 release file

0.12.0

1 release file

0.11.0

1 release file

0.10.3

1 release file

0.10.2

1 release file

0.10.1

1 release file

0.10.0

1 release file

0.9.10

1 release file

0.9.9

1 release file

0.9.8

1 release file

0.9.7

1 release file

0.9.6

1 release file

0.9.5

1 release file

0.9.4

1 release file

0.9.3

1 release file

0.9.2

1 release file

0.9.1

1 release file

0.9.0

1 release file

0.8.3

1 release file

0.8.2

1 release file

0.8.1

1 release file

0.8.0

1 release file

0.7.4

1 release file

0.7.3

1 release file

0.7.2

1 release file

0.7.1

1 release file

0.7

1 release file

0.6

1 release file

0.5.1

1 release file

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page